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 6dc802e52..cdf677bb2 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 @@ -116,6 +116,8 @@ private fun sounds(provider: MatteryLanguageProvider) { private fun misc(provider: MatteryLanguageProvider) { with(provider.english) { + misc("needs_no_power", "Requires no power to operate") + gui("lock_holo_screen", "Lock contents") gui("lock_holo_screen.tip", "Locking and unlocking contents is only possible in creative.\nWhen locked, text boundaries are removed.") @@ -373,6 +375,7 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.MATTER_BOTTLER, "Matter Bottler") add(MBlocks.DRIVE_VIEWER, "Drive Viewer") add(MBlocks.BLACK_HOLE, "Local Anomalous Singular Gravitation Field") + add(MBlocks.COBBLESTONE_GENERATOR, "Cobblestone Generator") add(MBlocks.ENGINE, "Ship Engine") add(MBlocks.HOLO_SIGN, "Holo Sign") @@ -412,13 +415,11 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.GRAVITATION_STABILIZER, "Space-Time Equalizer") add(MBlocks.GRAVITATION_STABILIZER_LENS, "Space-Time Equalizer Lens") add(MBlocks.GRAVITATION_STABILIZER, "desc", "Reduces gravitation effects of singularities") - add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Requires no power to operate") - add(MBlocks.GRAVITATION_STABILIZER, "desc3", "Keep in mind the effect of multiple stabilizers produce exponentially increasing result") - add(MBlocks.GRAVITATION_STABILIZER, "desc4", "Too weak gravitation field will cause singularity to melt and evaporate away very fast") + add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Keep in mind the effect of multiple stabilizers produce exponentially increasing result") + add(MBlocks.GRAVITATION_STABILIZER, "desc3", "Too weak gravitation field will cause singularity to melt and evaporate away very fast") add(MBlocks.PHANTOM_ATTRACTOR, "Phantom Attractor") add(MBlocks.PHANTOM_ATTRACTOR, "desc", "Attracts Phantoms when it is night time") - add(MBlocks.PHANTOM_ATTRACTOR, "desc2", "Requires no power to operate") add(MBlocks.LABORATORY_LAMP, "Laboratory Lamp") add(MBlocks.LABORATORY_LAMP, "description", "Provides directional light with redstone switch") 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 2093b565c..f333f0d35 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 @@ -125,6 +125,8 @@ private fun sounds(provider: MatteryLanguageProvider) { private fun misc(provider: MatteryLanguageProvider) { with(provider.russian) { + misc("needs_no_power", "Не требует энергии для работы") + gui("lock_holo_screen", "Заблокировать содержимое") gui("lock_holo_screen.tip", "Блокировка и разблокировка содержимого возможна только в режиме творчества.\nКогда заблокировано, границы ввода текста отключены.") @@ -378,6 +380,7 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.MATTER_BOTTLER, "Бутилировщик Материи") add(MBlocks.DRIVE_VIEWER, "Просмотрщик Дисков Конденсации") add(MBlocks.BLACK_HOLE, "Локализированное Аномальное Сингулярное Гравитационное Поле") + add(MBlocks.COBBLESTONE_GENERATOR, "Генератор Булыжника") add(MBlocks.ENGINE, "Двигатель Корабля") add(MBlocks.HOLO_SIGN, "Голографическая Табличка") @@ -417,13 +420,11 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.GRAVITATION_STABILIZER, "Стабилизатор Пространства-Времени") add(MBlocks.GRAVITATION_STABILIZER_LENS, "Линза Стабилизатора Пространства-Времени") add(MBlocks.GRAVITATION_STABILIZER, "desc", "Уменьшает гравитационное влияние сингулярностей") - add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Не требует энергии для работы") - add(MBlocks.GRAVITATION_STABILIZER, "desc3", "Имейте в ввиду, что несколько стабилизаторов создают экспоненциальный эффект") - add(MBlocks.GRAVITATION_STABILIZER, "desc4", "Слишком слабое гравитационное поле сингулярности приведёт к быстрому испарению последней") + add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Имейте в ввиду, что несколько стабилизаторов создают экспоненциальный эффект") + add(MBlocks.GRAVITATION_STABILIZER, "desc3", "Слишком слабое гравитационное поле сингулярности приведёт к быстрому испарению последней") add(MBlocks.PHANTOM_ATTRACTOR, "Приманщик Фантомов") add(MBlocks.PHANTOM_ATTRACTOR, "desc", "Приманивает фантомов в ночное время") - add(MBlocks.PHANTOM_ATTRACTOR, "desc2", "Не требует энергии для работы") add(MBlocks.LABORATORY_LAMP, "Лабораторная Лампа") add(MBlocks.LABORATORY_LAMP, "description", "Освещает на несколько блоков в направлении своей лампы, с переключателем красного камня") diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt index 8bb1a3831..a6321136b 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt @@ -58,6 +58,8 @@ fun addLootTables(lootTables: LootTables) { lootTables.dropsSelf(MBlocks.METAL_BEAM) { condition(ExplosionCondition.survivesExplosion()) } lootTables.dropsSelf(MBlocks.TRITANIUM_INGOT_BLOCK) { condition(ExplosionCondition.survivesExplosion()) } + lootTables.tile(MBlocks.COBBLESTONE_GENERATOR) + lootTables.dropsSelf(MBlocks.ENGINE) { condition(ExplosionCondition.survivesExplosion()) } for (door in MBlocks.TRITANIUM_TRAPDOOR.values) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt index 230497240..19d69f99a 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/CraftingTableRecipes.kt @@ -253,4 +253,11 @@ fun addCraftingTableRecipes(consumer: Consumer) { .row(MItemTags.CRAFTING_TABLES, MItems.QUANTUM_TRANSCEIVER, MItemTags.CRAFTING_TABLES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .build(consumer) + + // генератор коблы + MatteryRecipe(MItems.COBBLESTONE_GENERATOR, category = machinesCategory) + .row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.TRITANIUM_PICKAXE, MItemTags.HARDENED_GLASS_COLORLESS) + .row(Items.LAVA_BUCKET, Items.HOPPER, Items.WATER_BUCKET) + .rowB(Tags.Items.CHESTS) + .build(consumer) } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt index e726c1a6e..ad9a713a6 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/tags/Tags.kt @@ -145,6 +145,7 @@ fun addTags(tagsProvider: TagsProvider) { MBlocks.ENGINE, MBlocks.HOLO_SIGN, + MBlocks.COBBLESTONE_GENERATOR, ), Tiers.IRON) tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ORE, Tiers.IRON) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt index 37396ca9b..791544ebd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryPoweredBlockEntity.kt @@ -26,22 +26,22 @@ import ru.dbotthepony.mc.otm.core.nbt.map import ru.dbotthepony.mc.otm.core.nbt.set abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(p_155228_, p_155229_, p_155230_) { - abstract val energy: BlockEnergyStorageImpl + abstract val energy: BlockEnergyStorageImpl? private var valid = true val batteryContainer = MatteryContainer(this::setChangedLight, 1) protected fun batteryChargeLoop() { - if (!batteryContainer.any { !it.isEmpty }) + if (energy == null || !batteryContainer.any { !it.isEmpty }) return - var demand = energy.receiveEnergy(energy.missingPower, true) + var demand = energy!!.receiveEnergy(energy!!.missingPower, true) if (demand.isZero) return for (stack in batteryContainer) { if (!stack.isEmpty) { stack.getCapability(ForgeCapabilities.ENERGY).ifPresentK { val diff = it.extractEnergy(demand, false) - energy.receiveEnergy(diff, false) + energy!!.receiveEnergy(diff, false) demand -= diff } @@ -53,31 +53,36 @@ abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229 override fun invalidateCaps() { super.invalidateCaps() - energy.invalidate() + energy?.invalidate() valid = false } override fun reviveCaps() { super.reviveCaps() - energy.revive() + energy?.revive() valid = true } override fun getCapability(cap: Capability, side: Direction?): LazyOptional { - if (valid && (cap == MatteryCapability.ENERGY || cap == ForgeCapabilities.ENERGY)) - return energy.resolver.cast() + if (valid && (cap === MatteryCapability.ENERGY || cap === ForgeCapabilities.ENERGY) && energy != null) + return energy!!.resolver.cast() return super.getCapability(cap, side) } public override fun saveAdditional(nbt: CompoundTag) { super.saveAdditional(nbt) - nbt[ENERGY_KEY] = energy.serializeNBT() + + if (energy != null) + nbt[ENERGY_KEY] = energy!!.serializeNBT() + nbt[BATTERY_KEY] = batteryContainer.serializeNBT() } override fun load(nbt: CompoundTag) { - nbt.ifHas(ENERGY_KEY, CompoundTag::class.java, energy::deserializeNBT) + if (energy != null) + nbt.ifHas(ENERGY_KEY, CompoundTag::class.java, energy!!::deserializeNBT) + batteryContainer.deserializeNBT(nbt[BATTERY_KEY]) super.load(nbt) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt index 6084266ac..7eef81a74 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryWorkerBlockEntity.kt @@ -288,7 +288,7 @@ abstract class MatteryWorkerBlockEntity( currentJob = job } - if (!currentJob.powerUsage.isZero && energy.batteryLevel.isZero) { + if (!currentJob.powerUsage.isZero && (energy == null || energy!!.batteryLevel.isZero)) { idleReason = IdleReason.POWER isIdling = true idleTicksAnim++ @@ -316,7 +316,7 @@ abstract class MatteryWorkerBlockEntity( ticksAdvanced = availableTicks.coerceAtMost(ticksLeft) } else { requiredPower = currentJob.powerUsage * ticksLeft.coerceAtMost(availableTicks) - extractedPower = energy.extractEnergy(requiredPower, true) + extractedPower = energy!!.extractEnergy(requiredPower, true) ticksAdvanced = (extractedPower / requiredPower).toDouble().coerceAtMost(ticksLeft).coerceAtMost(availableTicks) } @@ -346,7 +346,7 @@ abstract class MatteryWorkerBlockEntity( extractedPower = status.newDrainedPower ?: extractedPower if (extractedPower != null) { - energy.extractEnergy(extractedPower, false) + energy!!.extractEnergy(extractedPower, false) } continue diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/CobblerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/CobblerBlockEntity.kt new file mode 100644 index 000000000..07a2c7b29 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/CobblerBlockEntity.kt @@ -0,0 +1,82 @@ +package ru.dbotthepony.mc.otm.block.entity.tech + +import net.minecraft.core.BlockPos +import net.minecraft.core.Direction +import net.minecraft.nbt.CompoundTag +import net.minecraft.network.chat.Component +import net.minecraft.world.Container +import net.minecraft.world.entity.player.Inventory +import net.minecraft.world.entity.player.Player +import net.minecraft.world.inventory.AbstractContainerMenu +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.Items +import net.minecraft.world.level.block.state.BlockState +import net.minecraftforge.common.capabilities.Capability +import net.minecraftforge.common.capabilities.ForgeCapabilities +import net.minecraftforge.common.util.LazyOptional +import ru.dbotthepony.mc.otm.block.IDroppableContainer +import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity +import ru.dbotthepony.mc.otm.container.MatteryContainer +import ru.dbotthepony.mc.otm.container.MatteryContainerHooks +import ru.dbotthepony.mc.otm.core.nbt.map +import ru.dbotthepony.mc.otm.core.nbt.set +import ru.dbotthepony.mc.otm.menu.tech.CobblerMenu +import ru.dbotthepony.mc.otm.registry.MBlockEntities + +class CobblerBlockEntity(blockPos: BlockPos, blockState: BlockState) + : MatteryWorkerBlockEntity(MBlockEntities.COBBLESTONE_GENERATOR, blockPos, blockState, ::ItemJob), IDroppableContainer { + override fun createMenu(containerID: Int, inventory: Inventory, ply: Player): AbstractContainerMenu { + return CobblerMenu(containerID, inventory, this) + } + + override val energy = null + override val droppableContainer = MatteryContainer(this::itemContainerUpdated, CONTAINER_SIZE) + val handler = droppableContainer.handler(object : MatteryContainerHooks { + override fun canInsert(slot: Int, stack: ItemStack): Boolean { + return false + } + }) + + override fun getCapability(cap: Capability, side: Direction?): LazyOptional { + if (cap === ForgeCapabilities.ITEM_HANDLER) + return handler.get().cast() + + return super.getCapability(cap, side) + } + + override fun invalidateCaps() { + super.invalidateCaps() + handler.invalidate() + } + + override fun reviveCaps() { + super.reviveCaps() + handler.revive() + } + + override fun saveAdditional(nbt: CompoundTag) { + super.saveAdditional(nbt) + nbt[INVENTORY_KEY] = droppableContainer.serializeNBT() + } + + override fun load(nbt: CompoundTag) { + super.load(nbt) + nbt.map(INVENTORY_KEY, droppableContainer::deserializeNBT) + } + + override fun onJobFinish(job: ItemJob): Status { + if (!droppableContainer.fullyAddItem(job.itemStack)) { + return Status.FAILURE_ITEM + } + + return Status.SUCCESS + } + + override fun computeNextJob(): Pair { + return ItemJob(ItemStack(Items.COBBLESTONE), 40.0) to null + } + + companion object { + const val CONTAINER_SIZE = 16 + } +} 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 new file mode 100644 index 000000000..c92f427ae --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/CobblerBlock.kt @@ -0,0 +1,29 @@ +package ru.dbotthepony.mc.otm.block.tech + +import net.minecraft.core.BlockPos +import net.minecraft.world.level.Level +import net.minecraft.world.level.block.EntityBlock +import net.minecraft.world.level.block.entity.BlockEntity +import net.minecraft.world.level.block.entity.BlockEntityTicker +import net.minecraft.world.level.block.entity.BlockEntityType +import net.minecraft.world.level.block.state.BlockState +import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock +import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity + +class CobblerBlock : RotatableMatteryBlock(), EntityBlock { + override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { + return CobblerBlockEntity(pPos, pState) + } + + override fun getTicker( + pLevel: Level, + pState: BlockState, + pBlockEntityType: BlockEntityType + ): BlockEntityTicker? { + if (!pLevel.isClientSide) { + return BlockEntityTicker { _, _, _, pBlockEntity -> if (pBlockEntity is CobblerBlockEntity) pBlockEntity.basicTicker() } + } + + return null + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/CobblerScreen.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/CobblerScreen.kt new file mode 100644 index 000000000..42b304b03 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/tech/CobblerScreen.kt @@ -0,0 +1,27 @@ +package ru.dbotthepony.mc.otm.client.screen.tech + +import net.minecraft.network.chat.Component +import net.minecraft.world.entity.player.Inventory +import ru.dbotthepony.mc.otm.client.screen.MatteryScreen +import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel +import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls +import ru.dbotthepony.mc.otm.client.screen.panels.slot.AbstractSlotPanel +import ru.dbotthepony.mc.otm.client.screen.panels.slot.SlotPanel +import ru.dbotthepony.mc.otm.client.screen.widget.ProgressGaugePanel +import ru.dbotthepony.mc.otm.menu.tech.CobblerMenu + +class CobblerScreen(menu: CobblerMenu, inventory: Inventory, title: Component) : MatteryScreen(menu, inventory, title) { + override fun makeMainFrame(): FramePanel> { + val frame = super.makeMainFrame()!! + + ProgressGaugePanel(this, frame, menu.progress, 30f, 42f) + + for (row in 0 .. 3) + for (column in 0 .. 3) + SlotPanel(this, frame, menu.storageSlots[row * 4 + column], 80f + column * AbstractSlotPanel.SIZE, 17f + row * AbstractSlotPanel.SIZE) + + makeDeviceControls(this, frame, redstone = menu.redstone) + + return frame + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/input/EnumInputWithFeedback.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/input/EnumInputWithFeedback.kt index f03279bd4..fe9dfabfd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/input/EnumInputWithFeedback.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/input/EnumInputWithFeedback.kt @@ -5,6 +5,10 @@ import ru.dbotthepony.mc.otm.core.util.EnumValueCodec import ru.dbotthepony.mc.otm.menu.MatteryMenu import kotlin.reflect.KMutableProperty0 +inline fun > EnumInputWithFeedback(menu: MatteryMenu) = EnumInputWithFeedback(menu, E::class.java) +inline fun > EnumInputWithFeedback(menu: MatteryMenu, state: KMutableProperty0) = EnumInputWithFeedback(menu, E::class.java, state) +inline fun > EnumInputWithFeedback(menu: MatteryMenu, state: GetterSetter) = EnumInputWithFeedback(menu, E::class.java, state) + class EnumInputWithFeedback>(menu: MatteryMenu, clazz: Class) : AbstractPlayerInputWithFeedback() { val codec = EnumValueCodec(clazz) private val default = codec.clazz.enumConstants!![0] diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/CobblerMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/CobblerMenu.kt new file mode 100644 index 000000000..0ee1adb62 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/tech/CobblerMenu.kt @@ -0,0 +1,34 @@ +package ru.dbotthepony.mc.otm.menu.tech + +import net.minecraft.world.SimpleContainer +import net.minecraft.world.entity.player.Inventory +import ru.dbotthepony.mc.otm.block.entity.RedstoneSetting +import ru.dbotthepony.mc.otm.block.entity.tech.CobblerBlockEntity +import ru.dbotthepony.mc.otm.core.ImmutableList +import ru.dbotthepony.mc.otm.menu.MachineOutputSlot +import ru.dbotthepony.mc.otm.menu.MatteryMenu +import ru.dbotthepony.mc.otm.menu.input.EnumInputWithFeedback +import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget +import ru.dbotthepony.mc.otm.registry.MMenus + +class CobblerMenu @JvmOverloads constructor( + p_38852_: Int, + inventory: Inventory, + tile: CobblerBlockEntity? = null +) : MatteryMenu(MMenus.COBBLESTONE_GENERATOR, p_38852_, inventory, tile) { + override val storageSlots = (tile?.droppableContainer ?: SimpleContainer(CobblerBlockEntity.CONTAINER_SIZE)).let { c -> ImmutableList(c.containerSize) { addSlot(MachineOutputSlot(c, it)) } } + val redstone = EnumInputWithFeedback(this) + + val progress: ProgressGaugeWidget + + init { + if (tile == null) + progress = ProgressGaugeWidget(this) + else { + progress = ProgressGaugeWidget(this, tile::workProgress, tile::isUnableToProcess) + redstone.with(tile.redstoneControl::redstoneSetting) + } + + addInventorySlots() + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlockEntities.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlockEntities.kt index 7e87582b3..b0e1e28c5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlockEntities.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlockEntities.kt @@ -55,6 +55,7 @@ object MBlockEntities { val GRAVITATION_STABILIZER: BlockEntityType by registry.register(MNames.GRAVITATION_STABILIZER) { BlockEntityType.Builder.of(::GravitationStabilizerBlockEntity, MBlocks.GRAVITATION_STABILIZER).build(null) } val MATTER_RECYCLER: BlockEntityType by registry.register(MNames.MATTER_RECYCLER) { BlockEntityType.Builder.of(::MatterRecyclerBlockEntity, MBlocks.MATTER_RECYCLER).build(null) } val ENERGY_SERVO: BlockEntityType by registry.register(MNames.ENERGY_SERVO) { BlockEntityType.Builder.of(::EnergyServoBlockEntity, MBlocks.ENERGY_SERVO).build(null) } + val COBBLESTONE_GENERATOR: BlockEntityType by registry.register(MNames.COBBLESTONE_GENERATOR) { BlockEntityType.Builder.of(::CobblerBlockEntity, MBlocks.COBBLESTONE_GENERATOR).build(null) } val STORAGE_BUS: BlockEntityType by registry.register(MNames.STORAGE_BUS) { BlockEntityType.Builder.of(::StorageBusBlockEntity, MBlocks.STORAGE_BUS).build(null) } val STORAGE_IMPORTER: BlockEntityType by registry.register(MNames.STORAGE_IMPORTER) { BlockEntityType.Builder.of(::StorageImporterBlockEntity, MBlocks.STORAGE_IMPORTER).build(null) } 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 610485890..fb2eb2935 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt @@ -60,6 +60,7 @@ import ru.dbotthepony.mc.otm.block.storage.StorageBusBlock import ru.dbotthepony.mc.otm.block.storage.StorageExporterBlock import ru.dbotthepony.mc.otm.block.storage.StorageImporterBlock import ru.dbotthepony.mc.otm.block.storage.StoragePowerSupplierBlock +import ru.dbotthepony.mc.otm.block.tech.CobblerBlock import ru.dbotthepony.mc.otm.core.TranslatableComponent object MBlocks { @@ -84,6 +85,7 @@ object MBlocks { val PLATE_PRESS: Block by registry.register(MNames.PLATE_PRESS) { PlatePressBlock() } val MATTER_RECYCLER: Block by registry.register(MNames.MATTER_RECYCLER) { MatterRecyclerBlock() } val ENERGY_SERVO: Block by registry.register(MNames.ENERGY_SERVO) { EnergyServoBlock() } + val COBBLESTONE_GENERATOR: Block by registry.register(MNames.COBBLESTONE_GENERATOR) { CobblerBlock() } val STORAGE_BUS: Block by registry.register(MNames.STORAGE_BUS) { StorageBusBlock() } val STORAGE_IMPORTER: Block by registry.register(MNames.STORAGE_IMPORTER) { StorageImporterBlock() } 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 ae570b824..a4f1959a3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -58,46 +58,31 @@ object MItems { val GRAVITATION_STABILIZER: Item 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 - ) { + 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.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)) - p_40574_.add(TranslatableComponent("${MBlocks.GRAVITATION_STABILIZER.descriptionId}.desc4").withStyle(ChatFormatting.DARK_GRAY)) } } } val PHANTOM_ATTRACTOR: Item 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 - ) { + 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("${MBlocks.PHANTOM_ATTRACTOR.descriptionId}.desc2").withStyle(ChatFormatting.DARK_GRAY)) + p_40574_.add(TranslatableComponent("otm.needs_no_power").withStyle(ChatFormatting.DARK_GRAY)) } } } val ENERGY_SERVO: Item 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 - ) { + 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)) @@ -105,13 +90,22 @@ object MItems { } } + val COBBLESTONE_GENERATOR: Item by registry.register(MNames.COBBLESTONE_GENERATOR) { + object : BlockItem(MBlocks.COBBLESTONE_GENERATOR, 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 MACHINES = SupplierList( ::ANDROID_STATION, ::BATTERY_BANK, ::MATTER_DECOMPOSER, ::MATTER_CAPACITOR_BANK, ::MATTER_CABLE, ::PATTERN_STORAGE, ::MATTER_SCANNER, ::MATTER_PANEL, ::MATTER_REPLICATOR, ::MATTER_BOTTLER, ::ENERGY_COUNTER, ::CHEMICAL_GENERATOR, ::PLATE_PRESS, ::MATTER_RECYCLER, ::STORAGE_BUS, ::STORAGE_IMPORTER, ::STORAGE_EXPORTER, ::DRIVE_VIEWER, ::DRIVE_RACK, ::ITEM_MONITOR, ::STORAGE_CABLE, ::STORAGE_POWER_SUPPLIER, ::ENERGY_SERVO, ::PHANTOM_ATTRACTOR, - ::GRAVITATION_STABILIZER, + ::GRAVITATION_STABILIZER, ::COBBLESTONE_GENERATOR ) val DEBUG_EXPLOSION_SMALL: Item by registry.register(MNames.DEBUG_EXPLOSION_SMALL) { BlockItem(MBlocks.DEBUG_EXPLOSION_SMALL, Item.Properties().stacksTo(64)) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt index dd08c720e..ca87fe476 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MMenus.kt @@ -28,6 +28,7 @@ import ru.dbotthepony.mc.otm.client.screen.storage.StoragePowerSupplierScreen import ru.dbotthepony.mc.otm.client.screen.tech.AndroidStationScreen import ru.dbotthepony.mc.otm.client.screen.tech.BatteryBankScreen import ru.dbotthepony.mc.otm.client.screen.tech.ChemicalGeneratorScreen +import ru.dbotthepony.mc.otm.client.screen.tech.CobblerScreen import ru.dbotthepony.mc.otm.client.screen.tech.EnergyCounterScreen import ru.dbotthepony.mc.otm.client.screen.tech.EnergyServoScreen import ru.dbotthepony.mc.otm.client.screen.tech.PlatePressScreen @@ -52,6 +53,7 @@ import ru.dbotthepony.mc.otm.menu.storage.StoragePowerSupplierMenu import ru.dbotthepony.mc.otm.menu.tech.AndroidStationMenu import ru.dbotthepony.mc.otm.menu.tech.BatteryBankMenu import ru.dbotthepony.mc.otm.menu.tech.ChemicalGeneratorMenu +import ru.dbotthepony.mc.otm.menu.tech.CobblerMenu import ru.dbotthepony.mc.otm.menu.tech.EnergyCounterMenu import ru.dbotthepony.mc.otm.menu.tech.EnergyServoMenu import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu @@ -79,6 +81,7 @@ object MMenus { val MATTER_RECYCLER: MenuType<*> by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu) } val ENERGY_SERVO: MenuType<*> by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu) } val HOLO_SIGN: MenuType by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu) } + val COBBLESTONE_GENERATOR: MenuType by registry.register(MNames.COBBLESTONE_GENERATOR) { MenuType(::CobblerMenu) } val STORAGE_BUS: MenuType<*> by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu) } val STORAGE_EXPORTER: MenuType<*> by registry.register(MNames.STORAGE_EXPORTER) { MenuType(::StorageExporterMenu) } @@ -117,6 +120,7 @@ object MMenus { MenuScreens.register(STORAGE_POWER_SUPPLIER as MenuType, ::StoragePowerSupplierScreen) MenuScreens.register(ENERGY_SERVO as MenuType, ::EnergyServoScreen) MenuScreens.register(HOLO_SIGN, ::HoloSignScreen) + MenuScreens.register(COBBLESTONE_GENERATOR, ::CobblerScreen) } } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt index 228b39c0e..79b463c2a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt @@ -31,6 +31,7 @@ object MNames { const val PLATE_PRESS = "plate_press" const val MATTER_RECYCLER = "matter_recycler" const val ENERGY_SERVO = "energy_servo" + const val COBBLESTONE_GENERATOR = "cobblestone_generator" const val STORAGE_CABLE = "storage_cable" // нужен рецепт const val STORAGE_POWER_SUPPLIER = "storage_power_supplier" // нужен рецепт