Fix block state updates for tile-entity dependent block states.
This commit is contained in:
@@ -62,16 +62,8 @@ public class BlockInterface extends AEBaseTileBlock<TileInterface>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, TileInterface te) {
|
||||||
// Determine whether the interface is omni-directional or not
|
return currentState.with(OMNIDIRECTIONAL, te.isOmniDirectional());
|
||||||
TileInterface te = this.getTileEntity(world, pos);
|
|
||||||
boolean omniDirectional = true; // The default
|
|
||||||
if (te != null) {
|
|
||||||
omniDirectional = te.isOmniDirectional();
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.updatePostPlacement(state, facing, facingState, world, pos, facingPos)
|
|
||||||
.with(OMNIDIRECTIONAL, omniDirectional);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -67,17 +67,8 @@ public class BlockSecurityStation extends AEBaseTileBlock<TileSecurityStation>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, TileSecurityStation te) {
|
||||||
// FIXME: Powered state needs to be handled differently
|
return currentState.with( POWERED, te.isActive() );
|
||||||
boolean powered = false;
|
|
||||||
TileSecurityStation te = this.getTileEntity( world, pos );
|
|
||||||
if( te != null )
|
|
||||||
{
|
|
||||||
powered = te.isActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
|
|
||||||
.with( POWERED, powered );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -61,13 +61,8 @@ public final class BlockVibrationChamber extends AEBaseTileBlock<TileVibrationCh
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, TileVibrationChamber te) {
|
||||||
// FIXME: This must be actively done from within the tile-entity and not passively
|
return currentState.with( ACTIVE, te.isOn );
|
||||||
TileVibrationChamber te = this.getTileEntity( world, pos );
|
|
||||||
boolean active = te != null && te.isOn;
|
|
||||||
|
|
||||||
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
|
|
||||||
.with( ACTIVE, active );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -66,12 +66,8 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock<TileQuantumBridge
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, TileQuantumBridge te) {
|
||||||
TileQuantumBridge bridge = this.getTileEntity(world, pos);
|
return currentState.with(FORMED, te.isFormed());
|
||||||
if (bridge != null) {
|
|
||||||
state = state.with(FORMED, bridge.isFormed());
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user