From 3f677ad35357e74a6fccb65678e169b5bc62f67d Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 9 Mar 2025 18:35:55 +0700 Subject: [PATCH] Update bread item --- .../{ImperfectBread.kt => ImperfectBreadItem.kt} | 14 +++++--------- .../ru/dbotthepony/mc/otm/registry/game/MItems.kt | 8 +------- 2 files changed, 6 insertions(+), 16 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/{ImperfectBread.kt => ImperfectBreadItem.kt} (66%) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBread.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBreadItem.kt similarity index 66% rename from src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBread.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBreadItem.kt index d67ae84e9..0ad85e2ea 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBread.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBreadItem.kt @@ -1,5 +1,6 @@ package ru.dbotthepony.mc.otm.item.consumables +import net.minecraft.server.level.ServerPlayer import net.minecraft.world.effect.MobEffectInstance import net.minecraft.world.effect.MobEffects import net.minecraft.world.level.Level @@ -9,17 +10,12 @@ import net.minecraft.world.food.FoodProperties import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack -class ImperfectBread(properties: Item.Properties) : Item(properties) { +class ImperfectBreadItem(properties: Item.Properties) : Item(properties) { override fun finishUsingItem(stack: ItemStack, level: Level, entity: LivingEntity): ItemStack { - if (entity is Player) { - entity.addEffect(MobEffectInstance(MobEffects.POISON, 80, 0)) + if (entity is ServerPlayer) { + entity.addEffect(MobEffectInstance(MobEffects.POISON, 80, 2)) } + return super.finishUsingItem(stack, level, entity) } } - -val IMPERFECT_BREAD_FOOD: FoodProperties = FoodProperties.Builder() - .nutrition(5) - .saturationModifier(0.6f) - .build() - diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt index cbd83e673..5857a511e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MItems.kt @@ -26,18 +26,12 @@ import net.minecraft.world.item.Tiers import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.level.block.Block import net.neoforged.bus.api.IEventBus -import net.neoforged.neoforge.common.DeferredSpawnEggItem import net.neoforged.neoforge.common.SimpleTier -import ru.dbotthepony.mc.otm.block.MatteryBlock -import ru.dbotthepony.mc.otm.block.addSimpleDescription -import ru.dbotthepony.mc.otm.block.tech.FlywheelBatteryBlock import ru.dbotthepony.mc.otm.capability.ITieredUpgradeSet import ru.dbotthepony.mc.otm.capability.MatteryPlayer import ru.dbotthepony.mc.otm.capability.UpgradeType import ru.dbotthepony.mc.otm.config.CablesConfig import ru.dbotthepony.mc.otm.config.ItemsConfig -import ru.dbotthepony.mc.otm.core.addAll -import ru.dbotthepony.mc.otm.core.asSupplierArray import ru.dbotthepony.mc.otm.core.collect.SupplierList import ru.dbotthepony.mc.otm.core.collect.SupplierMap import ru.dbotthepony.mc.otm.core.math.Decimal @@ -429,7 +423,7 @@ object MItems { val PILL_HEAL: Item by registry.register(MNames.PILL_HEAL) { HealPillItem() } val PILL_NOT_NORMAL: Item by registry.register(MNames.PILL_NOT_NORMAL) { NotNormalPill() } - val IMPERFECT_BREAD: Item by registry.register(MNames.IMPERFECT_BREAD) { ImperfectBread(Item.Properties().food(IMPERFECT_BREAD_FOOD)) } + val IMPERFECT_BREAD: Item by registry.register(MNames.IMPERFECT_BREAD) { ImperfectBreadItem(Item.Properties().food(FoodProperties.Builder().nutrition(5).saturationModifier(0.6f).build())) } val PILLS = SupplierList( MItems::PILL_ANDROID,