Some unifications regarding item tooltips
This commit is contained in:
parent
1e8aecb5d7
commit
0c004aedc5
@ -119,6 +119,8 @@ private fun sounds(provider: MatteryLanguageProvider) {
|
||||
|
||||
private fun misc(provider: MatteryLanguageProvider) {
|
||||
with(provider.english) {
|
||||
gui("shift_for_more_info", "<Hold 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")
|
||||
|
@ -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 для переключения зарядки слотов")
|
||||
|
||||
|
@ -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<Property<*>>, fn: (BlockState) -> VoxelShape): Map<BlockState, VoxelShape> {
|
||||
val builder = ImmutableMap.Builder<BlockState, VoxelShape>()
|
||||
@ -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<Component>, 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 : MatteryBlock> T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||
return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) }
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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 {
|
||||
|
@ -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<Component>,
|
||||
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)
|
||||
}
|
||||
}
|
@ -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<Component>,
|
||||
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)
|
||||
}
|
||||
}
|
@ -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")
|
||||
|
@ -39,14 +39,14 @@ class DriveRackBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Entity
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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() }
|
||||
|
@ -50,14 +50,14 @@ class DriveViewerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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 {
|
||||
|
@ -39,14 +39,14 @@ class ItemMonitorBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), Enti
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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() }
|
||||
|
@ -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<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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<Block, BlockState>) {
|
||||
|
@ -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<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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 <T : BlockEntity?> getTicker(
|
||||
|
@ -39,14 +39,14 @@ class StoragePowerSupplierBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTI
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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() }
|
||||
|
@ -139,12 +139,12 @@ class AndroidChargerBlock : RotatableMatteryBlock(Properties.of().destroyTime(2.
|
||||
}
|
||||
}
|
||||
|
||||
override fun appendHoverText(p_49816_: ItemStack, p_49817_: BlockGetter?, p_49818_: MutableList<Component>, p_49819_: TooltipFlag) {
|
||||
super.appendHoverText(p_49816_, p_49817_, p_49818_, p_49819_)
|
||||
override fun appendHoverText(itemStack: ItemStack, blockAccessor: BlockGetter?, components: MutableList<Component>, 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)) {
|
||||
|
@ -52,14 +52,14 @@ class AndroidStationBlock : MatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBloc
|
||||
}
|
||||
|
||||
override fun appendHoverText(
|
||||
p_49816_: ItemStack,
|
||||
p_49817_: BlockGetter?,
|
||||
p_49818_: MutableList<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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(
|
||||
|
@ -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<Component>,
|
||||
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() }
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
@ -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(),
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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<Component>,
|
||||
p_49819_: TooltipFlag
|
||||
itemStack: ItemStack,
|
||||
blockAccessor: BlockGetter?,
|
||||
components: MutableList<Component>,
|
||||
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() }
|
||||
|
100
src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt
Normal file
100
src/main/kotlin/ru/dbotthepony/mc/otm/core/ITooltippable.kt
Normal file
@ -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<out Component>) {
|
||||
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<Component>) {
|
||||
lines.forEach { c ->
|
||||
addDescriptionFunctionsInternal({ ObjectIterators.singleton(c.copy()) })
|
||||
}
|
||||
}
|
||||
|
||||
fun addDescriptionFunctionsInternal(lines: Stream<out (ItemStack) -> Iterator<Component>>)
|
||||
fun addDescriptionFunctionsInternal(vararg lines: (ItemStack) -> Iterator<Component>)
|
||||
fun addDescriptionFunctionsInternal(lines: Collection<(ItemStack) -> Iterator<Component>>)
|
||||
|
||||
fun assembleDescription(itemStack: ItemStack, into: MutableCollection<Component>)
|
||||
|
||||
class Impl : ITooltippable {
|
||||
private val descriptionLines = ArrayList<(ItemStack) -> Iterator<Component>>()
|
||||
|
||||
override fun addDescriptionFunctionsInternal(lines: Stream<out (ItemStack) -> Iterator<Component>>) {
|
||||
lines.forEach { descriptionLines.add(it) }
|
||||
}
|
||||
|
||||
override fun addDescriptionFunctionsInternal(vararg lines: (ItemStack) -> Iterator<Component>) {
|
||||
lines.forEach { descriptionLines.add(it) }
|
||||
}
|
||||
|
||||
override fun addDescriptionFunctionsInternal(lines: Collection<(ItemStack) -> Iterator<Component>>) {
|
||||
lines.forEach { descriptionLines.add(it) }
|
||||
}
|
||||
|
||||
override fun assembleDescription(itemStack: ItemStack, into: MutableCollection<Component>) {
|
||||
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 : ITooltippable> T.addDescriptionLines(lines: Stream<out Component>): T {
|
||||
addDescriptionLinesInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionLines(vararg lines: Component): T {
|
||||
addDescriptionLinesInternal(lines.stream())
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionLines(lines: Collection<Component>): T {
|
||||
addDescriptionLinesInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(lines: Stream<out (ItemStack) -> Iterator<Component>>): T {
|
||||
addDescriptionFunctionsInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(vararg lines: (ItemStack) -> Iterator<Component>): T {
|
||||
addDescriptionFunctionsInternal(lines.stream())
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(line: (ItemStack) -> Iterator<Component>): T {
|
||||
addDescriptionFunctionsInternal(line)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.addDescriptionFunctions(lines: Collection<(ItemStack) -> Iterator<Component>>): T {
|
||||
addDescriptionFunctionsInternal(lines)
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T : ITooltippable> T.needsNoPowerDescription(formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||
return addDescriptionLines(TranslatableComponent("otm.needs_no_power").withStyle(formatting))
|
||||
}
|
@ -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<Component>, 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
|
||||
|
||||
|
@ -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<Component>, 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<Component>, 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))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<Component>, 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 {
|
||||
|
28
src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt
Normal file
28
src/main/kotlin/ru/dbotthepony/mc/otm/item/MatteryItem.kt
Normal file
@ -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<Component>, tooltipType: TooltipFlag) {
|
||||
super.appendHoverText(itemStack, level, components, tooltipType)
|
||||
assembleDescription(itemStack, components)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : MatteryItem> T.addSimpleDescription(suffix: String = "", formatting: ChatFormatting = ChatFormatting.GRAY): T {
|
||||
return addDescriptionFunctions { ObjectIterators.singleton(TranslatableComponent("$descriptionId.desc$suffix").withStyle(formatting)) }
|
||||
}
|
@ -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<Component>,
|
||||
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<DyeColor?, DoorBlock> = 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<Component>,
|
||||
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<DyeColor?, TritaniumDoorBlock> = 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<DyeColor?, TrapDoorBlock> = 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<Component>,
|
||||
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<DyeColor?, TritaniumTrapdoorBlock> = registry.coloredWithBase(MNames.TRITANIUM_TRAPDOOR) { color, _ ->
|
||||
TritaniumTrapdoorBlock(color) }
|
||||
|
||||
val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block(
|
||||
BlockBehaviour.Properties.of()
|
||||
|
@ -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<Component>, 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<Component>, 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<Component>, 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<DyeColor?, BlockItem> = 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<Component>, 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<DyeColor?, BlockItem> = 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<DyeColor?, BlockItem> = 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<DyeColor?, BlockItem> = 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<Component>, 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<Component>, 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<Component>, 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<Component>,
|
||||
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<Component>,
|
||||
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<Component>,
|
||||
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) }
|
||||
|
Loading…
Reference in New Issue
Block a user