Add storage cables, update matter node api

This commit is contained in:
DBotThePony 2022-04-09 16:08:58 +07:00
parent 923ace67a0
commit 183bdd1118
Signed by: DBot
GPG Key ID: DCC23B5715498507
21 changed files with 373 additions and 341 deletions

View File

@ -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<BlockState, VoxelShape> 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<VoxelShape> 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<Block, BlockState> builder) {
builder.add(CONNECTION_SOUTH,
CONNECTION_WEST,
CONNECTION_EAST,
CONNECTION_NORTH,
CONNECTION_UP,
CONNECTION_DOWN);
}
}

View File

@ -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<VoxelShape>()
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<Block, BlockState>) {
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)
}
}

View File

@ -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<IMatterGraphNode>(this)
private val resolverNode = LazyOptional.of { this }
override fun invalidateCaps() {
super.invalidateCaps()
valid = false
}
override fun reviveCaps() {
super.reviveCaps()
valid = true
}
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
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<IStorageGraphNode>(this)
override fun invalidateCaps() {
super.invalidateCaps()
valid = false
}
override fun reviveCaps() {
super.reviveCaps()
valid = true
}
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
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)
}
}
}

View File

@ -37,14 +37,10 @@ import ru.dbotthepony.mc.otm.set
class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
MatteryPoweredBlockEntity(MBlockEntities.MATTER_BOTTLER, p_155229_, p_155230_), IMatterGraphNode { MatteryPoweredBlockEntity(MBlockEntities.MATTER_BOTTLER, p_155229_, p_155230_), IMatterGraphNode {
private val node = Graph6Node<IMatterGraphNode>(this) override val matterNode = Graph6Node<IMatterGraphNode>(this)
private val resolverNode = LazyOptional.of { this } private val resolverNode = LazyOptional.of { this }
override val energy = WorkerEnergyStorage(this) override val energy = WorkerEnergyStorage(this)
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
}
// true - bottling // true - bottling
// false - unbottling // false - unbottling
var workFlow: Boolean = true var workFlow: Boolean = true
@ -125,7 +121,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
super.setLevel(p_155231_) super.setLevel(p_155231_)
if (p_155231_ is ServerLevel) if (p_155231_ is ServerLevel)
MatterNetworkGraph.discoverFull(this, node) MatterNetworkGraph.discoverFull(this, matterNode)
} }
private var valid = true private var valid = true
@ -205,7 +201,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
override fun setRemoved() { override fun setRemoved() {
super.setRemoved() super.setRemoved()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
fun tick() { fun tick() {
@ -254,7 +250,7 @@ class MatterBottlerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
initialCapacity = capability!!.storedMatter initialCapacity = capability!!.storedMatter
} }
val graph = node.graph as MatterNetworkGraph? val graph = matterNode.graph as MatterNetworkGraph?
if (capability != null) { if (capability != null) {
if (blockState.getValue(WorkerState.SEMI_WORKER_STATE) !== WorkerState.WORKING) { if (blockState.getValue(WorkerState.SEMI_WORKER_STATE) !== WorkerState.WORKING) {

View File

@ -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<IMatterGraphNode>(this)
private val resolverNode = LazyOptional.of { this }
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
}
override fun invalidateCaps() {
super.invalidateCaps()
valid = false
}
override fun reviveCaps() {
super.reviveCaps()
valid = true
}
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
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)
}
}

View File

@ -35,13 +35,9 @@ import javax.annotation.ParametersAreNonnullByDefault
class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
MatteryBlockEntity(MBlockEntities.MATTER_CAPACITOR_BANK, p_155229_, p_155230_), IMatterGraphNode, IMatterHandler { MatteryBlockEntity(MBlockEntities.MATTER_CAPACITOR_BANK, p_155229_, p_155230_), IMatterGraphNode, IMatterHandler {
private val node = Graph6Node<IMatterGraphNode>(this) override val matterNode = Graph6Node<IMatterGraphNode>(this)
private val resolverNode = LazyOptional.of { this } private val resolverNode = LazyOptional.of { this }
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
}
override val storedMatter: ImpreciseFraction get() { override val storedMatter: ImpreciseFraction get() {
var summ = ImpreciseFraction.ZERO var summ = ImpreciseFraction.ZERO
@ -190,14 +186,14 @@ class MatterCapacitorBankBlockEntity(p_155229_: BlockPos, p_155230_: BlockState)
override fun setRemoved() { override fun setRemoved() {
super.setRemoved() super.setRemoved()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
override fun setLevel(p_155231_: Level) { override fun setLevel(p_155231_: Level) {
super.setLevel(p_155231_) super.setLevel(p_155231_)
if (p_155231_ is ServerLevel) if (p_155231_ is ServerLevel)
MatterNetworkGraph.discoverFull(this, node) MatterNetworkGraph.discoverFull(this, matterNode)
} }
override fun getMatterHandler(): IMatterHandler { override fun getMatterHandler(): IMatterHandler {

View File

@ -97,11 +97,7 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState)
override val energy = WorkerEnergyStorage(this, ENERGY_STORAGE, MAX_IO) override val energy = WorkerEnergyStorage(this, ENERGY_STORAGE, MAX_IO)
private var valid = true private var valid = true
private val node = Graph6Node<IMatterGraphNode>(this) override val matterNode = Graph6Node<IMatterGraphNode>(this)
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
}
@JvmField @JvmField
val matter = MatterHandlerImpl( val matter = MatterHandlerImpl(
@ -218,14 +214,14 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState)
override fun setRemoved() { override fun setRemoved() {
super.setRemoved() super.setRemoved()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
override fun setLevel(p_155231_: Level) { override fun setLevel(p_155231_: Level) {
super.setLevel(p_155231_) super.setLevel(p_155231_)
if (p_155231_ is ServerLevel) if (p_155231_ is ServerLevel)
MatterNetworkGraph.discoverFull(this, node) MatterNetworkGraph.discoverFull(this, matterNode)
} }
override fun getMatterHandler(): IMatterHandler { override fun getMatterHandler(): IMatterHandler {
@ -236,7 +232,7 @@ class MatterDecomposerBlockEntity(pos: BlockPos, state: BlockState)
batteryChargeLoop() batteryChargeLoop()
workerLoop() workerLoop()
val grid = node.graph as MatterNetworkGraph? ?: return val grid = matterNode.graph as MatterNetworkGraph? ?: return
if (!matter.storedMatter.isZero) { if (!matter.storedMatter.isZero) {
val diff = matter.extractMatterInner(matter.storedMatter, true) val diff = matter.extractMatterInner(matter.storedMatter, true)

View File

@ -35,11 +35,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
MatteryBlockEntity(MBlockEntities.MATTER_PANEL, p_155229_, p_155230_), IMatterGraphNode, IMatterTaskProvider { MatteryBlockEntity(MBlockEntities.MATTER_PANEL, p_155229_, p_155230_), IMatterGraphNode, IMatterTaskProvider {
private val listeners = ArrayList<MatterPanelMenu>() private val listeners = ArrayList<MatterPanelMenu>()
private val node = Graph6Node<IMatterGraphNode>(this) override val matterNode = Graph6Node<IMatterGraphNode>(this)
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
}
fun attachMenu(menu: MatterPanelMenu) { fun attachMenu(menu: MatterPanelMenu) {
listeners.add(menu) listeners.add(menu)
@ -83,12 +79,12 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
super.setLevel(p_155231_) super.setLevel(p_155231_)
if (p_155231_ is ServerLevel) if (p_155231_ is ServerLevel)
MatterNetworkGraph.discoverFull(this, node) MatterNetworkGraph.discoverFull(this, matterNode)
} }
override fun setRemoved() { override fun setRemoved() {
super.setRemoved() super.setRemoved()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
override fun getTaskHandler(): IMatterTaskProvider? { override fun getTaskHandler(): IMatterTaskProvider? {
@ -106,7 +102,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
} }
override fun allocateTask(simulate: Boolean): MatterTaskAllocation? { 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) { for ((key, task) in _tasks) {
if (task.required > 0) { if (task.required > 0) {
@ -134,7 +130,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
val oldTask = localTask val oldTask = localTask
localTask = localTask.shrinkInProgress(1) localTask = localTask.shrinkInProgress(1)
val graph = node.graph as MatterNetworkGraph? val graph = matterNode.graph as MatterNetworkGraph?
// Задача полностью выполнена // Задача полностью выполнена
if (localTask.required <= 0 && localTask.in_progress <= 0) { 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 val task = _tasks[id] ?: return
_tasks.remove(id) _tasks.remove(id)
(node.graph as MatterNetworkGraph?)?.onMatterTaskRemoved(task) (matterNode.graph as MatterNetworkGraph?)?.onMatterTaskRemoved(task)
listeners.forEach { menu: MatterPanelMenu -> menu.taskRemoved(task) } listeners.forEach { menu: MatterPanelMenu -> menu.taskRemoved(task) }
setChanged() 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) val task = MatterTask(UUID.randomUUID(), state.id, state.item, 0, 0, how_much)
_tasks[task.id()] = task _tasks[task.id()] = task
(node.graph as MatterNetworkGraph?)?.onMatterTaskCreated(task) (matterNode.graph as MatterNetworkGraph?)?.onMatterTaskCreated(task)
listeners.forEach { menu: MatterPanelMenu -> menu.taskUpdated(task) } listeners.forEach { menu: MatterPanelMenu -> menu.taskUpdated(task) }
setChanged() setChanged()
@ -207,7 +203,7 @@ class MatterPanelBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
} }
override fun dropAllTasks() { override fun dropAllTasks() {
val graph = node.graph as MatterNetworkGraph? val graph = matterNode.graph as MatterNetworkGraph?
for (task in _tasks.values) { for (task in _tasks.values) {
graph?.onMatterTaskRemoved(task) graph?.onMatterTaskRemoved(task)

View File

@ -38,21 +38,19 @@ import ru.dbotthepony.mc.otm.set
class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState) class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState)
: MatteryWorkerBlockEntity(MBlockEntities.MATTER_RECYCLER, blockPos, blockState), IMatterGraphNode { : MatteryWorkerBlockEntity(MBlockEntities.MATTER_RECYCLER, blockPos, blockState), IMatterGraphNode {
val matter = MatterHandlerImpl( val matter = MatterHandlerImpl(
this::setChangedLight, this::setChangedLight,
MatterDirection.EXTRACT, MatterDirection.EXTRACT,
STORAGE STORAGE
) )
val container = MatteryContainer(this::setChangedLight, 1) val container = MatteryContainer(this::setChangedLight, 1)
private val node = Graph6Node<IMatterGraphNode>(this) override val matterNode = Graph6Node<IMatterGraphNode>(this)
private var resolverNode = LazyOptional.of { this } private var resolverNode = LazyOptional.of { this }
private var valid = true private var valid = true
override val energy = WorkerEnergyStorage(this, MAX_POWER) override val energy = WorkerEnergyStorage(this, MAX_POWER)
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
}
override fun getMatterHandler(): IMatterHandler { override fun getMatterHandler(): IMatterHandler {
return matter return matter
} }
@ -83,14 +81,14 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState)
override fun setRemoved() { override fun setRemoved() {
super.setRemoved() super.setRemoved()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
override fun setLevel(p_155231_: Level) { override fun setLevel(p_155231_: Level) {
super.setLevel(p_155231_) super.setLevel(p_155231_)
if (p_155231_ is ServerLevel) if (p_155231_ is ServerLevel)
MatterNetworkGraph.discoverFull(this, node) MatterNetworkGraph.discoverFull(this, matterNode)
} }
override fun saveAdditional(nbt: CompoundTag) { override fun saveAdditional(nbt: CompoundTag) {
@ -167,7 +165,7 @@ class MatterRecyclerBlockEntity(blockPos: BlockPos, blockState: BlockState)
fun tick() { fun tick() {
basicTicker() basicTicker()
val graph = node.graph as MatterNetworkGraph? ?: return val graph = matterNode.graph as MatterNetworkGraph? ?: return
val received = graph.receiveMatter(matter.storedMatter, false) val received = graph.receiveMatter(matter.storedMatter, false)
if (!received.isZero) { if (!received.isZero) {

View File

@ -38,13 +38,9 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
MatteryWorkerBlockEntity(MBlockEntities.MATTER_REPLICATOR, p_155229_, p_155230_), IMatterGraphNode { MatteryWorkerBlockEntity(MBlockEntities.MATTER_REPLICATOR, p_155229_, p_155230_), IMatterGraphNode {
override val energy = WorkerEnergyStorage(this, STORAGE, MAX_IO) override val energy = WorkerEnergyStorage(this, STORAGE, MAX_IO)
private val node = Graph6Node<IMatterGraphNode>(this) override val matterNode = Graph6Node<IMatterGraphNode>(this)
private val resolverNode = LazyOptional.of { this } private val resolverNode = LazyOptional.of { this }
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
}
@JvmField @JvmField
val matter = MatterHandlerImpl( val matter = MatterHandlerImpl(
this::setChangedLight, this::setChangedLight,
@ -73,7 +69,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
return WorkerJobStatus(false, 20) return WorkerJobStatus(false, 20)
} }
(node.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!) (matterNode.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!)
return WorkerJobStatus() return WorkerJobStatus()
} }
@ -82,7 +78,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
return WorkerJobStatus(false, 20) return WorkerJobStatus(false, 20)
} }
(node.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!) (matterNode.graph as MatterNetworkGraph?)?.notifyTaskCompletion(MatterTask.deserializeNBT(job["task"])!!)
return WorkerJobStatus() return WorkerJobStatus()
} }
@ -100,18 +96,18 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
override fun setRemoved() { override fun setRemoved() {
super.setRemoved() super.setRemoved()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
override fun setLevel(p_155231_: Level) { override fun setLevel(p_155231_: Level) {
super.setLevel(p_155231_) super.setLevel(p_155231_)
if (p_155231_ is ServerLevel) if (p_155231_ is ServerLevel)
MatterNetworkGraph.discoverFull(this, node) MatterNetworkGraph.discoverFull(this, matterNode)
} }
override fun computeNextJob(): WorkerJob? { 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 allocation = graph.allocateTask(false) ?: return null
val stack = allocation.task.stack(1) val stack = allocation.task.stack(1)
val matter = getMatterValue(stack) val matter = getMatterValue(stack)
@ -136,7 +132,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
override fun onWorkTick(context: WorkerTickContext): WorkerJobStatus { override fun onWorkTick(context: WorkerTickContext): WorkerJobStatus {
val drainPerTick = ImpreciseFraction.deserializeNBT(context.job.data["matter_per_tick"]) 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) { if (matter.extractMatterInner(drainPerTick, true) < drainPerTick) {
// в машине недостаточно материи // в машине недостаточно материи

View File

@ -42,10 +42,6 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
) )
// IMatterGraphNode // IMatterGraphNode
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return matterNode
}
override fun onPatternAdded(state: PatternState) { override fun onPatternAdded(state: PatternState) {
isIdling = false isIdling = false
} }
@ -60,7 +56,7 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
// /IMatterGraphNode // /IMatterGraphNode
private var valid = true private var valid = true
private val matterNode: Graph6Node<IMatterGraphNode> = Graph6Node(this) override val matterNode: Graph6Node<IMatterGraphNode> = Graph6Node(this)
private var resolverNode = LazyOptional.of { this } private var resolverNode = LazyOptional.of { this }
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> { override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {

View File

@ -36,14 +36,14 @@ import java.util.ArrayList
class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
MatteryBlockEntity(MBlockEntities.PATTERN_STORAGE, p_155229_, p_155230_), IMatterGraphNode, IPatternStorage { MatteryBlockEntity(MBlockEntities.PATTERN_STORAGE, p_155229_, p_155230_), IMatterGraphNode, IPatternStorage {
private val node = Graph6Node<IMatterGraphNode>(this) override val matterNode = Graph6Node<IMatterGraphNode>(this)
private val resolverPatterns = LazyOptional.of { this } private val resolverPatterns = LazyOptional.of { this }
private val resolverNode = LazyOptional.of { this } private val resolverNode = LazyOptional.of { this }
@JvmField @JvmField
val patterns: MatteryContainer = object : MatteryContainer(this::setChanged, 8) { val patterns: MatteryContainer = object : MatteryContainer(this::setChanged, 8) {
override fun setChanged(slot: Int, new: ItemStack, old: ItemStack) { 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 (grid != null && !ItemStack.isSameItemSameTags(new, old)) {
if (!old.isEmpty) { if (!old.isEmpty) {
@ -106,11 +106,7 @@ class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
super.setLevel(p_155231_) super.setLevel(p_155231_)
if (p_155231_ is ServerLevel) if (p_155231_ is ServerLevel)
MatterNetworkGraph.discoverFull(this, node) MatterNetworkGraph.discoverFull(this, matterNode)
}
override fun getAsMatterNode(): Graph6Node<IMatterGraphNode> {
return node
} }
override fun getPatternHandler(): IPatternStorage { override fun getPatternHandler(): IPatternStorage {
@ -123,7 +119,7 @@ class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
super.invalidateCaps() super.invalidateCaps()
valid = false valid = false
resolverItem.invalidate() resolverItem.invalidate()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
override fun reviveCaps() { override fun reviveCaps() {
@ -175,7 +171,7 @@ class PatternStorageBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
override fun setRemoved() { override fun setRemoved() {
super.setRemoved() super.setRemoved()
node.destroy(::MatterNetworkGraph) matterNode.destroy(::MatterNetworkGraph)
} }
override fun insertPattern(pattern: PatternState, only_update: Boolean, simulate: Boolean): PatternInsertStatus { 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) { if (!simulate) {
setChanged() setChanged()
val graph = node.graph as MatterNetworkGraph? val graph = matterNode.graph as MatterNetworkGraph?
if (graph != null) { if (graph != null) {
if (status.isInserted) { if (status.isInserted) {

View File

@ -18,6 +18,7 @@ interface IMatterGraphNode : IMatterGraphListener {
fun getMatterHandler(): IMatterHandler? = null fun getMatterHandler(): IMatterHandler? = null
fun getPatternHandler(): IPatternStorage? = null fun getPatternHandler(): IPatternStorage? = null
fun getTaskHandler(): IMatterTaskProvider? = null fun getTaskHandler(): IMatterTaskProvider? = null
fun getAsMatterNode(): Graph6Node<IMatterGraphNode>
fun getAsMatterGraph(): MatterNetworkGraph? = getAsMatterNode().graph as MatterNetworkGraph? val matterNode: Graph6Node<IMatterGraphNode>
val matterGraph: MatterNetworkGraph? get() = matterNode.graph as MatterNetworkGraph?
} }

View File

@ -382,7 +382,7 @@ class MatterNetworkGraph : Abstract6Graph<IMatterGraphNode>(), IMatterGraphListe
val resolve = _tile.getCapability(MatteryCapability.MATTER_NODE) val resolve = _tile.getCapability(MatteryCapability.MATTER_NODE)
return if (resolve.isPresent) { return if (resolve.isPresent) {
resolve.resolve().get().getAsMatterNode() resolve.resolve().get().matterNode
} else { } else {
null null
} }
@ -404,7 +404,7 @@ class MatterNetworkGraph : Abstract6Graph<IMatterGraphNode>(), IMatterGraphListe
val resolve = _tile.getCapability(MatteryCapability.MATTER_NODE) val resolve = _tile.getCapability(MatteryCapability.MATTER_NODE)
return if (resolve.isPresent) { return if (resolve.isPresent) {
resolve.resolve().get().getAsMatterNode() resolve.resolve().get().matterNode
} else { } else {
null null
} }

View File

@ -26,9 +26,9 @@ class MatterCapacitorBankMenu @JvmOverloads constructor(
} else { } else {
matterGauge = LevelGaugeWidget(this, tile) matterGauge = LevelGaugeWidget(this, tile)
totalMatterGauge = LevelGaugeWidget(this, { 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
}) })
} }

View File

@ -99,7 +99,7 @@ class MatterPanelMenu @JvmOverloads constructor(
fun requestReplication(ply: ServerPlayer, state: PatternState, how_much: Int) { fun requestReplication(ply: ServerPlayer, state: PatternState, how_much: Int) {
val tile = tile as MatterPanelBlockEntity? ?: return val tile = tile as MatterPanelBlockEntity? ?: return
val graph = tile.getAsMatterNode().graph as MatterNetworkGraph? ?: return val graph = tile.matterGraph ?: return
if (graph.getPattern(state) == null) { if (graph.getPattern(state) == null) {
OverdriveThatMatters.LOGGER.error("Received replication request from {} of {}, but it is no longer in grid", ply, state) 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 { init {
if (tile != null) { if (tile != null) {
listeningGrid = tile.getAsMatterNode().graph as MatterNetworkGraph? listeningGrid = tile.matterGraph
tile.attachMenu(this) tile.attachMenu(this)
listeningGrid?.addListener(this) listeningGrid?.addListener(this)
} }
@ -165,7 +165,7 @@ class MatterPanelMenu @JvmOverloads constructor(
val tile = tile as MatterPanelBlockEntity? val tile = tile as MatterPanelBlockEntity?
if (tile != null) { if (tile != null) {
val grid = tile.getAsMatterNode().graph as MatterNetworkGraph? val grid = tile.matterGraph
if (grid != null) { if (grid != null) {
initial_send = true initial_send = true

View File

@ -37,8 +37,8 @@ class MatterScannerMenu @JvmOverloads constructor(
if (tile != null) { if (tile != null) {
progress = ProgressGaugeWidget(this, { tile.workProgress.toFloat() }, tile::isUnableToProcess) progress = ProgressGaugeWidget(this, { tile.workProgress.toFloat() }, tile::isUnableToProcess)
patterns = LevelGaugeWidget(this, patterns = LevelGaugeWidget(this,
{ ImpreciseFraction(tile.getAsMatterGraph()?.getPatternCount()?.toBigInteger() ?: BigInteger.ZERO) }, { ImpreciseFraction(tile.matterGraph?.getPatternCount()?.toBigInteger() ?: BigInteger.ZERO) },
{ ImpreciseFraction(tile.getAsMatterGraph()?.getPatternCapacity()?.toBigInteger() ?: BigInteger.ZERO) }) { ImpreciseFraction(tile.matterGraph?.getPatternCapacity()?.toBigInteger() ?: BigInteger.ZERO) })
} else { } else {
progress = ProgressGaugeWidget(this) progress = ProgressGaugeWidget(this)
patterns = LevelGaugeWidget(this) patterns = LevelGaugeWidget(this)

View File

@ -26,9 +26,9 @@ class PatternStorageMenu @JvmOverloads constructor(
} else { } else {
stored_this = LevelGaugeWidget(this, tile) stored_this = LevelGaugeWidget(this, tile)
stored_grid = LevelGaugeWidget(this, { 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)
}) })
} }

View File

@ -40,22 +40,23 @@ object MBlocks {
val BATTERY_BANK: Block by registry.register(MNames.BATTERY_BANK) { BatteryBankBlock() } val BATTERY_BANK: Block by registry.register(MNames.BATTERY_BANK) { BatteryBankBlock() }
val MATTER_DECOMPOSER: Block by registry.register(MNames.MATTER_DECOMPOSER) { MatterDecomposerBlock() } 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_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 PATTERN_STORAGE: Block by registry.register(MNames.PATTERN_STORAGE) { PatternStorageBlock() }
val MATTER_SCANNER: Block by registry.register(MNames.MATTER_SCANNER) { MatterScannerBlock() } val MATTER_SCANNER: Block by registry.register(MNames.MATTER_SCANNER) { MatterScannerBlock() }
val MATTER_PANEL: Block by registry.register(MNames.MATTER_PANEL) { MatterPanelBlock() } val MATTER_PANEL: Block by registry.register(MNames.MATTER_PANEL) { MatterPanelBlock() }
val MATTER_REPLICATOR: Block by registry.register(MNames.MATTER_REPLICATOR) { MatterReplicatorBlock() } val MATTER_REPLICATOR: Block by registry.register(MNames.MATTER_REPLICATOR) { MatterReplicatorBlock() }
val MATTER_BOTTLER: Block by registry.register(MNames.MATTER_BOTTLER) { MatterBottlerBlock() } 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 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 ENERGY_COUNTER: Block by registry.register(MNames.ENERGY_COUNTER) { EnergyCounterBlock() }
val CHEMICAL_GENERATOR: Block by registry.register(MNames.CHEMICAL_GENERATOR) { ChemicalGeneratorBlock() } val CHEMICAL_GENERATOR: Block by registry.register(MNames.CHEMICAL_GENERATOR) { ChemicalGeneratorBlock() }
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 STORAGE_BUS: Block by registry.register(MNames.STORAGE_BUS) { StorageBusBlock() } 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_EXPLOSION_SMALL: Block by registry.register(MNames.DEBUG_EXPLOSION_SMALL) { BlockExplosionDebugger() }
val DEBUG_SPHERE_POINTS: Block by registry.register(MNames.DEBUG_SPHERE_POINTS) { BlockSphereDebugger() } val DEBUG_SPHERE_POINTS: Block by registry.register(MNames.DEBUG_SPHERE_POINTS) { BlockSphereDebugger() }

View File

@ -37,19 +37,20 @@ object MItems {
val MATTER_PANEL: Item by registry.register(MNames.MATTER_PANEL) { BlockItem(MBlocks.MATTER_PANEL, DEFAULT_PROPERTIES) } 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_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 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 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 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 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 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 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 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 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 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 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) { val GRAVITATION_STABILIZER: Item by registry.register(MNames.GRAVITATION_STABILIZER) {
object : BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) { object : BlockItem(MBlocks.GRAVITATION_STABILIZER, DEFAULT_PROPERTIES) {

View File

@ -23,6 +23,8 @@ 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 STORAGE_CABLE = "storage_cable" // нужен рецепт
const val DEBUG_EXPLOSION_SMALL = "debug_explosion_small" const val DEBUG_EXPLOSION_SMALL = "debug_explosion_small"
const val DEBUG_SPHERE_POINTS = "debug_sphere_points" const val DEBUG_SPHERE_POINTS = "debug_sphere_points"