Oh my god
This commit is contained in:
parent
ace592b74f
commit
de69829cbc
@ -33,6 +33,7 @@ import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||
import ru.dbotthepony.mc.otm.core.math.component1
|
||||
import ru.dbotthepony.mc.otm.core.math.component2
|
||||
import ru.dbotthepony.mc.otm.core.math.component3
|
||||
import ru.dbotthepony.mc.otm.once
|
||||
|
||||
fun Block.getShapeForEachState(properties: List<Property<*>>, fn: (BlockState) -> VoxelShape): Map<BlockState, VoxelShape> {
|
||||
val builder = ImmutableMap.Builder<BlockState, VoxelShape>()
|
||||
@ -174,13 +175,17 @@ abstract class MatteryBlock @JvmOverloads constructor(
|
||||
super.neighborChanged(state, level, pos, neighbour, neighbourPos, movedByPiston)
|
||||
|
||||
if (this is EntityBlock && !level.isClientSide) {
|
||||
val tile = level.getBlockEntity(pos)
|
||||
val tile = level.getBlockEntity(pos) ?: return
|
||||
|
||||
if (tile is IRedstoneControlled)
|
||||
tile.redstoneControl.redstoneSignal = level.getBestNeighborSignal(pos)
|
||||
level.once {
|
||||
if (!tile.isRemoved) {
|
||||
if (tile is IRedstoneControlled)
|
||||
tile.redstoneControl.redstoneSignal = level.getBestNeighborSignal(pos)
|
||||
|
||||
if (tile is MatteryBlockEntity && SERVER_IS_LIVE)
|
||||
tile.neighborChanged(neighbour, neighbourPos, movedByPiston)
|
||||
if (tile is MatteryBlockEntity && SERVER_IS_LIVE)
|
||||
tile.neighborChanged(neighbour, neighbourPos, movedByPiston)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,10 +238,11 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
private fun updateTracked(capability: Capability<*>) {
|
||||
if (isRemoved || !SERVER_IS_LIVE) return
|
||||
val dir = blockRotation.side2Dir(side)
|
||||
val targetPos = blockPos + dir.normal
|
||||
|
||||
val chunk = level
|
||||
?.chunkSource
|
||||
?.getChunkNow(SectionPos.blockToSectionCoord(blockPos.x), SectionPos.blockToSectionCoord(blockPos.z))
|
||||
?.getChunkNow(SectionPos.blockToSectionCoord(targetPos.x), SectionPos.blockToSectionCoord(targetPos.z))
|
||||
|
||||
if (chunk == null) {
|
||||
subscriptions[capability]!!.unset()
|
||||
@ -249,7 +250,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
|
||||
return
|
||||
}
|
||||
|
||||
val entity = chunk.getBlockEntity(blockPos + dir.normal)
|
||||
val entity = chunk.getBlockEntity(targetPos)
|
||||
|
||||
if (entity == null) {
|
||||
subscriptions[capability]!!.unset()
|
||||
|
Loading…
Reference in New Issue
Block a user