From e1decb67ec558fc823556d8e7176e8e5a764c7e3 Mon Sep 17 00:00:00 2001 From: GearShocky <gearshockmirasu@gmail.com> Date: Sat, 1 Mar 2025 19:16:18 +0500 Subject: [PATCH] Imperfect bread --- .../mc/otm/datagen/blocks/BlockStates.kt | 2 ++ .../mc/otm/datagen/items/ItemModels.kt | 1 + .../mc/otm/datagen/lang/English.kt | 2 ++ .../mc/otm/datagen/lang/Russian.kt | 2 ++ .../mc/otm/item/consumables/ImperfectBread.kt | 25 +++++++++++++++++++ .../ru/dbotthepony/mc/otm/registry/MNames.kt | 2 ++ .../mc/otm/registry/game/MCreativeTabs.kt | 1 + .../mc/otm/registry/game/MItems.kt | 8 +++--- 8 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBread.kt diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt index 597b94ab4..fd3419f6b 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt @@ -32,6 +32,8 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { provider.ore(MBlocks.TRITANIUM_RAW_BLOCK) provider.block(MBlocks.TRITANIUM_INGOT_BLOCK) + provider.block(MBlocks.WITHERED_STEEL_BLOCK) + provider.ore(MBlocks.DILITHIUM_ORE) provider.ore(MBlocks.DEEPSLATE_DILITHIUM_ORE) provider.block(MBlocks.DILITHIUM_CRYSTAL_BLOCK) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt index 452c25f6c..64d8e374c 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt @@ -68,6 +68,7 @@ fun addItemModels(provider: MatteryItemModelProvider) { provider.generated(MItems.PILL_HEAL) provider.generated(MItems.PILL_NOT_NORMAL) provider.generated(MItems.NUTRIENT_PASTE) + provider.generated(MItems.IMPERFECT_BREAD) provider.generated(MItems.REDSTONE_INTERACTOR) provider.generated(MItems.ESSENCE_DRIVE) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt index ee8818b27..e9fef487e 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt @@ -612,6 +612,7 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.HOLO_SIGN, "desc", "Multi-line, colored and glowing, text sign") add(MBlocks.TRITANIUM_INGOT_BLOCK, "Tritanium Plating Block") + add(MBlocks.WITHERED_STEEL_BLOCK, "Withered Steel Block") addBlock(MBlocks.ENERGY_COUNTER.values, "Energy Counter") addBlock(MBlocks.ENERGY_COUNTER.values, "desc", "Restricts energy flow direction;") @@ -741,6 +742,7 @@ private fun items(provider: MatteryLanguageProvider) { add(MItems.ESSENCE_SERVO, "desc2", "Can be used as a tool to pump essence manually") add(MItems.NUTRIENT_PASTE, "Nutrient Paste") + add(MItems.IMPERFECT_BREAD, "Imperfect Bread") add(MItems.FLUID_CAPSULE, "Fluid Capsule") add(MItems.FLUID_CAPSULE, "named", "Fluid Capsule (%s)") diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/Russian.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/Russian.kt index 229c311d1..08b3e8289 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/Russian.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/Russian.kt @@ -616,6 +616,7 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.HOLO_SIGN, "desc", "Многострочная, крашеная и светящееся, табличка") add(MBlocks.TRITANIUM_INGOT_BLOCK, "Блок слитков тритана") + add(MBlocks.WITHERED_STEEL_BLOCK, "Блок иссушенной стали") addBlock(MBlocks.ENERGY_COUNTER.values, "Счётчик энергии") addBlock(MBlocks.ENERGY_COUNTER.values, "desc", "Ограничивает направление передачи энергии;") @@ -734,6 +735,7 @@ private fun items(provider: MatteryLanguageProvider) { add(MItems.ESSENCE_SERVO, "desc2", "Может использоваться как инструмент для ручной перекачки эссенции") add(MItems.NUTRIENT_PASTE, "Питательная паста") + add(MItems.IMPERFECT_BREAD, "Несовершенный хлеб") add(MItems.FLUID_CAPSULE, "Жидкостная капсула") add(MItems.FLUID_CAPSULE, "named", "Жидкостная капсула (%s)") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBread.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBread.kt new file mode 100644 index 000000000..d67ae84e9 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/consumables/ImperfectBread.kt @@ -0,0 +1,25 @@ +package ru.dbotthepony.mc.otm.item.consumables + +import net.minecraft.world.effect.MobEffectInstance +import net.minecraft.world.effect.MobEffects +import net.minecraft.world.level.Level +import net.minecraft.world.entity.LivingEntity +import net.minecraft.world.entity.player.Player +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) { + override fun finishUsingItem(stack: ItemStack, level: Level, entity: LivingEntity): ItemStack { + if (entity is Player) { + entity.addEffect(MobEffectInstance(MobEffects.POISON, 80, 0)) + } + 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/MNames.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt index 68fe63f41..22275788e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt @@ -130,6 +130,8 @@ object MNames { const val PILL_HEAL = "pill_heal" const val PILL_NOT_NORMAL = "pill_not_normal" + const val IMPERFECT_BREAD = "imperfect_bread" + const val BATTERY_CRUDE = "battery_crude" const val BATTERY_BASIC = "battery_basic" const val BATTERY_NORMAL = "battery_normal" diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MCreativeTabs.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MCreativeTabs.kt index 953e891ed..e4f0bfda6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MCreativeTabs.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/game/MCreativeTabs.kt @@ -282,6 +282,7 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) { base(MItems.CARGO_CRATE_MINECARTS) accept(MItems.NUTRIENT_PASTE) + accept(MItems.IMPERFECT_BREAD) // exo accept(MItems.EXOPACK_PROBE) 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 685e5c1d5..69520f486 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 @@ -43,16 +43,12 @@ import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.item.BatteryItem import ru.dbotthepony.mc.otm.item.ChestUpgraderItem import ru.dbotthepony.mc.otm.item.CrudeBatteryItem -import ru.dbotthepony.mc.otm.item.consumables.EssenceCapsuleItem import ru.dbotthepony.mc.otm.item.EssenceServoItem import ru.dbotthepony.mc.otm.item.FluidCapsuleItem import ru.dbotthepony.mc.otm.item.block.FluidTankItem import ru.dbotthepony.mc.otm.item.GravitationalDisruptorItem -import ru.dbotthepony.mc.otm.item.consumables.HealPillItem import ru.dbotthepony.mc.otm.item.MatteryItem import ru.dbotthepony.mc.otm.item.MinecartCargoCrateItem -import ru.dbotthepony.mc.otm.item.consumables.PillItem -import ru.dbotthepony.mc.otm.item.consumables.PillType import ru.dbotthepony.mc.otm.item.PortableCondensationDriveItem import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem import ru.dbotthepony.mc.otm.item.QuantumBatteryItem @@ -62,7 +58,7 @@ import ru.dbotthepony.mc.otm.item.addSimpleDescription import ru.dbotthepony.mc.otm.item.armor.PortableGravitationStabilizerItem import ru.dbotthepony.mc.otm.item.armor.TritaniumArmorItem import ru.dbotthepony.mc.otm.item.block.EnergyCableItem -import ru.dbotthepony.mc.otm.item.consumables.NotNormalPill +import ru.dbotthepony.mc.otm.item.consumables.* import ru.dbotthepony.mc.otm.item.exopack.ExopackProbeItem import ru.dbotthepony.mc.otm.item.exopack.ExopackSlotUpgradeItem import ru.dbotthepony.mc.otm.item.exopack.ExopackUpgradeItem @@ -429,6 +425,8 @@ 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 PILLS = SupplierList( MItems::PILL_ANDROID, MItems::PILL_HUMANE,