diff --git a/src/main/java/ru/dbotthepony/mc/otm/block/BlockMatterCable.java b/src/main/java/ru/dbotthepony/mc/otm/block/BlockMatterCable.java deleted file mode 100644 index e9083d77a..000000000 --- a/src/main/java/ru/dbotthepony/mc/otm/block/BlockMatterCable.java +++ /dev/null @@ -1,181 +0,0 @@ -package ru.dbotthepony.mc.otm.block; - -import com.google.common.collect.ImmutableMap; -import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; -import net.minecraft.world.phys.shapes.BooleanOp; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; -import ru.dbotthepony.mc.otm.block.entity.MatterCableBlockEntity; - -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.ArrayList; - -@MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault -public class BlockMatterCable extends Block implements EntityBlock { - @Nullable - @Override - public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) { - return new MatterCableBlockEntity(blockPos, blockState); - } - - public static final BooleanProperty CONNECTION_SOUTH = BooleanProperty.create("connect_south"); - public static final BooleanProperty CONNECTION_WEST = BooleanProperty.create("connect_west"); - public static final BooleanProperty CONNECTION_EAST = BooleanProperty.create("connect_east"); - public static final BooleanProperty CONNECTION_NORTH = BooleanProperty.create("connect_north"); - public static final BooleanProperty CONNECTION_UP = BooleanProperty.create("connect_up"); - public static final BooleanProperty CONNECTION_DOWN = BooleanProperty.create("connect_down"); - - public static final BooleanProperty[] MAPPING_CONNECTION_PROP = new BooleanProperty[] { - CONNECTION_DOWN, - CONNECTION_UP, - CONNECTION_NORTH, - CONNECTION_SOUTH, - CONNECTION_WEST, - CONNECTION_EAST - }; - - protected ImmutableMap SHAPES; - - public BlockMatterCable() { - super(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.METAL).requiresCorrectToolForDrops().strength(1.0F, 6.0F)); - registerDefaultState( - this.defaultBlockState() - .setValue(CONNECTION_DOWN, false) - .setValue(CONNECTION_UP, false) - .setValue(CONNECTION_NORTH, false) - .setValue(CONNECTION_SOUTH, false) - .setValue(CONNECTION_WEST, false) - .setValue(CONNECTION_EAST, false) - ); - - SHAPES = getShapeForEachState((state) -> { - ArrayList shapes = new ArrayList<>(); - - if (state.getValue(CONNECTION_SOUTH)) { - shapes.add(Shapes.box( - 0.5 - 0.15, - 0.5 - 0.15, - 0.65, - - 0.5 + 0.15, - 0.5 + 0.15, - 1 - )); - } - - if (state.getValue(CONNECTION_NORTH)) { - shapes.add(Shapes.box( - 0.5 - 0.15, - 0.5 - 0.15, - 0, - - 0.5 + 0.15, - 0.5 + 0.15, - 0.35 - )); - } - - if (state.getValue(CONNECTION_DOWN)) { - shapes.add(Shapes.box( - 0.5 - 0.15, - 0, - 0.5 - 0.15, - - 0.5 + 0.15, - 0.5 - 0.15, - 0.5 + 0.15 - )); - } - - if (state.getValue(CONNECTION_UP)) { - shapes.add(Shapes.box( - 0.5 - 0.15, - 0.5 - 0.15, - 0.5 - 0.15, - - 0.5 + 0.15, - 1, - 0.5 + 0.15 - )); - } - - if (state.getValue(CONNECTION_EAST)) { - shapes.add(Shapes.box( - 0.65, - 0.5 - 0.15, - 0.5 - 0.15, - - 1, - 0.5 + 0.15, - 0.5 + 0.15 - )); - } - - if (state.getValue(CONNECTION_WEST)) { - shapes.add(Shapes.box( - 0, - 0.5 - 0.15, - 0.5 - 0.15, - - 0.35, - 0.5 + 0.15, - 0.5 + 0.15 - )); - } - - VoxelShape final_shape = CORE_SHAPE; - - for (VoxelShape add_shape : shapes) { - final_shape = Shapes.joinUnoptimized(final_shape, add_shape, BooleanOp.OR); - } - - return final_shape; - }); - } - - private final VoxelShape CORE_SHAPE = Shapes.box( - 0.5 - 0.15, - 0.5 - 0.15, - 0.5 - 0.15, - - 0.5 + 0.15, - 0.5 + 0.15, - 0.5 + 0.15 - ); - - @Override - @SuppressWarnings("deprecation") - public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) { - VoxelShape get = SHAPES.get(p_60555_); - return get != null ? get : CORE_SHAPE; - } - - @Override - public boolean hasDynamicShape() { - return true; - } - - @Override - protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(CONNECTION_SOUTH, - CONNECTION_WEST, - CONNECTION_EAST, - CONNECTION_NORTH, - CONNECTION_UP, - CONNECTION_DOWN); - } -} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/Cables.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/Cables.kt new file mode 100644 index 000000000..bac1c4db3 --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/Cables.kt @@ -0,0 +1,182 @@ +package ru.dbotthepony.mc.otm.block + +import net.minecraft.core.BlockPos +import net.minecraft.world.level.BlockGetter +import net.minecraft.world.level.block.Block +import net.minecraft.world.level.block.EntityBlock +import net.minecraft.world.level.block.entity.BlockEntity +import net.minecraft.world.level.block.state.BlockState +import net.minecraft.world.level.block.state.StateDefinition +import net.minecraft.world.level.block.state.properties.BooleanProperty +import net.minecraft.world.level.material.Material +import net.minecraft.world.level.material.MaterialColor +import net.minecraft.world.phys.shapes.BooleanOp +import net.minecraft.world.phys.shapes.CollisionContext +import net.minecraft.world.phys.shapes.Shapes +import net.minecraft.world.phys.shapes.VoxelShape +import ru.dbotthepony.mc.otm.block.entity.MatterCableBlockEntity +import ru.dbotthepony.mc.otm.block.entity.StorageCableBlockEntity + +abstract class CableBlock(properties: Properties) : Block(properties) { + private val shapes = getShapeForEachState { + val shapes = ArrayList() + + if (it.getValue(CONNECTION_SOUTH)) { + shapes.add( + Shapes.box( + 0.5 - 0.15, + 0.5 - 0.15, + 0.65, + 0.5 + 0.15, + 0.5 + 0.15, 1.0 + ) + ) + } + + if (it.getValue(CONNECTION_NORTH)) { + shapes.add( + Shapes.box( + 0.5 - 0.15, + 0.5 - 0.15, 0.0, + 0.5 + 0.15, + 0.5 + 0.15, + 0.35 + ) + ) + } + + if (it.getValue(CONNECTION_DOWN)) { + shapes.add( + Shapes.box( + 0.5 - 0.15, 0.0, + 0.5 - 0.15, + 0.5 + 0.15, + 0.5 - 0.15, + 0.5 + 0.15 + ) + ) + } + + if (it.getValue(CONNECTION_UP)) { + shapes.add( + Shapes.box( + 0.5 - 0.15, + 0.5 - 0.15, + 0.5 - 0.15, + 0.5 + 0.15, 1.0, + 0.5 + 0.15 + ) + ) + } + + if (it.getValue(CONNECTION_EAST)) { + shapes.add( + Shapes.box( + 0.65, + 0.5 - 0.15, + 0.5 - 0.15, 1.0, + 0.5 + 0.15, + 0.5 + 0.15 + ) + ) + } + if (it.getValue(CONNECTION_WEST)) { + shapes.add( + Shapes.box( + 0.0, + 0.5 - 0.15, + 0.5 - 0.15, + 0.35, + 0.5 + 0.15, + 0.5 + 0.15 + ) + ) + } + + var finalShape = CORE_SHAPE + + for (add_shape in shapes) { + finalShape = Shapes.joinUnoptimized(finalShape, add_shape, BooleanOp.OR) + } + + return@getShapeForEachState finalShape + } + + init { + registerDefaultState(defaultBlockState() + .setValue(CONNECTION_SOUTH, false) + .setValue(CONNECTION_WEST, false) + .setValue(CONNECTION_EAST, false) + .setValue(CONNECTION_NORTH, false) + .setValue(CONNECTION_UP, false) + .setValue(CONNECTION_DOWN, false)) + } + + @Suppress("OVERRIDE_DEPRECATION") + override fun getShape( + p_60555_: BlockState, + p_60556_: BlockGetter, + p_60557_: BlockPos, + p_60558_: CollisionContext + ): VoxelShape { + return shapes[p_60555_] ?: CORE_SHAPE + } + + override fun hasDynamicShape() = true + + override fun createBlockStateDefinition(builder: StateDefinition.Builder) { + builder.add( + CONNECTION_SOUTH, + CONNECTION_WEST, + CONNECTION_EAST, + CONNECTION_NORTH, + CONNECTION_UP, + CONNECTION_DOWN + ) + } + + companion object { + protected val CORE_SHAPE: VoxelShape = Shapes.box( + 0.5 - 0.15, + 0.5 - 0.15, + 0.5 - 0.15, + 0.5 + 0.15, + 0.5 + 0.15, + 0.5 + 0.15 + ) + + val CONNECTION_SOUTH: BooleanProperty = BooleanProperty.create("connect_south") + val CONNECTION_WEST: BooleanProperty = BooleanProperty.create("connect_west") + val CONNECTION_EAST: BooleanProperty = BooleanProperty.create("connect_east") + val CONNECTION_NORTH: BooleanProperty = BooleanProperty.create("connect_north") + val CONNECTION_UP: BooleanProperty = BooleanProperty.create("connect_up") + val CONNECTION_DOWN: BooleanProperty = BooleanProperty.create("connect_down") + + val MAPPING_CONNECTION_PROP = listOf( + CONNECTION_DOWN, + CONNECTION_UP, + CONNECTION_NORTH, + CONNECTION_SOUTH, + CONNECTION_WEST, + CONNECTION_EAST + ) + } +} + +class MatterCableBlock : CableBlock( + Properties.of(Material.STONE, MaterialColor.METAL).requiresCorrectToolForDrops().strength(1.0f, 6.0f)), + EntityBlock { + + override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity { + return MatterCableBlockEntity(blockPos, blockState) + } +} + +class StorageCableBlock : CableBlock( + Properties.of(Material.STONE, MaterialColor.METAL).requiresCorrectToolForDrops().strength(1.0f, 6.0f)), + EntityBlock { + + override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity { + return StorageCableBlockEntity(blockPos, blockState) + } +} diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/Cables.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/Cables.kt new file mode 100644 index 000000000..4eca753bb --- /dev/null +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/Cables.kt @@ -0,0 +1,127 @@ +package ru.dbotthepony.mc.otm.block.entity + +import net.minecraft.core.BlockPos +import net.minecraft.core.Direction +import net.minecraft.server.level.ServerLevel +import net.minecraft.world.level.Level +import net.minecraft.world.level.block.Block +import net.minecraft.world.level.block.entity.BlockEntity +import net.minecraft.world.level.block.state.BlockState +import net.minecraftforge.common.capabilities.Capability +import net.minecraftforge.common.util.LazyOptional +import ru.dbotthepony.mc.otm.block.CableBlock +import ru.dbotthepony.mc.otm.capability.MatteryCapability +import ru.dbotthepony.mc.otm.graph.Graph6Node +import ru.dbotthepony.mc.otm.graph.GraphNodeListener +import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode +import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph +import ru.dbotthepony.mc.otm.graph.storage.IStorageGraphNode +import ru.dbotthepony.mc.otm.graph.storage.StorageNetworkGraph +import ru.dbotthepony.mc.otm.registry.MBlockEntities + +class MatterCableBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : + BlockEntity(MBlockEntities.MATTER_CABLE, p_155229_, p_155230_), IMatterGraphNode, GraphNodeListener { + + private var valid = true + override val matterNode = Graph6Node(this) + private val resolverNode = LazyOptional.of { this } + + override fun invalidateCaps() { + super.invalidateCaps() + valid = false + } + + override fun reviveCaps() { + super.reviveCaps() + valid = true + } + + override fun getCapability(cap: Capability, side: Direction?): LazyOptional { + if (valid) { + if (cap === MatteryCapability.MATTER_NODE) + return resolverNode.cast() + } + + return super.getCapability(cap, side) + } + + override fun setLevel(p_155231_: Level) { + super.setLevel(p_155231_) + + if (p_155231_ is ServerLevel) + MatterNetworkGraph.discoverFull(this, matterNode) + } + + override fun onNeighbour(node: Graph6Node<*>, direction: Direction) { + val newState = blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction.ordinal], true) + if (newState !== blockState) level!!.setBlock(blockPos, newState, Block.UPDATE_CLIENTS) + } + + override fun onUnNeighbour(node: Graph6Node<*>, direction: Direction) { + val newState = blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction.ordinal], false) + if (newState !== blockState) level!!.setBlock(blockPos, newState, Block.UPDATE_CLIENTS) + } + + override fun setRemoved() { + super.setRemoved() + matterNode.destroy(::MatterNetworkGraph) + } +} + +class StorageCableBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : + BlockEntity(MBlockEntities.MATTER_CABLE, p_155229_, p_155230_), IStorageGraphNode, GraphNodeListener { + + private var valid = true + private val resolverNode = LazyOptional.of { this } + + override fun attachComponents(to: StorageNetworkGraph) {} + override fun removeComponents(from: StorageNetworkGraph) {} + override val storageNode = Graph6Node(this) + + override fun invalidateCaps() { + super.invalidateCaps() + valid = false + } + + override fun reviveCaps() { + super.reviveCaps() + valid = true + } + + override fun getCapability(cap: Capability, side: Direction?): LazyOptional { + if (valid) { + if (cap === MatteryCapability.STORAGE_NODE) + return resolverNode.cast() + } + + return super.getCapability(cap, side) + } + + override fun setLevel(p_155231_: Level) { + super.setLevel(p_155231_) + + if (p_155231_ is ServerLevel) + StorageNetworkGraph.discoverFull(this, storageNode) + } + + override fun onNeighbour(node: Graph6Node<*>, direction: Direction) { + val newState = blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction.ordinal], true) + if (newState !== blockState) level!!.setBlock(blockPos, newState, Block.UPDATE_CLIENTS) + } + + override fun onUnNeighbour(node: Graph6Node<*>, direction: Direction) { + val newState = blockState.setValue(CableBlock.MAPPING_CONNECTION_PROP[direction.ordinal], false) + if (newState !== blockState) level!!.setBlock(blockPos, newState, Block.UPDATE_CLIENTS) + } + + override fun setRemoved() { + super.setRemoved() + + val level = level!! + + storageNode.destroy { + StorageNetworkGraph(level) + } + } +} + diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterBottlerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterBottlerBlockEntity.kt index 19ede33ba..7a496ab2b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterBottlerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterBottlerBlockEntity.kt @@ -37,14 +37,10 @@ import ru.dbotthepony.mc.otm.set class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryPoweredBlockEntity(MBlockEntities.MATTER_BOTTLER, p_155229_, p_155230_), IMatterGraphNode { - private val node = Graph6Node(this) + override val matterNode = Graph6Node(this) private val resolverNode = LazyOptional.of { this } override val energy = WorkerEnergyStorage(this) - override fun getAsMatterNode(): Graph6Node { - return node - } - // true - bottling // false - unbottling var workFlow: Boolean = true @@ -125,7 +121,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : super.setLevel(p_155231_) if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) + MatterNetworkGraph.discoverFull(this, matterNode) } private var valid = true @@ -205,7 +201,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : override fun setRemoved() { super.setRemoved() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } fun tick() { @@ -254,7 +250,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : initialCapacity = capability!!.storedMatter } - val graph = node.graph as MatterNetworkGraph? + val graph = matterNode.graph as MatterNetworkGraph? if (capability != null) { if (blockState.getValue(WorkerState.SEMI_WORKER_STATE) !== WorkerState.WORKING) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterCableBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterCableBlockEntity.kt deleted file mode 100644 index 533783b08..000000000 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterCableBlockEntity.kt +++ /dev/null @@ -1,71 +0,0 @@ -package ru.dbotthepony.mc.otm.block.entity - -import net.minecraft.core.BlockPos -import net.minecraft.core.Direction -import net.minecraft.server.level.ServerLevel -import net.minecraft.world.level.Level -import net.minecraft.world.level.block.Block -import net.minecraft.world.level.block.entity.BlockEntity -import net.minecraft.world.level.block.state.BlockState -import net.minecraftforge.common.capabilities.Capability -import net.minecraftforge.common.util.LazyOptional -import ru.dbotthepony.mc.otm.block.BlockMatterCable -import ru.dbotthepony.mc.otm.capability.MatteryCapability -import ru.dbotthepony.mc.otm.graph.Graph6Node -import ru.dbotthepony.mc.otm.graph.GraphNodeListener -import ru.dbotthepony.mc.otm.graph.matter.IMatterGraphNode -import ru.dbotthepony.mc.otm.graph.matter.MatterNetworkGraph -import ru.dbotthepony.mc.otm.registry.MBlockEntities - -class MatterCableBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : - BlockEntity(MBlockEntities.MATTER_CABLE, p_155229_, p_155230_), IMatterGraphNode, GraphNodeListener { - - private var valid = true - private val node = Graph6Node(this) - private val resolverNode = LazyOptional.of { this } - - override fun getAsMatterNode(): Graph6Node { - return node - } - - override fun invalidateCaps() { - super.invalidateCaps() - valid = false - } - - override fun reviveCaps() { - super.reviveCaps() - valid = true - } - - override fun getCapability(cap: Capability, side: Direction?): LazyOptional { - if (valid) { - if (cap === MatteryCapability.MATTER_NODE) - return resolverNode.cast() - } - - return super.getCapability(cap, side) - } - - override fun setLevel(p_155231_: Level) { - super.setLevel(p_155231_) - - if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) - } - - override fun onNeighbour(node: Graph6Node<*>, direction: Direction) { - val new_state = blockState.setValue(BlockMatterCable.MAPPING_CONNECTION_PROP[direction.ordinal], true) - if (new_state !== blockState) level!!.setBlock(blockPos, new_state, Block.UPDATE_CLIENTS) - } - - override fun onUnNeighbour(node: Graph6Node<*>, direction: Direction) { - val new_state = blockState.setValue(BlockMatterCable.MAPPING_CONNECTION_PROP[direction.ordinal], false) - if (new_state !== blockState) level!!.setBlock(blockPos, new_state, Block.UPDATE_CLIENTS) - } - - override fun setRemoved() { - super.setRemoved() - node.destroy(::MatterNetworkGraph) - } -} \ No newline at end of file diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterCapacitorBankBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterCapacitorBankBlockEntity.kt index 493affe74..b6b888b76 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterCapacitorBankBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterCapacitorBankBlockEntity.kt @@ -35,13 +35,9 @@ import javax.annotation.ParametersAreNonnullByDefault class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(MBlockEntities.MATTER_CAPACITOR_BANK, p_155229_, p_155230_), IMatterGraphNode, IMatterHandler { - private val node = Graph6Node(this) + override val matterNode = Graph6Node(this) private val resolverNode = LazyOptional.of { this } - override fun getAsMatterNode(): Graph6Node { - return node - } - override val storedMatter: ImpreciseFraction get() { var summ = ImpreciseFraction.ZERO @@ -190,14 +186,14 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) override fun setRemoved() { super.setRemoved() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } override fun setLevel(p_155231_: Level) { super.setLevel(p_155231_) if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) + MatterNetworkGraph.discoverFull(this, matterNode) } override fun getMatterHandler(): IMatterHandler { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterDecomposerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterDecomposerBlockEntity.kt index 38a4310d8..a4b28fe88 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterDecomposerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterDecomposerBlockEntity.kt @@ -97,11 +97,7 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) override val energy = WorkerEnergyStorage(this, ENERGY_STORAGE, MAX_IO) private var valid = true - private val node = Graph6Node(this) - - override fun getAsMatterNode(): Graph6Node { - return node - } + override val matterNode = Graph6Node(this) @JvmField val matter = MatterHandlerImpl( @@ -218,14 +214,14 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) override fun setRemoved() { super.setRemoved() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } override fun setLevel(p_155231_: Level) { super.setLevel(p_155231_) if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) + MatterNetworkGraph.discoverFull(this, matterNode) } override fun getMatterHandler(): IMatterHandler { @@ -236,7 +232,7 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState) batteryChargeLoop() workerLoop() - val grid = node.graph as MatterNetworkGraph? ?: return + val grid = matterNode.graph as MatterNetworkGraph? ?: return if (!matter.storedMatter.isZero) { val diff = matter.extractMatterInner(matter.storedMatter, true) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterPanelBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterPanelBlockEntity.kt index 4b912f6ee..d30a6ca39 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterPanelBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterPanelBlockEntity.kt @@ -35,11 +35,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(MBlockEntities.MATTER_PANEL, p_155229_, p_155230_), IMatterGraphNode, IMatterTaskProvider { private val listeners = ArrayList() - private val node = Graph6Node(this) - - override fun getAsMatterNode(): Graph6Node { - return node - } + override val matterNode = Graph6Node(this) fun attachMenu(menu: MatterPanelMenu) { listeners.add(menu) @@ -83,12 +79,12 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : super.setLevel(p_155231_) if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) + MatterNetworkGraph.discoverFull(this, matterNode) } override fun setRemoved() { super.setRemoved() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } override fun getTaskHandler(): IMatterTaskProvider? { @@ -106,7 +102,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } override fun allocateTask(simulate: Boolean): MatterTaskAllocation? { - val graph = node.graph as MatterNetworkGraph? ?: return null + val graph = matterNode.graph as MatterNetworkGraph? ?: return null for ((key, task) in _tasks) { if (task.required > 0) { @@ -134,7 +130,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val oldTask = localTask localTask = localTask.shrinkInProgress(1) - val graph = node.graph as MatterNetworkGraph? + val graph = matterNode.graph as MatterNetworkGraph? // Задача полностью выполнена if (localTask.required <= 0 && localTask.in_progress <= 0) { @@ -186,7 +182,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val task = _tasks[id] ?: return _tasks.remove(id) - (node.graph as MatterNetworkGraph?)?.onMatterTaskRemoved(task) + (matterNode.graph as MatterNetworkGraph?)?.onMatterTaskRemoved(task) listeners.forEach { menu: MatterPanelMenu -> menu.taskRemoved(task) } setChanged() @@ -198,7 +194,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val task = MatterTask(UUID.randomUUID(), state.id, state.item, 0, 0, how_much) _tasks[task.id()] = task - (node.graph as MatterNetworkGraph?)?.onMatterTaskCreated(task) + (matterNode.graph as MatterNetworkGraph?)?.onMatterTaskCreated(task) listeners.forEach { menu: MatterPanelMenu -> menu.taskUpdated(task) } setChanged() @@ -207,7 +203,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } override fun dropAllTasks() { - val graph = node.graph as MatterNetworkGraph? + val graph = matterNode.graph as MatterNetworkGraph? for (task in _tasks.values) { graph?.onMatterTaskRemoved(task) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterRecyclerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterRecyclerBlockEntity.kt index e49d8be0c..5daca68a6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterRecyclerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterRecyclerBlockEntity.kt @@ -38,21 +38,19 @@ import ru.dbotthepony.mc.otm.set class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryWorkerBlockEntity(MBlockEntities.MATTER_RECYCLER, blockPos, blockState), IMatterGraphNode { + val matter = MatterHandlerImpl( this::setChangedLight, MatterDirection.EXTRACT, STORAGE ) + val container = MatteryContainer(this::setChangedLight, 1) - private val node = Graph6Node(this) + override val matterNode = Graph6Node(this) private var resolverNode = LazyOptional.of { this } private var valid = true override val energy = WorkerEnergyStorage(this, MAX_POWER) - override fun getAsMatterNode(): Graph6Node { - return node - } - override fun getMatterHandler(): IMatterHandler { return matter } @@ -83,14 +81,14 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) override fun setRemoved() { super.setRemoved() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } override fun setLevel(p_155231_: Level) { super.setLevel(p_155231_) if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) + MatterNetworkGraph.discoverFull(this, matterNode) } override fun saveAdditional(nbt: CompoundTag) { @@ -167,7 +165,7 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) fun tick() { basicTicker() - val graph = node.graph as MatterNetworkGraph? ?: return + val graph = matterNode.graph as MatterNetworkGraph? ?: return val received = graph.receiveMatter(matter.storedMatter, false) if (!received.isZero) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterReplicatorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterReplicatorBlockEntity.kt index 9e3bc61f5..e72a98cab 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterReplicatorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterReplicatorBlockEntity.kt @@ -38,13 +38,9 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryWorkerBlockEntity(MBlockEntities.MATTER_REPLICATOR, p_155229_, p_155230_), IMatterGraphNode { override val energy = WorkerEnergyStorage(this, STORAGE, MAX_IO) - private val node = Graph6Node(this) + override val matterNode = Graph6Node(this) private val resolverNode = LazyOptional.of { this } - override fun getAsMatterNode(): Graph6Node { - return node - } - @JvmField val matter = MatterHandlerImpl( this::setChangedLight, @@ -73,7 +69,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : return WorkerJobStatus(false, 20) } - (node.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!) + (matterNode.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!) return WorkerJobStatus() } @@ -82,7 +78,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : return WorkerJobStatus(false, 20) } - (node.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!) + (matterNode.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!) return WorkerJobStatus() } @@ -100,18 +96,18 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : override fun setRemoved() { super.setRemoved() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } override fun setLevel(p_155231_: Level) { super.setLevel(p_155231_) if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) + MatterNetworkGraph.discoverFull(this, matterNode) } override fun computeNextJob(): WorkerJob? { - val graph = node.graph as MatterNetworkGraph? ?: return null + val graph = matterNode.graph as MatterNetworkGraph? ?: return null val allocation = graph.allocateTask(false) ?: return null val stack = allocation.task.stack(1) val matter = getMatterValue(stack) @@ -136,7 +132,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : override fun onWorkTick(context: WorkerTickContext): WorkerJobStatus { val drainPerTick = ImpreciseFraction.deserializeNBT(context.job.data["matter_per_tick"]) - val graph = node.graph as MatterNetworkGraph? ?: return WorkerJobStatus(false, 20) + val graph = matterNode.graph as MatterNetworkGraph? ?: return WorkerJobStatus(false, 20) if (matter.extractMatterInner(drainPerTick, true) < drainPerTick) { // в машине недостаточно материи diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterScannerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterScannerBlockEntity.kt index 56cba3cdf..eac41d222 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterScannerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatterScannerBlockEntity.kt @@ -42,10 +42,6 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : ) // IMatterGraphNode - override fun getAsMatterNode(): Graph6Node { - return matterNode - } - override fun onPatternAdded(state: PatternState) { isIdling = false } @@ -60,7 +56,7 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : // /IMatterGraphNode private var valid = true - private val matterNode: Graph6Node = Graph6Node(this) + override val matterNode: Graph6Node = Graph6Node(this) private var resolverNode = LazyOptional.of { this } override fun getCapability(cap: Capability, side: Direction?): LazyOptional { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PatternStorageBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PatternStorageBlockEntity.kt index cbc1e06d1..09958bba5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PatternStorageBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/PatternStorageBlockEntity.kt @@ -36,14 +36,14 @@ import java.util.ArrayList class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : MatteryBlockEntity(MBlockEntities.PATTERN_STORAGE, p_155229_, p_155230_), IMatterGraphNode, IPatternStorage { - private val node = Graph6Node(this) + override val matterNode = Graph6Node(this) private val resolverPatterns = LazyOptional.of { this } private val resolverNode = LazyOptional.of { this } @JvmField val patterns: MatteryContainer = object : MatteryContainer(this::setChanged, 8) { override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) { - val grid = node.graph as MatterNetworkGraph? + val grid = matterNode.graph as MatterNetworkGraph? if (grid != null && !ItemStack.isSameItemSameTags(new, old)) { if (!old.isEmpty) { @@ -106,11 +106,7 @@ class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : super.setLevel(p_155231_) if (p_155231_ is ServerLevel) - MatterNetworkGraph.discoverFull(this, node) - } - - override fun getAsMatterNode(): Graph6Node { - return node + MatterNetworkGraph.discoverFull(this, matterNode) } override fun getPatternHandler(): IPatternStorage { @@ -123,7 +119,7 @@ class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : super.invalidateCaps() valid = false resolverItem.invalidate() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } override fun reviveCaps() { @@ -175,7 +171,7 @@ class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : override fun setRemoved() { super.setRemoved() - node.destroy(::MatterNetworkGraph) + matterNode.destroy(::MatterNetworkGraph) } override fun insertPattern(pattern: PatternState, only_update: Boolean, simulate: Boolean): PatternInsertStatus { @@ -186,7 +182,7 @@ class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : if (!simulate) { setChanged() - val graph = node.graph as MatterNetworkGraph? + val graph = matterNode.graph as MatterNetworkGraph? if (graph != null) { if (status.isInserted) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/IMatterGraphNode.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/IMatterGraphNode.kt index ea1ef6303..7ae1750aa 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/IMatterGraphNode.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/IMatterGraphNode.kt @@ -18,6 +18,7 @@ interface IMatterGraphNode : IMatterGraphListener { fun getMatterHandler(): IMatterHandler? = null fun getPatternHandler(): IPatternStorage? = null fun getTaskHandler(): IMatterTaskProvider? = null - fun getAsMatterNode(): Graph6Node - fun getAsMatterGraph(): MatterNetworkGraph? = getAsMatterNode().graph as MatterNetworkGraph? + + val matterNode: Graph6Node + val matterGraph: MatterNetworkGraph? get() = matterNode.graph as MatterNetworkGraph? } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt index 9b1efecf8..072320ba4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/graph/matter/MatterNetworkGraph.kt @@ -382,7 +382,7 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe val resolve = _tile.getCapability(MatteryCapability.MATTER_NODE) return if (resolve.isPresent) { - resolve.resolve().get().getAsMatterNode() + resolve.resolve().get().matterNode } else { null } @@ -404,7 +404,7 @@ class MatterNetworkGraph : Abstract6Graph(), IMatterGraphListe val resolve = _tile.getCapability(MatteryCapability.MATTER_NODE) return if (resolve.isPresent) { - resolve.resolve().get().getAsMatterNode() + resolve.resolve().get().matterNode } else { null } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt index 1af84b9f7..8850047d3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterCapacitorBankMenu.kt @@ -26,9 +26,9 @@ class MatterCapacitorBankMenu @JvmOverloads constructor( } else { matterGauge = LevelGaugeWidget(this, tile) totalMatterGauge = LevelGaugeWidget(this, { - (tile.getAsMatterNode().graph as MatterNetworkGraph?)?.getMatterStorageLevel() ?: ImpreciseFraction.ZERO + tile.matterGraph?.getMatterStorageLevel() ?: ImpreciseFraction.ZERO }, { - (tile.getAsMatterNode().graph as MatterNetworkGraph?)?.getMatterStorageMaxLevel() ?: ImpreciseFraction.ZERO + tile.matterGraph?.getMatterStorageMaxLevel() ?: ImpreciseFraction.ZERO }) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterPanelMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterPanelMenu.kt index 16a5ee1be..e766a5c75 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterPanelMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterPanelMenu.kt @@ -99,7 +99,7 @@ class MatterPanelMenu @JvmOverloads constructor( fun requestReplication(ply: ServerPlayer, state: PatternState, how_much: Int) { val tile = tile as MatterPanelBlockEntity? ?: return - val graph = tile.getAsMatterNode().graph as MatterNetworkGraph? ?: return + val graph = tile.matterGraph ?: return if (graph.getPattern(state) == null) { OverdriveThatMatters.LOGGER.error("Received replication request from {} of {}, but it is no longer in grid", ply, state) @@ -135,7 +135,7 @@ class MatterPanelMenu @JvmOverloads constructor( init { if (tile != null) { - listeningGrid = tile.getAsMatterNode().graph as MatterNetworkGraph? + listeningGrid = tile.matterGraph tile.attachMenu(this) listeningGrid?.addListener(this) } @@ -165,7 +165,7 @@ class MatterPanelMenu @JvmOverloads constructor( val tile = tile as MatterPanelBlockEntity? if (tile != null) { - val grid = tile.getAsMatterNode().graph as MatterNetworkGraph? + val grid = tile.matterGraph if (grid != null) { initial_send = true diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt index f783e82d3..27c86665a 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/MatterScannerMenu.kt @@ -37,8 +37,8 @@ class MatterScannerMenu @JvmOverloads constructor( if (tile != null) { progress = ProgressGaugeWidget(this, { tile.workProgress.toFloat() }, tile::isUnableToProcess) patterns = LevelGaugeWidget(this, - { ImpreciseFraction(tile.getAsMatterGraph()?.getPatternCount()?.toBigInteger() ?: BigInteger.ZERO) }, - { ImpreciseFraction(tile.getAsMatterGraph()?.getPatternCapacity()?.toBigInteger() ?: BigInteger.ZERO) }) + { ImpreciseFraction(tile.matterGraph?.getPatternCount()?.toBigInteger() ?: BigInteger.ZERO) }, + { ImpreciseFraction(tile.matterGraph?.getPatternCapacity()?.toBigInteger() ?: BigInteger.ZERO) }) } else { progress = ProgressGaugeWidget(this) patterns = LevelGaugeWidget(this) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt index ec3c79164..ff979a3e0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/menu/PatternStorageMenu.kt @@ -26,9 +26,9 @@ class PatternStorageMenu @JvmOverloads constructor( } else { stored_this = LevelGaugeWidget(this, tile) stored_grid = LevelGaugeWidget(this, { - ImpreciseFraction((tile.getAsMatterNode().graph as MatterNetworkGraph?)?.getPatternCount() ?: 0) + ImpreciseFraction(tile.matterGraph?.getPatternCount() ?: 0) }, { - ImpreciseFraction((tile.getAsMatterNode().graph as MatterNetworkGraph?)?.getPatternCapacity() ?: 0) + ImpreciseFraction(tile.matterGraph?.getPatternCapacity() ?: 0) }) } 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 05563fc95..f3e4971af 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt @@ -40,22 +40,23 @@ object MBlocks { val BATTERY_BANK: Block by registry.register(MNames.BATTERY_BANK) { BatteryBankBlock() } val MATTER_DECOMPOSER: Block by registry.register(MNames.MATTER_DECOMPOSER) { MatterDecomposerBlock() } val MATTER_CAPACITOR_BANK: Block by registry.register(MNames.MATTER_CAPACITOR_BANK) { MatterCapacitorBankBlock() } - val MATTER_CABLE: Block by registry.register(MNames.MATTER_CABLE) { BlockMatterCable() } + val MATTER_CABLE: Block by registry.register(MNames.MATTER_CABLE) { MatterCableBlock() } val PATTERN_STORAGE: Block by registry.register(MNames.PATTERN_STORAGE) { PatternStorageBlock() } val MATTER_SCANNER: Block by registry.register(MNames.MATTER_SCANNER) { MatterScannerBlock() } val MATTER_PANEL: Block by registry.register(MNames.MATTER_PANEL) { MatterPanelBlock() } val MATTER_REPLICATOR: Block by registry.register(MNames.MATTER_REPLICATOR) { MatterReplicatorBlock() } val MATTER_BOTTLER: Block by registry.register(MNames.MATTER_BOTTLER) { MatterBottlerBlock() } - val DRIVE_VIEWER: Block by registry.register(MNames.DRIVE_VIEWER) { DriveViewerBlock() } val CARGO_CRATE: Block by registry.register(MNames.CARGO_CRATE) { CargoCrateBlock() } - val DRIVE_RACK: Block by registry.register(MNames.DRIVE_RACK) { DriveRackBlock() } - val ITEM_MONITOR: Block by registry.register(MNames.ITEM_MONITOR) { ItemMonitorBlock() } val ENERGY_COUNTER: Block by registry.register(MNames.ENERGY_COUNTER) { EnergyCounterBlock() } val CHEMICAL_GENERATOR: Block by registry.register(MNames.CHEMICAL_GENERATOR) { ChemicalGeneratorBlock() } val PLATE_PRESS: Block by registry.register(MNames.PLATE_PRESS) { PlatePressBlock() } val MATTER_RECYCLER: Block by registry.register(MNames.MATTER_RECYCLER) { MatterRecyclerBlock() } val STORAGE_BUS: Block by registry.register(MNames.STORAGE_BUS) { StorageBusBlock() } + val DRIVE_VIEWER: Block by registry.register(MNames.DRIVE_VIEWER) { DriveViewerBlock() } + val DRIVE_RACK: Block by registry.register(MNames.DRIVE_RACK) { DriveRackBlock() } + val ITEM_MONITOR: Block by registry.register(MNames.ITEM_MONITOR) { ItemMonitorBlock() } + val STORAGE_CABLE: Block by registry.register(MNames.STORAGE_CABLE) { StorageCableBlock() } val DEBUG_EXPLOSION_SMALL: Block by registry.register(MNames.DEBUG_EXPLOSION_SMALL) { BlockExplosionDebugger() } val DEBUG_SPHERE_POINTS: Block by registry.register(MNames.DEBUG_SPHERE_POINTS) { BlockSphereDebugger() } 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 0db5603d2..8b18daa7f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -37,19 +37,20 @@ object MItems { val MATTER_PANEL: Item by registry.register(MNames.MATTER_PANEL) { BlockItem(MBlocks.MATTER_PANEL, DEFAULT_PROPERTIES) } val MATTER_REPLICATOR: Item by registry.register(MNames.MATTER_REPLICATOR) { BlockItem(MBlocks.MATTER_REPLICATOR, DEFAULT_PROPERTIES) } val MATTER_BOTTLER: Item by registry.register(MNames.MATTER_BOTTLER) { BlockItem(MBlocks.MATTER_BOTTLER, DEFAULT_PROPERTIES) } - val DRIVE_VIEWER: Item by registry.register(MNames.DRIVE_VIEWER) { BlockItem(MBlocks.DRIVE_VIEWER, DEFAULT_PROPERTIES) } val CARGO_CRATE: Item by registry.register(MNames.CARGO_CRATE) { BlockItem(MBlocks.CARGO_CRATE, DEFAULT_PROPERTIES) } val TRITANIUM_ORE: Item by registry.register(MNames.TRITANIUM_ORE) { BlockItem(MBlocks.TRITANIUM_ORE, DEFAULT_PROPERTIES) } val DEEPSLATE_TRITANIUM_ORE: Item by registry.register(MNames.DEEPSLATE_TRITANIUM_ORE) { BlockItem(MBlocks.DEEPSLATE_TRITANIUM_ORE, DEFAULT_PROPERTIES) } val TRITANIUM_RAW_BLOCK: Item by registry.register(MNames.TRITANIUM_RAW_BLOCK) { BlockItem(MBlocks.TRITANIUM_RAW_BLOCK, DEFAULT_PROPERTIES) } - val DRIVE_RACK: Item by registry.register(MNames.DRIVE_RACK) { BlockItem(MBlocks.DRIVE_RACK, DEFAULT_PROPERTIES) } - val ITEM_MONITOR: Item by registry.register(MNames.ITEM_MONITOR) { BlockItem(MBlocks.ITEM_MONITOR, DEFAULT_PROPERTIES) } val ENERGY_COUNTER: Item by registry.register(MNames.ENERGY_COUNTER) { BlockItem(MBlocks.ENERGY_COUNTER, DEFAULT_PROPERTIES) } val CHEMICAL_GENERATOR: Item by registry.register(MNames.CHEMICAL_GENERATOR) { BlockItem(MBlocks.CHEMICAL_GENERATOR, DEFAULT_PROPERTIES) } val PLATE_PRESS: Item by registry.register(MNames.PLATE_PRESS) { BlockItem(MBlocks.PLATE_PRESS, DEFAULT_PROPERTIES) } val MATTER_RECYCLER: Item by registry.register(MNames.MATTER_RECYCLER) { BlockItem(MBlocks.MATTER_RECYCLER, DEFAULT_PROPERTIES) } val STORAGE_BUS: Item by registry.register(MNames.STORAGE_BUS) { BlockItem(MBlocks.STORAGE_BUS, DEFAULT_PROPERTIES) } + val DRIVE_VIEWER: Item by registry.register(MNames.DRIVE_VIEWER) { BlockItem(MBlocks.DRIVE_VIEWER, DEFAULT_PROPERTIES) } + val DRIVE_RACK: Item by registry.register(MNames.DRIVE_RACK) { BlockItem(MBlocks.DRIVE_RACK, DEFAULT_PROPERTIES) } + val ITEM_MONITOR: Item by registry.register(MNames.ITEM_MONITOR) { BlockItem(MBlocks.ITEM_MONITOR, DEFAULT_PROPERTIES) } + val STORAGE_CABLE: Item by registry.register(MNames.STORAGE_CABLE) { BlockItem(MBlocks.STORAGE_CABLE, DEFAULT_PROPERTIES) } val GRAVITATION_STABILIZER: Item by registry.register(MNames.GRAVITATION_STABILIZER) { object : BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) { 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 92a2232fa..9b9893b4c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt @@ -23,6 +23,8 @@ object MNames { const val PLATE_PRESS = "plate_press" // есть рецепт const val MATTER_RECYCLER = "matter_recycler" // нужен рецепт + const val STORAGE_CABLE = "storage_cable" // нужен рецепт + const val DEBUG_EXPLOSION_SMALL = "debug_explosion_small" const val DEBUG_SPHERE_POINTS = "debug_sphere_points"