Cobblestone generator device

This commit is contained in:
DBotThePony 2023-02-15 17:31:59 +07:00
parent b254a705d7
commit 370aca1e6a
Signed by: DBot
GPG Key ID: DCC23B5715498507
17 changed files with 237 additions and 42 deletions

View File

@ -116,6 +116,8 @@ private fun sounds(provider: MatteryLanguageProvider) {
private fun misc(provider: MatteryLanguageProvider) { private fun misc(provider: MatteryLanguageProvider) {
with(provider.english) { with(provider.english) {
misc("needs_no_power", "Requires no power to operate")
gui("lock_holo_screen", "Lock contents") 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.") 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.MATTER_BOTTLER, "Matter Bottler")
add(MBlocks.DRIVE_VIEWER, "Drive Viewer") add(MBlocks.DRIVE_VIEWER, "Drive Viewer")
add(MBlocks.BLACK_HOLE, "Local Anomalous Singular Gravitation Field") add(MBlocks.BLACK_HOLE, "Local Anomalous Singular Gravitation Field")
add(MBlocks.COBBLESTONE_GENERATOR, "Cobblestone Generator")
add(MBlocks.ENGINE, "Ship Engine") add(MBlocks.ENGINE, "Ship Engine")
add(MBlocks.HOLO_SIGN, "Holo Sign") 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, "Space-Time Equalizer")
add(MBlocks.GRAVITATION_STABILIZER_LENS, "Space-Time Equalizer Lens") add(MBlocks.GRAVITATION_STABILIZER_LENS, "Space-Time Equalizer Lens")
add(MBlocks.GRAVITATION_STABILIZER, "desc", "Reduces gravitation effects of singularities") add(MBlocks.GRAVITATION_STABILIZER, "desc", "Reduces gravitation effects of singularities")
add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Requires no power to operate") add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Keep in mind the effect of multiple stabilizers produce exponentially increasing result")
add(MBlocks.GRAVITATION_STABILIZER, "desc3", "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.GRAVITATION_STABILIZER, "desc4", "Too weak gravitation field will cause singularity to melt and evaporate away very fast")
add(MBlocks.PHANTOM_ATTRACTOR, "Phantom Attractor") add(MBlocks.PHANTOM_ATTRACTOR, "Phantom Attractor")
add(MBlocks.PHANTOM_ATTRACTOR, "desc", "Attracts Phantoms when it is night time") 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, "Laboratory Lamp")
add(MBlocks.LABORATORY_LAMP, "description", "Provides directional light with redstone switch") add(MBlocks.LABORATORY_LAMP, "description", "Provides directional light with redstone switch")

View File

@ -125,6 +125,8 @@ private fun sounds(provider: MatteryLanguageProvider) {
private fun misc(provider: MatteryLanguageProvider) { private fun misc(provider: MatteryLanguageProvider) {
with(provider.russian) { with(provider.russian) {
misc("needs_no_power", "Не требует энергии для работы")
gui("lock_holo_screen", "Заблокировать содержимое") gui("lock_holo_screen", "Заблокировать содержимое")
gui("lock_holo_screen.tip", "Блокировка и разблокировка содержимого возможна только в режиме творчества.\nКогда заблокировано, границы ввода текста отключены.") gui("lock_holo_screen.tip", "Блокировка и разблокировка содержимого возможна только в режиме творчества.\nКогда заблокировано, границы ввода текста отключены.")
@ -378,6 +380,7 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.MATTER_BOTTLER, "Бутилировщик Материи") add(MBlocks.MATTER_BOTTLER, "Бутилировщик Материи")
add(MBlocks.DRIVE_VIEWER, "Просмотрщик Дисков Конденсации") add(MBlocks.DRIVE_VIEWER, "Просмотрщик Дисков Конденсации")
add(MBlocks.BLACK_HOLE, "Локализированное Аномальное Сингулярное Гравитационное Поле") add(MBlocks.BLACK_HOLE, "Локализированное Аномальное Сингулярное Гравитационное Поле")
add(MBlocks.COBBLESTONE_GENERATOR, "Генератор Булыжника")
add(MBlocks.ENGINE, "Двигатель Корабля") add(MBlocks.ENGINE, "Двигатель Корабля")
add(MBlocks.HOLO_SIGN, "Голографическая Табличка") add(MBlocks.HOLO_SIGN, "Голографическая Табличка")
@ -417,13 +420,11 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.GRAVITATION_STABILIZER, "Стабилизатор Пространства-Времени") add(MBlocks.GRAVITATION_STABILIZER, "Стабилизатор Пространства-Времени")
add(MBlocks.GRAVITATION_STABILIZER_LENS, "Линза Стабилизатора Пространства-Времени") add(MBlocks.GRAVITATION_STABILIZER_LENS, "Линза Стабилизатора Пространства-Времени")
add(MBlocks.GRAVITATION_STABILIZER, "desc", "Уменьшает гравитационное влияние сингулярностей") add(MBlocks.GRAVITATION_STABILIZER, "desc", "Уменьшает гравитационное влияние сингулярностей")
add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Не требует энергии для работы") add(MBlocks.GRAVITATION_STABILIZER, "desc2", "Имейте в ввиду, что несколько стабилизаторов создают экспоненциальный эффект")
add(MBlocks.GRAVITATION_STABILIZER, "desc3", "Имейте в ввиду, что несколько стабилизаторов создают экспоненциальный эффект") add(MBlocks.GRAVITATION_STABILIZER, "desc3", "Слишком слабое гравитационное поле сингулярности приведёт к быстрому испарению последней")
add(MBlocks.GRAVITATION_STABILIZER, "desc4", "Слишком слабое гравитационное поле сингулярности приведёт к быстрому испарению последней")
add(MBlocks.PHANTOM_ATTRACTOR, "Приманщик Фантомов") add(MBlocks.PHANTOM_ATTRACTOR, "Приманщик Фантомов")
add(MBlocks.PHANTOM_ATTRACTOR, "desc", "Приманивает фантомов в ночное время") add(MBlocks.PHANTOM_ATTRACTOR, "desc", "Приманивает фантомов в ночное время")
add(MBlocks.PHANTOM_ATTRACTOR, "desc2", "Не требует энергии для работы")
add(MBlocks.LABORATORY_LAMP, "Лабораторная Лампа") add(MBlocks.LABORATORY_LAMP, "Лабораторная Лампа")
add(MBlocks.LABORATORY_LAMP, "description", "Освещает на несколько блоков в направлении своей лампы, с переключателем красного камня") add(MBlocks.LABORATORY_LAMP, "description", "Освещает на несколько блоков в направлении своей лампы, с переключателем красного камня")

View File

@ -58,6 +58,8 @@ fun addLootTables(lootTables: LootTables) {
lootTables.dropsSelf(MBlocks.METAL_BEAM) { condition(ExplosionCondition.survivesExplosion()) } lootTables.dropsSelf(MBlocks.METAL_BEAM) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_INGOT_BLOCK) { condition(ExplosionCondition.survivesExplosion()) } lootTables.dropsSelf(MBlocks.TRITANIUM_INGOT_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.tile(MBlocks.COBBLESTONE_GENERATOR)
lootTables.dropsSelf(MBlocks.ENGINE) { condition(ExplosionCondition.survivesExplosion()) } lootTables.dropsSelf(MBlocks.ENGINE) { condition(ExplosionCondition.survivesExplosion()) }
for (door in MBlocks.TRITANIUM_TRAPDOOR.values) for (door in MBlocks.TRITANIUM_TRAPDOOR.values)

View File

@ -253,4 +253,11 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.row(MItemTags.CRAFTING_TABLES, MItems.QUANTUM_TRANSCEIVER, MItemTags.CRAFTING_TABLES) .row(MItemTags.CRAFTING_TABLES, MItems.QUANTUM_TRANSCEIVER, MItemTags.CRAFTING_TABLES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.build(consumer) .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)
} }

View File

@ -145,6 +145,7 @@ fun addTags(tagsProvider: TagsProvider) {
MBlocks.ENGINE, MBlocks.ENGINE,
MBlocks.HOLO_SIGN, MBlocks.HOLO_SIGN,
MBlocks.COBBLESTONE_GENERATOR,
), Tiers.IRON) ), Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ORE, Tiers.IRON) tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ORE, Tiers.IRON)

View File

@ -26,22 +26,22 @@ import ru.dbotthepony.mc.otm.core.nbt.map
import ru.dbotthepony.mc.otm.core.nbt.set 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 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 private var valid = true
val batteryContainer = MatteryContainer(this::setChangedLight, 1) val batteryContainer = MatteryContainer(this::setChangedLight, 1)
protected fun batteryChargeLoop() { protected fun batteryChargeLoop() {
if (!batteryContainer.any { !it.isEmpty }) if (energy == null || !batteryContainer.any { !it.isEmpty })
return return
var demand = energy.receiveEnergy(energy.missingPower, true) var demand = energy!!.receiveEnergy(energy!!.missingPower, true)
if (demand.isZero) return if (demand.isZero) return
for (stack in batteryContainer) { for (stack in batteryContainer) {
if (!stack.isEmpty) { if (!stack.isEmpty) {
stack.getCapability(ForgeCapabilities.ENERGY).ifPresentK { stack.getCapability(ForgeCapabilities.ENERGY).ifPresentK {
val diff = it.extractEnergy(demand, false) val diff = it.extractEnergy(demand, false)
energy.receiveEnergy(diff, false) energy!!.receiveEnergy(diff, false)
demand -= diff demand -= diff
} }
@ -53,31 +53,36 @@ abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229
override fun invalidateCaps() { override fun invalidateCaps() {
super.invalidateCaps() super.invalidateCaps()
energy.invalidate() energy?.invalidate()
valid = false valid = false
} }
override fun reviveCaps() { override fun reviveCaps() {
super.reviveCaps() super.reviveCaps()
energy.revive() energy?.revive()
valid = true valid = true
} }
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> { override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
if (valid && (cap == MatteryCapability.ENERGY || cap == ForgeCapabilities.ENERGY)) if (valid && (cap === MatteryCapability.ENERGY || cap === ForgeCapabilities.ENERGY) && energy != null)
return energy.resolver.cast() return energy!!.resolver.cast()
return super.getCapability(cap, side) return super.getCapability(cap, side)
} }
public override fun saveAdditional(nbt: CompoundTag) { public override fun saveAdditional(nbt: CompoundTag) {
super.saveAdditional(nbt) super.saveAdditional(nbt)
nbt[ENERGY_KEY] = energy.serializeNBT()
if (energy != null)
nbt[ENERGY_KEY] = energy!!.serializeNBT()
nbt[BATTERY_KEY] = batteryContainer.serializeNBT() nbt[BATTERY_KEY] = batteryContainer.serializeNBT()
} }
override fun load(nbt: CompoundTag) { 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]) batteryContainer.deserializeNBT(nbt[BATTERY_KEY])
super.load(nbt) super.load(nbt)
} }

View File

@ -288,7 +288,7 @@ abstract class MatteryWorkerBlockEntity<JobType : MatteryWorkerBlockEntity.Job>(
currentJob = job currentJob = job
} }
if (!currentJob.powerUsage.isZero && energy.batteryLevel.isZero) { if (!currentJob.powerUsage.isZero && (energy == null || energy!!.batteryLevel.isZero)) {
idleReason = IdleReason.POWER idleReason = IdleReason.POWER
isIdling = true isIdling = true
idleTicksAnim++ idleTicksAnim++
@ -316,7 +316,7 @@ abstract class MatteryWorkerBlockEntity<JobType : MatteryWorkerBlockEntity.Job>(
ticksAdvanced = availableTicks.coerceAtMost(ticksLeft) ticksAdvanced = availableTicks.coerceAtMost(ticksLeft)
} else { } else {
requiredPower = currentJob.powerUsage * ticksLeft.coerceAtMost(availableTicks) requiredPower = currentJob.powerUsage * ticksLeft.coerceAtMost(availableTicks)
extractedPower = energy.extractEnergy(requiredPower, true) extractedPower = energy!!.extractEnergy(requiredPower, true)
ticksAdvanced = (extractedPower / requiredPower).toDouble().coerceAtMost(ticksLeft).coerceAtMost(availableTicks) ticksAdvanced = (extractedPower / requiredPower).toDouble().coerceAtMost(ticksLeft).coerceAtMost(availableTicks)
} }
@ -346,7 +346,7 @@ abstract class MatteryWorkerBlockEntity<JobType : MatteryWorkerBlockEntity.Job>(
extractedPower = status.newDrainedPower ?: extractedPower extractedPower = status.newDrainedPower ?: extractedPower
if (extractedPower != null) { if (extractedPower != null) {
energy.extractEnergy(extractedPower, false) energy!!.extractEnergy(extractedPower, false)
} }
continue continue

View File

@ -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<MatteryWorkerBlockEntity.ItemJob>(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 <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
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<ItemJob?, Any?> {
return ItemJob(ItemStack(Items.COBBLESTONE), 40.0) to null
}
companion object {
const val CONTAINER_SIZE = 16
}
}

View File

@ -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 <T : BlockEntity?> getTicker(
pLevel: Level,
pState: BlockState,
pBlockEntityType: BlockEntityType<T>
): BlockEntityTicker<T>? {
if (!pLevel.isClientSide) {
return BlockEntityTicker { _, _, _, pBlockEntity -> if (pBlockEntity is CobblerBlockEntity) pBlockEntity.basicTicker() }
}
return null
}
}

View File

@ -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<CobblerMenu>(menu, inventory, title) {
override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
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
}
}

View File

@ -5,6 +5,10 @@ import ru.dbotthepony.mc.otm.core.util.EnumValueCodec
import ru.dbotthepony.mc.otm.menu.MatteryMenu import ru.dbotthepony.mc.otm.menu.MatteryMenu
import kotlin.reflect.KMutableProperty0 import kotlin.reflect.KMutableProperty0
inline fun <reified E : Enum<E>> EnumInputWithFeedback(menu: MatteryMenu) = EnumInputWithFeedback(menu, E::class.java)
inline fun <reified E : Enum<E>> EnumInputWithFeedback(menu: MatteryMenu, state: KMutableProperty0<E>) = EnumInputWithFeedback(menu, E::class.java, state)
inline fun <reified E : Enum<E>> EnumInputWithFeedback(menu: MatteryMenu, state: GetterSetter<E>) = EnumInputWithFeedback(menu, E::class.java, state)
class EnumInputWithFeedback<E : Enum<E>>(menu: MatteryMenu, clazz: Class<E>) : AbstractPlayerInputWithFeedback<E>() { class EnumInputWithFeedback<E : Enum<E>>(menu: MatteryMenu, clazz: Class<E>) : AbstractPlayerInputWithFeedback<E>() {
val codec = EnumValueCodec(clazz) val codec = EnumValueCodec(clazz)
private val default = codec.clazz.enumConstants!![0] private val default = codec.clazz.enumConstants!![0]

View File

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

View File

@ -55,6 +55,7 @@ object MBlockEntities {
val GRAVITATION_STABILIZER: BlockEntityType<GravitationStabilizerBlockEntity> by registry.register(MNames.GRAVITATION_STABILIZER) { BlockEntityType.Builder.of(::GravitationStabilizerBlockEntity, MBlocks.GRAVITATION_STABILIZER).build(null) } val GRAVITATION_STABILIZER: BlockEntityType<GravitationStabilizerBlockEntity> by registry.register(MNames.GRAVITATION_STABILIZER) { BlockEntityType.Builder.of(::GravitationStabilizerBlockEntity, MBlocks.GRAVITATION_STABILIZER).build(null) }
val MATTER_RECYCLER: BlockEntityType<MatterRecyclerBlockEntity> by registry.register(MNames.MATTER_RECYCLER) { BlockEntityType.Builder.of(::MatterRecyclerBlockEntity, MBlocks.MATTER_RECYCLER).build(null) } val MATTER_RECYCLER: BlockEntityType<MatterRecyclerBlockEntity> by registry.register(MNames.MATTER_RECYCLER) { BlockEntityType.Builder.of(::MatterRecyclerBlockEntity, MBlocks.MATTER_RECYCLER).build(null) }
val ENERGY_SERVO: BlockEntityType<EnergyServoBlockEntity> by registry.register(MNames.ENERGY_SERVO) { BlockEntityType.Builder.of(::EnergyServoBlockEntity, MBlocks.ENERGY_SERVO).build(null) } val ENERGY_SERVO: BlockEntityType<EnergyServoBlockEntity> by registry.register(MNames.ENERGY_SERVO) { BlockEntityType.Builder.of(::EnergyServoBlockEntity, MBlocks.ENERGY_SERVO).build(null) }
val COBBLESTONE_GENERATOR: BlockEntityType<CobblerBlockEntity> by registry.register(MNames.COBBLESTONE_GENERATOR) { BlockEntityType.Builder.of(::CobblerBlockEntity, MBlocks.COBBLESTONE_GENERATOR).build(null) }
val STORAGE_BUS: BlockEntityType<StorageBusBlockEntity> by registry.register(MNames.STORAGE_BUS) { BlockEntityType.Builder.of(::StorageBusBlockEntity, MBlocks.STORAGE_BUS).build(null) } val STORAGE_BUS: BlockEntityType<StorageBusBlockEntity> by registry.register(MNames.STORAGE_BUS) { BlockEntityType.Builder.of(::StorageBusBlockEntity, MBlocks.STORAGE_BUS).build(null) }
val STORAGE_IMPORTER: BlockEntityType<StorageImporterBlockEntity> by registry.register(MNames.STORAGE_IMPORTER) { BlockEntityType.Builder.of(::StorageImporterBlockEntity, MBlocks.STORAGE_IMPORTER).build(null) } val STORAGE_IMPORTER: BlockEntityType<StorageImporterBlockEntity> by registry.register(MNames.STORAGE_IMPORTER) { BlockEntityType.Builder.of(::StorageImporterBlockEntity, MBlocks.STORAGE_IMPORTER).build(null) }

View File

@ -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.StorageExporterBlock
import ru.dbotthepony.mc.otm.block.storage.StorageImporterBlock import ru.dbotthepony.mc.otm.block.storage.StorageImporterBlock
import ru.dbotthepony.mc.otm.block.storage.StoragePowerSupplierBlock import ru.dbotthepony.mc.otm.block.storage.StoragePowerSupplierBlock
import ru.dbotthepony.mc.otm.block.tech.CobblerBlock
import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent
object MBlocks { object MBlocks {
@ -84,6 +85,7 @@ object MBlocks {
val PLATE_PRESS: Block by registry.register(MNames.PLATE_PRESS) { PlatePressBlock() } val PLATE_PRESS: Block by registry.register(MNames.PLATE_PRESS) { PlatePressBlock() }
val MATTER_RECYCLER: Block by registry.register(MNames.MATTER_RECYCLER) { MatterRecyclerBlock() } val MATTER_RECYCLER: Block by registry.register(MNames.MATTER_RECYCLER) { MatterRecyclerBlock() }
val ENERGY_SERVO: Block by registry.register(MNames.ENERGY_SERVO) { EnergyServoBlock() } 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_BUS: Block by registry.register(MNames.STORAGE_BUS) { StorageBusBlock() }
val STORAGE_IMPORTER: Block by registry.register(MNames.STORAGE_IMPORTER) { StorageImporterBlock() } val STORAGE_IMPORTER: Block by registry.register(MNames.STORAGE_IMPORTER) { StorageImporterBlock() }

View File

@ -58,46 +58,31 @@ object MItems {
val GRAVITATION_STABILIZER: Item by registry.register(MNames.GRAVITATION_STABILIZER) { val GRAVITATION_STABILIZER: Item by registry.register(MNames.GRAVITATION_STABILIZER) {
object : BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) { object : BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) {
override fun appendHoverText( override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList<Component>, p_40575_: TooltipFlag) {
p_40572_: ItemStack,
p_40573_: Level?,
p_40574_: MutableList<Component>,
p_40575_: TooltipFlag
) {
super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) 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("${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}.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}.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) { val PHANTOM_ATTRACTOR: Item by registry.register(MNames.PHANTOM_ATTRACTOR) {
object : DoubleHighBlockItem(MBlocks.PHANTOM_ATTRACTOR, DEFAULT_PROPERTIES) { object : DoubleHighBlockItem(MBlocks.PHANTOM_ATTRACTOR, DEFAULT_PROPERTIES) {
override fun appendHoverText( override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList<Component>, p_40575_: TooltipFlag) {
p_40572_: ItemStack,
p_40573_: Level?,
p_40574_: MutableList<Component>,
p_40575_: TooltipFlag
) {
super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) 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}.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) { val ENERGY_SERVO: Item by registry.register(MNames.ENERGY_SERVO) {
object : BlockItem(MBlocks.ENERGY_SERVO, DEFAULT_PROPERTIES) { object : BlockItem(MBlocks.ENERGY_SERVO, DEFAULT_PROPERTIES) {
override fun appendHoverText( override fun appendHoverText(p_40572_: ItemStack, p_40573_: Level?, p_40574_: MutableList<Component>, p_40575_: TooltipFlag) {
p_40572_: ItemStack,
p_40573_: Level?,
p_40574_: MutableList<Component>,
p_40575_: TooltipFlag
) {
super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_) super.appendHoverText(p_40572_, p_40573_, p_40574_, p_40575_)
p_40574_.add(TranslatableComponent("${MBlocks.ENERGY_SERVO.descriptionId}.desc").withStyle(ChatFormatting.GRAY)) 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<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 MACHINES = SupplierList( val MACHINES = SupplierList(
::ANDROID_STATION, ::BATTERY_BANK, ::MATTER_DECOMPOSER, ::MATTER_CAPACITOR_BANK, ::MATTER_CABLE, ::PATTERN_STORAGE, ::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, ::MATTER_SCANNER, ::MATTER_PANEL, ::MATTER_REPLICATOR, ::MATTER_BOTTLER, ::ENERGY_COUNTER, ::CHEMICAL_GENERATOR,
::PLATE_PRESS, ::MATTER_RECYCLER, ::STORAGE_BUS, ::STORAGE_IMPORTER, ::STORAGE_EXPORTER, ::DRIVE_VIEWER, ::PLATE_PRESS, ::MATTER_RECYCLER, ::STORAGE_BUS, ::STORAGE_IMPORTER, ::STORAGE_EXPORTER, ::DRIVE_VIEWER,
::DRIVE_RACK, ::ITEM_MONITOR, ::STORAGE_CABLE, ::STORAGE_POWER_SUPPLIER, ::ENERGY_SERVO, ::DRIVE_RACK, ::ITEM_MONITOR, ::STORAGE_CABLE, ::STORAGE_POWER_SUPPLIER, ::ENERGY_SERVO,
::PHANTOM_ATTRACTOR, ::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)) } val DEBUG_EXPLOSION_SMALL: Item by registry.register(MNames.DEBUG_EXPLOSION_SMALL) { BlockItem(MBlocks.DEBUG_EXPLOSION_SMALL, Item.Properties().stacksTo(64)) }

View File

@ -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.AndroidStationScreen
import ru.dbotthepony.mc.otm.client.screen.tech.BatteryBankScreen 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.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.EnergyCounterScreen
import ru.dbotthepony.mc.otm.client.screen.tech.EnergyServoScreen import ru.dbotthepony.mc.otm.client.screen.tech.EnergyServoScreen
import ru.dbotthepony.mc.otm.client.screen.tech.PlatePressScreen 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.AndroidStationMenu
import ru.dbotthepony.mc.otm.menu.tech.BatteryBankMenu import ru.dbotthepony.mc.otm.menu.tech.BatteryBankMenu
import ru.dbotthepony.mc.otm.menu.tech.ChemicalGeneratorMenu 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.EnergyCounterMenu
import ru.dbotthepony.mc.otm.menu.tech.EnergyServoMenu import ru.dbotthepony.mc.otm.menu.tech.EnergyServoMenu
import ru.dbotthepony.mc.otm.menu.tech.PlatePressMenu 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 MATTER_RECYCLER: MenuType<*> by registry.register(MNames.MATTER_RECYCLER) { MenuType(::MatterRecyclerMenu) }
val ENERGY_SERVO: MenuType<*> by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu) } val ENERGY_SERVO: MenuType<*> by registry.register(MNames.ENERGY_SERVO) { MenuType(::EnergyServoMenu) }
val HOLO_SIGN: MenuType<HoloSignMenu> by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu) } val HOLO_SIGN: MenuType<HoloSignMenu> by registry.register(MNames.HOLO_SIGN) { MenuType(::HoloSignMenu) }
val COBBLESTONE_GENERATOR: MenuType<CobblerMenu> by registry.register(MNames.COBBLESTONE_GENERATOR) { MenuType(::CobblerMenu) }
val STORAGE_BUS: MenuType<*> by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu) } val STORAGE_BUS: MenuType<*> by registry.register(MNames.STORAGE_BUS) { MenuType(::StorageBusMenu) }
val STORAGE_EXPORTER: MenuType<*> by registry.register(MNames.STORAGE_EXPORTER) { MenuType(::StorageExporterMenu) } 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<StoragePowerSupplierMenu>, ::StoragePowerSupplierScreen) MenuScreens.register(STORAGE_POWER_SUPPLIER as MenuType<StoragePowerSupplierMenu>, ::StoragePowerSupplierScreen)
MenuScreens.register(ENERGY_SERVO as MenuType<EnergyServoMenu>, ::EnergyServoScreen) MenuScreens.register(ENERGY_SERVO as MenuType<EnergyServoMenu>, ::EnergyServoScreen)
MenuScreens.register(HOLO_SIGN, ::HoloSignScreen) MenuScreens.register(HOLO_SIGN, ::HoloSignScreen)
MenuScreens.register(COBBLESTONE_GENERATOR, ::CobblerScreen)
} }
} }
} }

View File

@ -31,6 +31,7 @@ object MNames {
const val PLATE_PRESS = "plate_press" const val PLATE_PRESS = "plate_press"
const val MATTER_RECYCLER = "matter_recycler" const val MATTER_RECYCLER = "matter_recycler"
const val ENERGY_SERVO = "energy_servo" const val ENERGY_SERVO = "energy_servo"
const val COBBLESTONE_GENERATOR = "cobblestone_generator"
const val STORAGE_CABLE = "storage_cable" // нужен рецепт const val STORAGE_CABLE = "storage_cable" // нужен рецепт
const val STORAGE_POWER_SUPPLIER = "storage_power_supplier" // нужен рецепт const val STORAGE_POWER_SUPPLIER = "storage_power_supplier" // нужен рецепт