Update bread item

This commit is contained in:
DBotThePony 2025-03-09 18:35:55 +07:00
parent f1c87ed5ad
commit 3f677ad353
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 6 additions and 16 deletions

View File

@ -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()

View File

@ -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,