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