From 0c004aedc5760c0946e188bd24ba9529574f8b95 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 4 Jan 2024 01:06:55 +0700 Subject: [PATCH] Some unifications regarding item tooltips --- .../mc/otm/datagen/lang/English.kt | 18 +-- .../mc/otm/datagen/lang/Russian.kt | 2 + .../dbotthepony/mc/otm/block/MatteryBlock.kt | 23 +++- .../mc/otm/block/decorative/DevChestBlock.kt | 5 + .../mc/otm/block/decorative/EngineBlock.kt | 12 +- .../block/decorative/TritaniumDoorBlock.kt | 51 +++++++ .../decorative/TritaniumTrapdoorBlock.kt | 50 +++++++ .../block/matter/MatterReconstructorBlock.kt | 5 + .../mc/otm/block/storage/DriveRackBlock.kt | 14 +- .../mc/otm/block/storage/DriveViewerBlock.kt | 14 +- .../mc/otm/block/storage/ItemMonitorBlock.kt | 14 +- .../mc/otm/block/storage/StorageBusBlock.kt | 15 +-- .../mc/otm/block/storage/StorageInterfaces.kt | 29 ++-- .../storage/StoragePowerSupplierBlock.kt | 14 +- .../mc/otm/block/tech/AndroidChargerBlock.kt | 10 +- .../mc/otm/block/tech/AndroidStationBlock.kt | 14 +- .../otm/block/tech/ChemicalGeneratorBlock.kt | 18 +-- .../mc/otm/block/tech/CobblerBlock.kt | 5 + .../mc/otm/block/tech/EnergyServoBlock.kt | 5 + .../mc/otm/block/tech/EssenceStorageBlock.kt | 5 + .../block/tech/GravitationStabilizerBlock.kt | 10 ++ .../otm/block/tech/PhantomAttractorBlock.kt | 7 + .../mc/otm/block/tech/PlatePressBlock.kt | 13 +- .../dbotthepony/mc/otm/core/ITooltippable.kt | 100 ++++++++++++++ .../mc/otm/item/ChestUpgraderItem.kt | 13 +- .../mc/otm/item/EssenceCapsuleItem.kt | 20 +-- .../mc/otm/item/EssenceServoItem.kt | 9 +- .../ru/dbotthepony/mc/otm/item/MatteryItem.kt | 28 ++++ .../ru/dbotthepony/mc/otm/registry/MBlocks.kt | 103 ++------------- .../ru/dbotthepony/mc/otm/registry/MItems.kt | 124 ++---------------- 30 files changed, 421 insertions(+), 329 deletions(-) create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumDoorBlock.kt create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumTrapdoorBlock.kt create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt create mode 100644 src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt 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 1c6ed54ab..fb1c20267 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 @@ -119,6 +119,8 @@ private fun sounds(provider: MatteryLanguageProvider) { private fun misc(provider: MatteryLanguageProvider) { with(provider.english) { + gui("shift_for_more_info", "") + gui("help.slot_filters", "Hold CTRL to setup slot filters") gui("help.slot_charging", "Hold ALT to switch slot charging") @@ -614,19 +616,19 @@ private fun items(provider: MatteryLanguageProvider) { add(MItems.ELECTROMOTOR, "Electromotor") add(MItems.MIRROR_COMPOUND, "Mirror Compound") add(MItems.MIRROR, "Mirror") - add(MItems.MIRROR, "description", "I can clearly see my own reflection in this mirror") + add(MItems.MIRROR, "desc", "I can clearly see my own reflection in this mirror") add(MItems.REINFORCED_TRITANIUM_PLATE, "Reinforced Tritanium Plate") - add(MItems.REINFORCED_TRITANIUM_PLATE, "description", "An armor plate, reinforced to withstand great kinetic forces") + add(MItems.REINFORCED_TRITANIUM_PLATE, "desc", "An armor plate, reinforced to withstand great kinetic forces") add(MItems.CARBON_MESH, "Carbon Mesh") add(MItems.GRAVITATIONAL_DISRUPTOR, "Spacetime Equalizer") - add(MItems.GRAVITATIONAL_DISRUPTOR, "description", "Once within close proximity of massive spacetime dilation anomaly, equalizes spacetime in it's radius") - add(MItems.GRAVITATIONAL_DISRUPTOR, "description2", "Allows collapse of singularities") - add(MItems.GRAVITATIONAL_DISRUPTOR, "description3", "Doesn't destroy any of mass singularity had acquired, which result in violent explosion of matter!") - add(MItems.GRAVITATIONAL_DISRUPTOR, "description4", "The explosion %s be contained by %s. Do not even attempt to contain it.") - add(MItems.GRAVITATIONAL_DISRUPTOR, "description4_clarification", "can not") - add(MItems.GRAVITATIONAL_DISRUPTOR, "description4_clarification2", "anything") + add(MItems.GRAVITATIONAL_DISRUPTOR, "desc", "Once within close proximity of massive spacetime dilation anomaly, equalizes spacetime in it's radius") + add(MItems.GRAVITATIONAL_DISRUPTOR, "desc2", "Allows collapse of singularities") + add(MItems.GRAVITATIONAL_DISRUPTOR, "desc3", "Doesn't destroy any of mass singularity had acquired, which result in violent explosion of matter!") + add(MItems.GRAVITATIONAL_DISRUPTOR, "desc4", "The explosion %s be contained by %s. Do not even attempt to contain it.") + add(MItems.GRAVITATIONAL_DISRUPTOR, "desc4_clarification", "can not") + add(MItems.GRAVITATIONAL_DISRUPTOR, "desc4_clarification2", "anything") add(MItems.MATTER_DUST, "Matter Dust") add(MItems.MATTER_DUST, "desc", "This item is product of failed decomposition or replication attempt") 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 db989cc4b..f24fe6dc1 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 @@ -127,6 +127,8 @@ private fun sounds(provider: MatteryLanguageProvider) { private fun misc(provider: MatteryLanguageProvider) { with(provider.russian) { + gui("shift_for_more_info", "<Удерживайте SHIFT для подробностей>") + gui("help.slot_filters", "Удерживайте CTRL для настройки фильтрации слотов") gui("help.slot_charging", "Удерживайте ALT для переключения зарядки слотов") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt index f6d4459d7..b1174f853 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt @@ -3,6 +3,8 @@ package ru.dbotthepony.mc.otm.block import com.google.common.collect.ImmutableMap import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap import it.unimi.dsi.fastutil.objects.Object2ObjectFunction +import it.unimi.dsi.fastutil.objects.ObjectIterators +import net.minecraft.ChatFormatting import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.core.particles.DustParticleOptions @@ -15,6 +17,8 @@ import net.minecraft.world.MenuProvider import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.player.Player import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.TooltipFlag +import net.minecraft.world.level.BlockGetter import net.minecraft.world.level.Level import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.EntityBlock @@ -28,13 +32,22 @@ import ru.dbotthepony.mc.otm.block.entity.IRedstoneControlled import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity import ru.dbotthepony.mc.otm.block.entity.WorkerState +import ru.dbotthepony.mc.otm.client.isShiftDown +import ru.dbotthepony.mc.otm.client.minecraft +import ru.dbotthepony.mc.otm.core.ITooltippable +import ru.dbotthepony.mc.otm.core.TranslatableComponent +import ru.dbotthepony.mc.otm.core.addAll +import ru.dbotthepony.mc.otm.core.addDescriptionFunctions +import ru.dbotthepony.mc.otm.core.addDescriptionLines import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.component1 import ru.dbotthepony.mc.otm.core.math.component2 import ru.dbotthepony.mc.otm.core.math.component3 +import ru.dbotthepony.mc.otm.core.stream import ru.dbotthepony.mc.otm.core.tagNotNull import ru.dbotthepony.mc.otm.once +import java.util.stream.Stream fun Block.getShapeForEachState(properties: List>, fn: (BlockState) -> VoxelShape): Map { val builder = ImmutableMap.Builder() @@ -71,7 +84,7 @@ fun interface INeighbourChangeListener { ) } -abstract class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(properties), INeighbourChangeListener { +open class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block(properties), INeighbourChangeListener, ITooltippable by ITooltippable.Impl() { override fun setPlacedBy( level: Level, blockPos: BlockPos, @@ -238,9 +251,17 @@ abstract class MatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : Block } } + override fun appendHoverText(itemStack: ItemStack, blockAccessor: BlockGetter?, components: MutableList, tooltipType: TooltipFlag) { + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + assembleDescription(itemStack, components) + } + companion object { val DEFAULT_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f) val DEFAULT_MACHINE_PROPERTIES: Properties = Properties.of().mapColor(MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f) } } +fun T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T { + return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/DevChestBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/DevChestBlock.kt index 3e6c21913..1270389db 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/DevChestBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/DevChestBlock.kt @@ -6,10 +6,15 @@ import net.minecraft.world.level.block.entity.BlockEntity import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.material.PushReaction import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock +import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.entity.decorative.DevChestBlockEntity class DevChestBlock : RotatableMatteryBlock(Properties.of().destroyTime(-1f).explosionResistance(360000f).pushReaction(PushReaction.BLOCK)), EntityBlock { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { return DevChestBlockEntity(p_153215_, p_153216_) } + + init { + addSimpleDescription() + } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt index 3ff655cdc..8b2043ef4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt @@ -20,13 +20,13 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLOR_ORANGE).sound(SoundType.METAL).explosionResistance(14f).destroyTime(2.5f).requiresCorrectToolForDrops().pushReaction(PushReaction.NORMAL)) { override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - p_49818_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY)) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + components.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY)) } override fun rotationFreedom(): BlockRotationFreedom { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumDoorBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumDoorBlock.kt new file mode 100644 index 000000000..943606243 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumDoorBlock.kt @@ -0,0 +1,51 @@ +package ru.dbotthepony.mc.otm.block.decorative + +import net.minecraft.ChatFormatting +import net.minecraft.core.BlockPos +import net.minecraft.network.chat.Component +import net.minecraft.world.entity.Entity +import net.minecraft.world.entity.monster.Zombie +import net.minecraft.world.item.DyeColor +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.TooltipFlag +import net.minecraft.world.level.BlockGetter +import net.minecraft.world.level.block.DoorBlock +import net.minecraft.world.level.block.state.BlockState +import net.minecraft.world.level.block.state.properties.BlockSetType +import net.minecraft.world.level.material.PushReaction +import ru.dbotthepony.mc.otm.core.TranslatableComponent + +class TritaniumDoorBlock(val color: DyeColor?) : DoorBlock( + Properties.of() + .mapColor(color ?: DyeColor.LIGHT_BLUE) + .explosionResistance(80f) + .noOcclusion() + .destroyTime(3f) + .pushReaction(PushReaction.DESTROY) + .requiresCorrectToolForDrops(), + BlockSetType.IRON +) { + override fun appendHoverText( + p_49816_: ItemStack, + p_49817_: BlockGetter?, + p_49818_: MutableList, + p_49819_: TooltipFlag + ) { + super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + p_49818_.add(TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY)) + p_49818_.add(TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY)) + + if (color != null) { + p_49818_.add(TranslatableComponent("$descriptionId.description2").withStyle(ChatFormatting.DARK_GRAY)) + } + } + + override fun canEntityDestroy( + state: BlockState, + level: BlockGetter, + pos: BlockPos, + entity: Entity + ): Boolean { + return entity !is Zombie && super.canEntityDestroy(state, level, pos, entity) + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumTrapdoorBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumTrapdoorBlock.kt new file mode 100644 index 000000000..3a1c0de0e --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/TritaniumTrapdoorBlock.kt @@ -0,0 +1,50 @@ +package ru.dbotthepony.mc.otm.block.decorative + +import net.minecraft.ChatFormatting +import net.minecraft.core.BlockPos +import net.minecraft.network.chat.Component +import net.minecraft.world.entity.Entity +import net.minecraft.world.entity.EntityType +import net.minecraft.world.entity.monster.Zombie +import net.minecraft.world.item.DyeColor +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.TooltipFlag +import net.minecraft.world.level.BlockGetter +import net.minecraft.world.level.block.TrapDoorBlock +import net.minecraft.world.level.block.state.BlockState +import net.minecraft.world.level.block.state.properties.BlockSetType +import ru.dbotthepony.mc.otm.core.TranslatableComponent + +class TritaniumTrapdoorBlock(val color: DyeColor?) : TrapDoorBlock( + Properties.of() + .mapColor(color ?: DyeColor.LIGHT_BLUE) + .explosionResistance(80f) + .noOcclusion().destroyTime(3f) + .requiresCorrectToolForDrops() + .isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false }, + BlockSetType.IRON +) { + override fun appendHoverText( + p_49816_: ItemStack, + p_49817_: BlockGetter?, + p_49818_: MutableList, + p_49819_: TooltipFlag + ) { + super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + p_49818_.add(TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY)) + p_49818_.add(TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY)) + + if (color != null) { + p_49818_.add(TranslatableComponent("$descriptionId.description2").withStyle(ChatFormatting.DARK_GRAY)) + } + } + + override fun canEntityDestroy( + state: BlockState, + level: BlockGetter, + pos: BlockPos, + entity: Entity + ): Boolean { + return entity !is Zombie && super.canEntityDestroy(state, level, pos, entity) + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterReconstructorBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterReconstructorBlock.kt index 3452c1ff2..56b036df7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterReconstructorBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterReconstructorBlock.kt @@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock +import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.entity.matter.MatterReconstructorBlockEntity import ru.dbotthepony.mc.otm.block.getShapeForEachState import ru.dbotthepony.mc.otm.core.get @@ -28,6 +29,10 @@ class MatterReconstructorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIE return BlockEntityTicker { _, _, _, pBlockEntity -> if (pBlockEntity is MatterReconstructorBlockEntity) pBlockEntity.tick() } } + init { + addSimpleDescription() + } + private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.MATTER_RECONSTRUCTOR.rotateFromNorth(it[rotationProperty]).computeShape() } @Suppress("override_deprecation") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveRackBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveRackBlock.kt index 8f4ecc071..0d648cd60 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveRackBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveRackBlock.kt @@ -39,14 +39,14 @@ class DriveRackBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Entity } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.DRIVE_RACK.rotateFromNorth(it[rotationProperty]).computeShape() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveViewerBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveViewerBlock.kt index 03a0bb47c..f0c35ec79 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveViewerBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/DriveViewerBlock.kt @@ -50,14 +50,14 @@ class DriveViewerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } override fun getStateForPlacement(context: BlockPlaceContext): BlockState { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/ItemMonitorBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/ItemMonitorBlock.kt index 32dd33264..8944f7265 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/ItemMonitorBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/ItemMonitorBlock.kt @@ -39,14 +39,14 @@ class ItemMonitorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ITEM_MONITOR.rotateFromNorth(it[rotationProperty]).computeShape() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt index 568ec92e9..1f5f3f58e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt @@ -20,7 +20,6 @@ import net.minecraft.world.phys.shapes.Shapes import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.CableBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock -import ru.dbotthepony.mc.otm.block.StorageCableBlock import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.block.entity.storage.StorageBusBlockEntity import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage @@ -55,14 +54,14 @@ class StorageBusBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Entit } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } override fun createBlockStateDefinition(builder: StateDefinition.Builder) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt index aaef6b7f4..243af2941 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt @@ -20,7 +20,6 @@ import net.minecraft.world.phys.shapes.Shapes import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.CableBlock import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock -import ru.dbotthepony.mc.otm.block.StorageCableBlock import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity import ru.dbotthepony.mc.otm.block.entity.storage.StorageExporterBlockEntity import ru.dbotthepony.mc.otm.block.entity.storage.StorageImporterBlockEntity @@ -80,14 +79,14 @@ class StorageImporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } private val shapes = getShapeForEachState { @@ -138,14 +137,14 @@ class StorageExporterBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } override fun getTicker( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StoragePowerSupplierBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StoragePowerSupplierBlock.kt index 0f756e32e..18562a541 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StoragePowerSupplierBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StoragePowerSupplierBlock.kt @@ -39,14 +39,14 @@ class StoragePowerSupplierBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTI } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.STORAGE_POWER_SUPPLIER.rotateFromNorth(it[rotationProperty]).computeShape() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidChargerBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidChargerBlock.kt index 5b3afa5ef..432923221 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidChargerBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidChargerBlock.kt @@ -139,12 +139,12 @@ class AndroidChargerBlock : RotatableMatteryBlock(Properties.of().destroyTime(2. } } - override fun appendHoverText(p_49816_: ItemStack, p_49817_: BlockGetter?, p_49818_: MutableList, p_49819_: TooltipFlag) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + override fun appendHoverText(itemStack: ItemStack, blockAccessor: BlockGetter?, components: MutableList, tooltipType: TooltipFlag) { + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) - p_49818_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY)) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + components.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY)) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } private val shapes = getShapeForEachState(listOf(rotationProperty, PART)) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt index 962af67b5..fcc2b1996 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/AndroidStationBlock.kt @@ -52,14 +52,14 @@ class AndroidStationBlock : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBloc } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - WorkerEnergyStorage.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryPoweredBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + WorkerEnergyStorage.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryPoweredBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } override fun getShape( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/ChemicalGeneratorBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/ChemicalGeneratorBlock.kt index 3ba037ad4..48e4ca6ee 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/ChemicalGeneratorBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/ChemicalGeneratorBlock.kt @@ -1,10 +1,7 @@ package ru.dbotthepony.mc.otm.block.tech -import net.minecraft.ChatFormatting import net.minecraft.core.BlockPos -import net.minecraft.nbt.CompoundTag import net.minecraft.network.chat.Component -import net.minecraft.world.item.BlockItem import net.minecraft.world.item.ItemStack import net.minecraft.world.item.TooltipFlag import net.minecraft.world.level.BlockGetter @@ -19,18 +16,11 @@ import net.minecraft.world.level.block.state.StateDefinition import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock -import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.block.entity.tech.ChemicalGeneratorBlockEntity -import ru.dbotthepony.mc.otm.block.entity.MatteryDeviceBlockEntity import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.block.getShapeForEachState import ru.dbotthepony.mc.otm.capability.energy.GeneratorEnergyStorage -import ru.dbotthepony.mc.otm.capability.energy.ItemEnergyStorageImpl -import ru.dbotthepony.mc.otm.container.MatteryContainer -import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.get -import ru.dbotthepony.mc.otm.core.nbt.map -import ru.dbotthepony.mc.otm.oncePre import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.shapes.BlockShapes @@ -57,12 +47,12 @@ class ChemicalGeneratorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES) override fun appendHoverText( itemStack: ItemStack, - p_49817_: BlockGetter?, + blockAccessor: BlockGetter?, tooltips: MutableList, - p_49819_: TooltipFlag + tooltipType: TooltipFlag ) { - super.appendHoverText(itemStack, p_49817_, tooltips, p_49819_) - GeneratorEnergyStorage.appendHoverText(itemStack, p_49817_, tooltips, p_49819_) + super.appendHoverText(itemStack, blockAccessor, tooltips, tooltipType) + GeneratorEnergyStorage.appendHoverText(itemStack, blockAccessor, tooltips, tooltipType) } private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.CHEMICAL_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/CobblerBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/CobblerBlock.kt index 41b222bee..112bf0bc0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/CobblerBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/CobblerBlock.kt @@ -17,6 +17,7 @@ import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.getShapeForEachState import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity import ru.dbotthepony.mc.otm.core.get +import ru.dbotthepony.mc.otm.core.needsNoPowerDescription import ru.dbotthepony.mc.otm.shapes.BlockShapes class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of().mapColor(color?.mapColor ?: MapColor.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().destroyTime(1.5f).explosionResistance(25.0f)), EntityBlock { @@ -36,6 +37,10 @@ class CobblerBlock(val color: DyeColor?) : RotatableMatteryBlock(Properties.of() return null } + init { + needsNoPowerDescription() + } + private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.COBBLESTONE_GENERATOR.rotateFromNorth(it[rotationProperty]).computeShape() } @Suppress("override_deprecation") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EnergyServoBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EnergyServoBlock.kt index 4dff8b68c..e95a95765 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EnergyServoBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EnergyServoBlock.kt @@ -13,6 +13,7 @@ import net.minecraft.world.level.material.MapColor import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock +import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.entity.tech.EnergyServoBlockEntity import ru.dbotthepony.mc.otm.block.getShapeForEachState import ru.dbotthepony.mc.otm.core.get @@ -36,6 +37,10 @@ class EnergyServoBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti return null } + init { + addSimpleDescription() + } + private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ENERGY_SERVO.rotateFromNorth(it[rotationProperty]).computeShape() } @Suppress("override_deprecation") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt index 84339f5a0..e57d06360 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt @@ -18,6 +18,7 @@ import net.minecraft.world.phys.BlockHitResult import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock +import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity import ru.dbotthepony.mc.otm.block.getShapeForEachState import ru.dbotthepony.mc.otm.core.get @@ -46,6 +47,10 @@ class EssenceStorageBlock(val color: DyeColor?) : RotatableMatteryBlock(Properti return super.use(blockState, level, blockPos, ply, hand, blockHitResult) } + init { + addSimpleDescription() + } + private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ESSENCE_STORAGE.rotateFromNorth(it[rotationProperty]).computeShape() } @Suppress("override_deprecation") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt index e2f33127e..0367b5564 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt @@ -1,5 +1,6 @@ package ru.dbotthepony.mc.otm.block.tech +import net.minecraft.ChatFormatting import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.core.SectionPos @@ -23,6 +24,7 @@ import net.minecraft.world.level.material.PushReaction import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock +import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity import ru.dbotthepony.mc.otm.block.entity.WorkerState @@ -30,6 +32,7 @@ import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.plus import ru.dbotthepony.mc.otm.core.math.times +import ru.dbotthepony.mc.otm.core.needsNoPowerDescription import ru.dbotthepony.mc.otm.oncePre import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlocks @@ -140,6 +143,13 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock { return SHAPES[p_60555_[BlockRotationFreedom.DIRECTIONAL].ordinal] } + init { + addSimpleDescription() + needsNoPowerDescription(ChatFormatting.DARK_GRAY) + addSimpleDescription("2", ChatFormatting.DARK_GRAY) + addSimpleDescription("3", ChatFormatting.DARK_GRAY) + } + companion object { private val SHAPES = arrayOf( BlockShapes.GRAVITATION_STABILIZER.rotateAroundX(PI / 2).computeShape(), diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PhantomAttractorBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PhantomAttractorBlock.kt index ef92bc7f5..54f6b1bc1 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PhantomAttractorBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PhantomAttractorBlock.kt @@ -27,10 +27,12 @@ import net.minecraft.world.phys.shapes.CollisionContext import net.minecraft.world.phys.shapes.VoxelShape import net.minecraftforge.event.ForgeEventFactory import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock +import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.getShapeForEachState import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.math.minus import ru.dbotthepony.mc.otm.core.math.plus +import ru.dbotthepony.mc.otm.core.needsNoPowerDescription import ru.dbotthepony.mc.otm.once import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.shapes.BlockShapes @@ -134,4 +136,9 @@ class PhantomAttractorBlock : RotatableMatteryBlock(Properties.of().mapColor(Map } } } + + init { + addSimpleDescription() + needsNoPowerDescription() + } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PlatePressBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PlatePressBlock.kt index aee0f1e58..8bafde210 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PlatePressBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/PlatePressBlock.kt @@ -22,7 +22,6 @@ import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity import ru.dbotthepony.mc.otm.block.entity.tech.PlatePressBlockEntity import ru.dbotthepony.mc.otm.block.entity.WorkerState -import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity import ru.dbotthepony.mc.otm.block.getShapeForEachState import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.shapes.BlockShapes @@ -49,13 +48,13 @@ class PlatePressBlock(val color: DyeColor?, val isTwin: Boolean = false) : Rotat } override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag + itemStack: ItemStack, + blockAccessor: BlockGetter?, + components: MutableList, + tooltipType: TooltipFlag ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - MatteryWorkerBlockEntity.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) + super.appendHoverText(itemStack, blockAccessor, components, tooltipType) + MatteryWorkerBlockEntity.appendHoverText(itemStack, blockAccessor, components, tooltipType) } private val shapes = getShapeForEachState(rotationProperty) { (if (isTwin) BlockShapes.TWIN_PLATE_PRESS_IDLE else BlockShapes.PLATE_PRESS_IDLE).rotateFromNorth(it[rotationProperty]).computeShape() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt new file mode 100644 index 000000000..94234f21a --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt @@ -0,0 +1,100 @@ +package ru.dbotthepony.mc.otm.core + +import it.unimi.dsi.fastutil.objects.ObjectIterators +import net.minecraft.ChatFormatting +import net.minecraft.network.chat.Component +import net.minecraft.world.item.ItemStack +import ru.dbotthepony.mc.otm.client.isShiftDown +import ru.dbotthepony.mc.otm.client.minecraft +import java.util.stream.Stream + +interface ITooltippable { + fun addDescriptionLinesInternal(lines: Stream) { + addDescriptionFunctionsInternal(lines.map { c -> { ObjectIterators.singleton(c.copy()) } }) + } + + fun addDescriptionLinesInternal(vararg lines: Component) { + lines.forEach { c -> + addDescriptionFunctionsInternal({ ObjectIterators.singleton(c.copy()) }) + } + } + + fun addDescriptionLinesInternal(lines: Collection) { + lines.forEach { c -> + addDescriptionFunctionsInternal({ ObjectIterators.singleton(c.copy()) }) + } + } + + fun addDescriptionFunctionsInternal(lines: Stream Iterator>) + fun addDescriptionFunctionsInternal(vararg lines: (ItemStack) -> Iterator) + fun addDescriptionFunctionsInternal(lines: Collection<(ItemStack) -> Iterator>) + + fun assembleDescription(itemStack: ItemStack, into: MutableCollection) + + class Impl : ITooltippable { + private val descriptionLines = ArrayList<(ItemStack) -> Iterator>() + + override fun addDescriptionFunctionsInternal(lines: Stream Iterator>) { + lines.forEach { descriptionLines.add(it) } + } + + override fun addDescriptionFunctionsInternal(vararg lines: (ItemStack) -> Iterator) { + lines.forEach { descriptionLines.add(it) } + } + + override fun addDescriptionFunctionsInternal(lines: Collection<(ItemStack) -> Iterator>) { + lines.forEach { descriptionLines.add(it) } + } + + override fun assembleDescription(itemStack: ItemStack, into: MutableCollection) { + if (descriptionLines.isNotEmpty()) { + if (!minecraft.window.isShiftDown) { + into.add(TranslatableComponent("otm.gui.shift_for_more_info").withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.ITALIC)) + } else { + for (lines in descriptionLines) { + into.addAll(lines.invoke(itemStack)) + } + } + } + } + } +} + +fun T.addDescriptionLines(lines: Stream): T { + addDescriptionLinesInternal(lines) + return this +} + +fun T.addDescriptionLines(vararg lines: Component): T { + addDescriptionLinesInternal(lines.stream()) + return this +} + +fun T.addDescriptionLines(lines: Collection): T { + addDescriptionLinesInternal(lines) + return this +} + +fun T.addDescriptionFunctions(lines: Stream Iterator>): T { + addDescriptionFunctionsInternal(lines) + return this +} + +fun T.addDescriptionFunctions(vararg lines: (ItemStack) -> Iterator): T { + addDescriptionFunctionsInternal(lines.stream()) + return this +} + +fun T.addDescriptionFunctions(line: (ItemStack) -> Iterator): T { + addDescriptionFunctionsInternal(line) + return this +} + +fun T.addDescriptionFunctions(lines: Collection<(ItemStack) -> Iterator>): T { + addDescriptionFunctionsInternal(lines) + return this +} + +fun T.needsNoPowerDescription(formatting: ChatFormatting = ChatFormatting.GRAY): T { + return addDescriptionLines(TranslatableComponent("otm.needs_no_power").withStyle(formatting)) +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/ChestUpgraderItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/ChestUpgraderItem.kt index 3df88999a..2a0af4fcf 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/ChestUpgraderItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/ChestUpgraderItem.kt @@ -31,7 +31,7 @@ import ru.dbotthepony.mc.otm.core.math.Vector import ru.dbotthepony.mc.otm.entity.MinecartCargoCrate import ru.dbotthepony.mc.otm.registry.MEntityTypes -class ChestUpgraderItem : Item(Properties().stacksTo(1)) { +class ChestUpgraderItem : MatteryItem(Properties().stacksTo(1)) { override fun onItemUseFirst(stack: ItemStack, context: UseOnContext): InteractionResult { val player = context.player ?: return super.onItemUseFirst(stack, context) @@ -105,17 +105,12 @@ class ChestUpgraderItem : Item(Properties().stacksTo(1)) { return super.onItemUseFirst(stack, context) } - override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltip: MutableList, pFlag: TooltipFlag) { - super.appendHoverText(pStack, pLevel, pTooltip, pFlag) - - pTooltip.add(DESCRIPTION) - pTooltip.add(DESCRIPTION2) + init { + addSimpleDescription() + addSimpleDescription("2") } companion object { - private val DESCRIPTION = TranslatableComponent("item.${MOD_ID}.chest_upgrader.desc").withStyle(ChatFormatting.DARK_GRAY) - private val DESCRIPTION2= TranslatableComponent("item.${MOD_ID}.chest_upgrader.desc2").withStyle(ChatFormatting.DARK_GRAY) - fun onEntityInteract(event: PlayerInteractEvent.EntityInteract) { if (event.target !is MinecartChest) return diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceCapsuleItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceCapsuleItem.kt index d7b6076db..377eca58f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceCapsuleItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceCapsuleItem.kt @@ -22,22 +22,22 @@ import ru.dbotthepony.mc.otm.core.tagNotNull import ru.dbotthepony.mc.otm.core.util.getLevelFromXp import ru.dbotthepony.mc.otm.runIfClient -class EssenceCapsuleItem(private val digital: Boolean) : Item(Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) { - override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltipComponents: MutableList, pIsAdvanced: TooltipFlag) { - super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced) - pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule").withStyle(ChatFormatting.DARK_GRAY)) - pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule2").withStyle(ChatFormatting.DARK_GRAY)) +class EssenceCapsuleItem(private val digital: Boolean) : MatteryItem(Properties().stacksTo(1).rarity(Rarity.UNCOMMON)) { + override fun appendHoverText(itemStack: ItemStack, level: Level?, components: MutableList, tooltipType: TooltipFlag) { + super.appendHoverText(itemStack, level, components, tooltipType) + components.add(TranslatableComponent("otm.gui.essence_capsule").withStyle(ChatFormatting.DARK_GRAY)) + components.add(TranslatableComponent("otm.gui.essence_capsule2").withStyle(ChatFormatting.DARK_GRAY)) if (!digital) { - pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule3").withStyle(ChatFormatting.DARK_GRAY)) - } else if (runIfClient(false) { minecraft.player?.matteryPlayer?.isAndroid ?: false }) { - pTooltipComponents.add(TranslatableComponent("otm.gui.essence_capsule.digital").withStyle(ChatFormatting.DARK_GRAY)) + components.add(TranslatableComponent("otm.gui.essence_capsule3").withStyle(ChatFormatting.DARK_GRAY)) + } else if (runIfClient(false) { minecraft.player?.matteryPlayer?.isAndroid == true }) { + components.add(TranslatableComponent("otm.gui.essence_capsule.digital").withStyle(ChatFormatting.DARK_GRAY)) } if (runIfClient(false) { minecraft.window.isShiftDown }) { - pTooltipComponents.add(TranslatableComponent("otm.gui.experience", experienceStored(pStack)).withStyle(ChatFormatting.GRAY)) + components.add(TranslatableComponent("otm.gui.experience", experienceStored(itemStack)).withStyle(ChatFormatting.GRAY)) } else { - pTooltipComponents.add(TranslatableComponent("otm.gui.experience_levels", getLevelFromXp(experienceStored(pStack))).withStyle(ChatFormatting.GRAY)) + components.add(TranslatableComponent("otm.gui.experience_levels", getLevelFromXp(experienceStored(itemStack))).withStyle(ChatFormatting.GRAY)) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceServoItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceServoItem.kt index 320bcfbcd..329216fa2 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceServoItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EssenceServoItem.kt @@ -14,11 +14,10 @@ import net.minecraft.world.level.Level import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity import ru.dbotthepony.mc.otm.core.TranslatableComponent -class EssenceServoItem : Item(Properties().stacksTo(64)) { - override fun appendHoverText(pStack: ItemStack, pLevel: Level?, pTooltipComponents: MutableList, pIsAdvanced: TooltipFlag) { - super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced) - pTooltipComponents.add(TranslatableComponent("$descriptionId.desc2").withStyle(ChatFormatting.GRAY)) - pTooltipComponents.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY)) +class EssenceServoItem : MatteryItem(Properties().stacksTo(64)) { + init { + addSimpleDescription("2") + addSimpleDescription(formatting = ChatFormatting.DARK_GRAY) } fun useServo(player: Player, pos: BlockPos): InteractionResult { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt new file mode 100644 index 000000000..85f0ea45d --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt @@ -0,0 +1,28 @@ +package ru.dbotthepony.mc.otm.item + +import it.unimi.dsi.fastutil.objects.ObjectIterators +import net.minecraft.ChatFormatting +import net.minecraft.network.chat.Component +import net.minecraft.world.item.Item +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.TooltipFlag +import net.minecraft.world.level.Level +import ru.dbotthepony.mc.otm.client.isShiftDown +import ru.dbotthepony.mc.otm.client.minecraft +import ru.dbotthepony.mc.otm.core.ITooltippable +import ru.dbotthepony.mc.otm.core.TranslatableComponent +import ru.dbotthepony.mc.otm.core.addAll +import ru.dbotthepony.mc.otm.core.addDescriptionFunctions +import ru.dbotthepony.mc.otm.core.addDescriptionLines +import java.util.stream.Stream + +open class MatteryItem(properties: Properties) : Item(properties), ITooltippable by ITooltippable.Impl() { + override fun appendHoverText(itemStack: ItemStack, level: Level?, components: MutableList, tooltipType: TooltipFlag) { + super.appendHoverText(itemStack, level, components, tooltipType) + assembleDescription(itemStack, components) + } +} + +fun T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T { + return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt index 9e560c112..46706719a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt @@ -39,7 +39,9 @@ import ru.dbotthepony.mc.otm.block.BlockExplosionDebugger import ru.dbotthepony.mc.otm.block.BlockSphereDebugger import ru.dbotthepony.mc.otm.block.EnergyCableBlock import ru.dbotthepony.mc.otm.block.MatterCableBlock +import ru.dbotthepony.mc.otm.block.MatteryBlock import ru.dbotthepony.mc.otm.block.StorageCableBlock +import ru.dbotthepony.mc.otm.block.addSimpleDescription import ru.dbotthepony.mc.otm.block.decorative.DevChestBlock import ru.dbotthepony.mc.otm.block.decorative.EngineBlock import ru.dbotthepony.mc.otm.block.decorative.FluidTankBlock @@ -48,6 +50,8 @@ import ru.dbotthepony.mc.otm.block.decorative.InfiniteWaterSourceBlock import ru.dbotthepony.mc.otm.block.decorative.LaboratoryLamp import ru.dbotthepony.mc.otm.block.decorative.LaboratoryLampLight import ru.dbotthepony.mc.otm.block.decorative.PainterBlock +import ru.dbotthepony.mc.otm.block.decorative.TritaniumDoorBlock +import ru.dbotthepony.mc.otm.block.decorative.TritaniumTrapdoorBlock import ru.dbotthepony.mc.otm.block.matter.MatterBottlerBlock import ru.dbotthepony.mc.otm.block.matter.MatterCapacitorBankBlock import ru.dbotthepony.mc.otm.block.matter.MatterDecomposerBlock @@ -159,18 +163,9 @@ object MBlocks { Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).sound(SoundType.METAL).explosionResistance(400f).destroyTime(3f).requiresCorrectToolForDrops()) } - val METAL_JUNK: Block by registry.register(MNames.METAL_JUNK) { - object : Block(BlockBehaviour.Properties.of().sound(SoundType.NETHERITE_BLOCK).mapColor(MapColor.COLOR_GRAY).explosionResistance(45f).destroyTime(3f).requiresCorrectToolForDrops()) { - override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag - ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - p_49818_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.DARK_GRAY)) - } - } + val METAL_JUNK: MatteryBlock by registry.register(MNames.METAL_JUNK) { + MatteryBlock(BlockBehaviour.Properties.of().sound(SoundType.NETHERITE_BLOCK).mapColor(MapColor.COLOR_GRAY).explosionResistance(45f).destroyTime(3f).requiresCorrectToolForDrops()) + .addSimpleDescription() } val METAL_MESH: Block by registry.register(MNames.METAL_MESH) { @@ -234,87 +229,11 @@ object MBlocks { TRITANIUM_ANVIL = SupplierList(anvils) } - val TRITANIUM_DOOR: Map = registry.coloredWithBase(MNames.TRITANIUM_DOOR) { color, _ -> - object : DoorBlock( - Properties.of() - .mapColor(color ?: DyeColor.LIGHT_BLUE) - .explosionResistance(80f) - .noOcclusion() - .destroyTime(3f) - .pushReaction(PushReaction.DESTROY) - .requiresCorrectToolForDrops(), - BlockSetType.IRON - ) { - override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag - ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - p_49818_.add(TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY)) - p_49818_.add(TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY)) + val TRITANIUM_DOOR: Map = registry.coloredWithBase(MNames.TRITANIUM_DOOR) { color, _ -> + TritaniumDoorBlock(color) } - if (color != null) { - p_49818_.add(TranslatableComponent("$descriptionId.description2").withStyle(ChatFormatting.DARK_GRAY)) - } - } - - override fun canEntityDestroy( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - entity: Entity - ): Boolean { - return entity !is Zombie && super.canEntityDestroy(state, level, pos, entity) - } - } - } - - val TRITANIUM_TRAPDOOR: Map = registry.coloredWithBase(MNames.TRITANIUM_TRAPDOOR) { color, _ -> - object : TrapDoorBlock( - Properties.of() - .mapColor(color ?: DyeColor.LIGHT_BLUE) - .explosionResistance(80f) - .noOcclusion().destroyTime(3f) - .requiresCorrectToolForDrops() - .isValidSpawn { _: BlockState, _: BlockGetter, _: BlockPos, _: EntityType<*>? -> false }, - BlockSetType.IRON - ) { - override fun appendHoverText( - p_49816_: ItemStack, - p_49817_: BlockGetter?, - p_49818_: MutableList, - p_49819_: TooltipFlag - ) { - super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_) - p_49818_.add(TranslatableComponent("$descriptionId.description0").withStyle(ChatFormatting.DARK_GRAY)) - p_49818_.add(TranslatableComponent("$descriptionId.description1").withStyle(ChatFormatting.DARK_GRAY)) - - if (color != null) { - p_49818_.add(TranslatableComponent("$descriptionId.description2").withStyle(ChatFormatting.DARK_GRAY)) - } - } - - override fun canEntityDestroy( - state: BlockState, - level: BlockGetter, - pos: BlockPos, - entity: Entity - ): Boolean { - return entity !is Zombie && super.canEntityDestroy(state, level, pos, entity) - } - } } - - init { - MRegistry.TRITANIUM_PRESSURE_PLATE.registerBlocks(registry) - - MRegistry.CARGO_CRATES.registerBlocks(registry) - MRegistry.TRITANIUM_BLOCK.registerBlocks(registry) - MRegistry.TRITANIUM_STAIRS.registerBlocks(registry) - MRegistry.TRITANIUM_SLAB.registerBlocks(registry) - MRegistry.TRITANIUM_WALL.registerBlocks(registry) - } + val TRITANIUM_TRAPDOOR: Map = registry.coloredWithBase(MNames.TRITANIUM_TRAPDOOR) { color, _ -> + TritaniumTrapdoorBlock(color) } val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block( BlockBehaviour.Properties.of() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt index b8328cf96..534054183 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -22,7 +22,6 @@ import ru.dbotthepony.mc.otm.config.ItemsConfig import ru.dbotthepony.mc.otm.core.collect.SupplierList import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.addAll -import ru.dbotthepony.mc.otm.core.asLambdaSupplierArray import ru.dbotthepony.mc.otm.core.asSupplierArray import ru.dbotthepony.mc.otm.core.collect.SupplierMap import ru.dbotthepony.mc.otm.core.math.Decimal @@ -90,78 +89,17 @@ object MItems { val STORAGE_CABLE: BlockItem by registry.register(MNames.STORAGE_CABLE) { BlockItem(MBlocks.STORAGE_CABLE, DEFAULT_PROPERTIES) } val STORAGE_POWER_SUPPLIER: BlockItem by registry.register(MNames.STORAGE_POWER_SUPPLIER) { BlockItem(MBlocks.STORAGE_POWER_SUPPLIER, DEFAULT_PROPERTIES) } - val GRAVITATION_STABILIZER: BlockItem by registry.register(MNames.GRAVITATION_STABILIZER) { - object : BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) { - override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList, p_40575_: TooltipFlag) { - super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) + val GRAVITATION_STABILIZER: BlockItem by registry.register(MNames.GRAVITATION_STABILIZER) { BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) } - p_40574_.add(TranslatableComponent("${MBlocks.GRAVITATION_STABILIZER.descriptionId}.desc").withStyle(ChatFormatting.GRAY)) - p_40574_.add(TranslatableComponent("otm.needs_no_power").withStyle(ChatFormatting.DARK_GRAY)) - p_40574_.add(TranslatableComponent("${MBlocks.GRAVITATION_STABILIZER.descriptionId}.desc2").withStyle(ChatFormatting.DARK_GRAY)) - p_40574_.add(TranslatableComponent("${MBlocks.GRAVITATION_STABILIZER.descriptionId}.desc3").withStyle(ChatFormatting.DARK_GRAY)) - } - } - } - - val PHANTOM_ATTRACTOR: DoubleHighBlockItem by registry.register(MNames.PHANTOM_ATTRACTOR) { - object : DoubleHighBlockItem(MBlocks.PHANTOM_ATTRACTOR, DEFAULT_PROPERTIES) { - override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList, p_40575_: TooltipFlag) { - super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) - - p_40574_.add(TranslatableComponent("${MBlocks.PHANTOM_ATTRACTOR.descriptionId}.desc").withStyle(ChatFormatting.GRAY)) - p_40574_.add(TranslatableComponent("otm.needs_no_power").withStyle(ChatFormatting.DARK_GRAY)) - } - } - } - - val ENERGY_SERVO: BlockItem by registry.register(MNames.ENERGY_SERVO) { - object : BlockItem(MBlocks.ENERGY_SERVO, DEFAULT_PROPERTIES) { - override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList, p_40575_: TooltipFlag) { - super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) - - p_40574_.add(TranslatableComponent("${MBlocks.ENERGY_SERVO.descriptionId}.desc").withStyle(ChatFormatting.GRAY)) - } - } - } - - val COBBLESTONE_GENERATOR: Map = registry.coloredWithBase(MNames.COBBLESTONE_GENERATOR) { color, name -> - object : BlockItem(MBlocks.COBBLESTONE_GENERATOR[color]!!, DEFAULT_PROPERTIES) { - override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList, p_40575_: TooltipFlag) { - super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) - p_40574_.add(TranslatableComponent("otm.needs_no_power").withStyle(ChatFormatting.GRAY)) - } - } - } + val PHANTOM_ATTRACTOR: DoubleHighBlockItem by registry.register(MNames.PHANTOM_ATTRACTOR) { DoubleHighBlockItem(MBlocks.PHANTOM_ATTRACTOR, DEFAULT_PROPERTIES) } + val ENERGY_SERVO: BlockItem by registry.register(MNames.ENERGY_SERVO) { BlockItem(MBlocks.ENERGY_SERVO, DEFAULT_PROPERTIES) } + val COBBLESTONE_GENERATOR: Map = registry.coloredWithBase(MNames.COBBLESTONE_GENERATOR) { color, _ -> BlockItem(MBlocks.COBBLESTONE_GENERATOR[color]!!, DEFAULT_PROPERTIES) } val INFINITE_WATER_SOURCE: BlockItem by registry.register(MNames.INFINITE_WATER_SOURCE) { BlockItem(MBlocks.INFINITE_WATER_SOURCE, DEFAULT_PROPERTIES) } + val ESSENCE_STORAGE: Map = registry.coloredWithBase(MNames.ESSENCE_STORAGE) { color, _ -> BlockItem(MBlocks.ESSENCE_STORAGE[color]!!, DEFAULT_PROPERTIES) } + val MATTER_RECONSTRUCTOR: BlockItem by registry.register(MNames.MATTER_RECONSTRUCTOR) { BlockItem(MBlocks.MATTER_RECONSTRUCTOR, DEFAULT_PROPERTIES) } - val ESSENCE_STORAGE: Map = registry.coloredWithBase(MNames.ESSENCE_STORAGE) { color, _ -> - object : BlockItem(MBlocks.ESSENCE_STORAGE[color]!!, DEFAULT_PROPERTIES) { - override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList, p_40575_: TooltipFlag) { - super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) - p_40574_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY)) - } - } - } - - val MATTER_RECONSTRUCTOR: BlockItem by registry.register(MNames.MATTER_RECONSTRUCTOR) { - object : BlockItem(MBlocks.MATTER_RECONSTRUCTOR, DEFAULT_PROPERTIES) { - override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList, p_40575_: TooltipFlag) { - super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) - p_40574_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY)) - } - } - } - - val DEV_CHEST: BlockItem by registry.register(MNames.DEV_CHEST) { - object : BlockItem(MBlocks.DEV_CHEST, DEFAULT_PROPERTIES) { - override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList, p_40575_: TooltipFlag) { - super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) - p_40574_.add(TranslatableComponent("$descriptionId.desc").withStyle(ChatFormatting.GRAY)) - } - } - } - + val DEV_CHEST: BlockItem by registry.register(MNames.DEV_CHEST) { BlockItem(MBlocks.DEV_CHEST, DEFAULT_PROPERTIES) } val PAINTER: BlockItem by registry.register(MNames.PAINTER) { BlockItem(MBlocks.PAINTER, DEFAULT_PROPERTIES) } val MATTER_ENTANGLER: BlockItem by registry.register(MNames.MATTER_ENTANGLER) { BlockItem(MBlocks.MATTER_ENTANGLER, DEFAULT_PROPERTIES) } @@ -408,19 +346,7 @@ object MItems { val PLASMA_RIFLE: Item by registry.register(MNames.PLASMA_RIFLE) { PlasmaRifleItem() } - val BLACK_HOLE_SCANNER: Item by registry.register(MNames.BLACK_HOLE_SCANNER) { - object : Item(DEFAULT_PROPERTIES) { - override fun appendHoverText( - p_41421_: ItemStack, - p_41422_: Level?, - p_41423_: MutableList, - p_41424_: TooltipFlag - ) { - p_41423_.add(TranslatableComponent("item.overdrive_that_matters.black_hole_scanner.desc").withStyle(ChatFormatting.GRAY)) - p_41423_.add(TranslatableComponent("item.overdrive_that_matters.black_hole_scanner.desc2").withStyle(ChatFormatting.DARK_GRAY)) - } - } - } + val BLACK_HOLE_SCANNER: Item by registry.register(MNames.BLACK_HOLE_SCANNER) { MatteryItem(DEFAULT_PROPERTIES).addSimpleDescription().addSimpleDescription("2") } val GRAVITATION_FIELD_LIMITER: Item by registry.register(MNames.GRAVITATION_FIELD_LIMITER) { Item(DEFAULT_PROPERTIES) } val GRAVITATION_FIELD_SENSOR: Item by registry.register(MNames.GRAVITATION_FIELD_SENSOR) { Item(DEFAULT_PROPERTIES) } @@ -515,10 +441,6 @@ object MItems { val TRITANIUM_DOOR = registry.coloredWithBase(MNames.TRITANIUM_DOOR) { color, _ -> DoubleHighBlockItem(MBlocks.TRITANIUM_DOOR[color]!!, DEFAULT_PROPERTIES) } val TRITANIUM_TRAPDOOR = registry.coloredWithBase(MNames.TRITANIUM_TRAPDOOR) { color, _ -> BlockItem(MBlocks.TRITANIUM_TRAPDOOR[color]!!, DEFAULT_PROPERTIES) } - init { - MRegistry.TRITANIUM_PRESSURE_PLATE.registerItems(registry) - } - // components val MATTER_IO_PORT: Item by registry.register(MNames.MATTER_IO_PORT) { Item(DEFAULT_PROPERTIES) } val MATTER_TRANSFORM_MATRIX: Item by registry.register(MNames.MATTER_TRANSFORM_MATRIX) { Item(DEFAULT_PROPERTIES) } @@ -537,33 +459,13 @@ object MItems { val ADVANCED_CONTROL_CIRCUIT: Item by registry.register(MNames.ADVANCED_CONTROL_CIRCUIT) { Item(DEFAULT_PROPERTIES) } val MATTER_CAPACITOR_PARTS: Item by registry.register(MNames.MATTER_CAPACITOR_PARTS) { Item(DEFAULT_PROPERTIES) } val CARBON_MESH: Item by registry.register(MNames.CARBON_MESH) { Item(DEFAULT_PROPERTIES) } - val REINFORCED_TRITANIUM_PLATE: Item by registry.register(MNames.REINFORCED_TRITANIUM_PLATE) { object : Item(DEFAULT_PROPERTIES) { - override fun appendHoverText( - p_41421_: ItemStack, - p_41422_: Level?, - p_41423_: MutableList, - p_41424_: TooltipFlag - ) { - super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_) - p_41423_.add(TranslatableComponent("$descriptionId.description").withStyle(ChatFormatting.DARK_GRAY)) - } - } } + val REINFORCED_TRITANIUM_PLATE: Item by registry.register(MNames.REINFORCED_TRITANIUM_PLATE) { MatteryItem(DEFAULT_PROPERTIES).addSimpleDescription() } val QUANTUM_TRANSCEIVER: Item by registry.register(MNames.QUANTUM_TRANSCEIVER) { Item(DEFAULT_PROPERTIES) } val ELECTROMAGNET: Item by registry.register(MNames.ELECTROMAGNET) { Item(DEFAULT_PROPERTIES) } val ELECTROMOTOR: Item by registry.register(MNames.ELECTROMOTOR) { Item(DEFAULT_PROPERTIES) } val MIRROR_COMPOUND: Item by registry.register(MNames.MIRROR_COMPOUND) { Item(DEFAULT_PROPERTIES) } - val MIRROR: Item by registry.register(MNames.MIRROR) { object : Item(DEFAULT_PROPERTIES) { - override fun appendHoverText( - p_41421_: ItemStack, - p_41422_: Level?, - p_41423_: MutableList, - p_41424_: TooltipFlag - ) { - super.appendHoverText(p_41421_, p_41422_, p_41423_, p_41424_) - p_41423_.add(TranslatableComponent("$descriptionId.description").withStyle(ChatFormatting.DARK_GRAY)) - } - } } + val MIRROR: Item by registry.register(MNames.MIRROR) { MatteryItem(DEFAULT_PROPERTIES).addSimpleDescription() } /** * List of components for everything else @@ -653,12 +555,6 @@ object MItems { init { // call static initializer ExopackUpgrades - - MRegistry.CARGO_CRATES.registerItems(registry) - MRegistry.TRITANIUM_BLOCK.registerItems(registry) - MRegistry.TRITANIUM_STAIRS.registerItems(registry) - MRegistry.TRITANIUM_SLAB.registerItems(registry) - MRegistry.TRITANIUM_WALL.registerItems(registry) } val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES) }