almost fully fixing cables
fixes 1 edge-case, but the east bug is still goofed
This commit is contained in:
@@ -152,6 +152,7 @@ class CableBlock() : DeviceBlock(Properties.of()), EntityBlock {
|
|||||||
// val ent = level.getBlockEntity(blockPos.relative(dir))
|
// val ent = level.getBlockEntity(blockPos.relative(dir))
|
||||||
// level.setBlockAndUpdate(blockPos, blockState.setValue(getPropByDirection(dir), (ent is NodeBlockEntity || ent is CableEntity)))
|
// level.setBlockAndUpdate(blockPos, blockState.setValue(getPropByDirection(dir), (ent is NodeBlockEntity || ent is CableEntity)))
|
||||||
// }
|
// }
|
||||||
|
super.neighborChanged(state, level, pos, neighborBlock, neighborPos, movedByPiston)
|
||||||
val diff = pos.subtract(neighborPos)
|
val diff = pos.subtract(neighborPos)
|
||||||
val dir = Direction.fromDelta(diff.x, diff.y, diff.z)!!.opposite
|
val dir = Direction.fromDelta(diff.x, diff.y, diff.z)!!.opposite
|
||||||
val ent = level.getBlockEntity(neighborPos)
|
val ent = level.getBlockEntity(neighborPos)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract class DeviceBlockEntity(type: BlockEntityType<*>, pos: BlockPos, state:
|
|||||||
val connetionsInDir = MutableList<DeviceNode?>(Direction.entries.size) { null }
|
val connetionsInDir = MutableList<DeviceNode?>(Direction.entries.size) { null }
|
||||||
var alreadySetup = false
|
var alreadySetup = false
|
||||||
var receivedServerState = false
|
var receivedServerState = false
|
||||||
var connectionsAreDirty = false
|
var connectionsAreDirty = true
|
||||||
|
|
||||||
abstract fun getDeviceNodes(): List<DeviceNode>
|
abstract fun getDeviceNodes(): List<DeviceNode>
|
||||||
|
|
||||||
@@ -191,6 +191,7 @@ abstract class DeviceBlock(properties: Properties = Properties.of()): BaseBlock(
|
|||||||
val ent = level.getBlockEntity(pos)
|
val ent = level.getBlockEntity(pos)
|
||||||
if(ent is DeviceBlockEntity) {
|
if(ent is DeviceBlockEntity) {
|
||||||
ent.initNetworking()
|
ent.initNetworking()
|
||||||
|
ent.connectionsAreDirty = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user