use of blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDualState in project Immersive-Tech by FerroO2000.
the class BlockITTileProvider method getActualState.
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
state = super.getActualState(state, world, pos);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof IAttachedIntegerProperies) {
for (String s : ((IAttachedIntegerProperies) tile).getIntPropertyNames()) state = applyProperty(state, ((IAttachedIntegerProperies) tile).getIntProperty(s), ((IAttachedIntegerProperies) tile).getIntPropertyValue(s));
}
if (tile instanceof IDirectionalTile && (state.getPropertyKeys().contains(IEProperties.FACING_ALL) || state.getPropertyKeys().contains(IEProperties.FACING_HORIZONTAL))) {
PropertyDirection prop = state.getPropertyKeys().contains(IEProperties.FACING_HORIZONTAL) ? IEProperties.FACING_HORIZONTAL : IEProperties.FACING_ALL;
state = applyProperty(state, prop, ((IDirectionalTile) tile).getFacing());
} else if (state.getPropertyKeys().contains(IEProperties.FACING_HORIZONTAL))
state = state.withProperty(IEProperties.FACING_HORIZONTAL, getDefaultFacing());
else if (state.getPropertyKeys().contains(IEProperties.FACING_ALL))
state = state.withProperty(IEProperties.FACING_ALL, getDefaultFacing());
if (tile instanceof IActiveState) {
IProperty boolProp = ((IActiveState) tile).getBoolProperty(IActiveState.class);
if (state.getPropertyKeys().contains(boolProp))
state = applyProperty(state, boolProp, ((IActiveState) tile).getIsActive());
}
if (tile instanceof IDualState) {
IProperty boolProp = ((IDualState) tile).getBoolProperty(IDualState.class);
if (state.getPropertyKeys().contains(boolProp))
state = applyProperty(state, boolProp, ((IDualState) tile).getIsSecondState());
}
if (tile instanceof TileEntityMultiblockPart)
state = applyProperty(state, IEProperties.MULTIBLOCKSLAVE, ((TileEntityMultiblockPart) tile).isDummy());
else if (tile instanceof IHasDummyBlocks)
state = applyProperty(state, IEProperties.MULTIBLOCKSLAVE, ((IHasDummyBlocks) tile).isDummy());
if (tile instanceof IMirrorAble)
state = applyProperty(state, ((IMirrorAble) tile).getBoolProperty(IMirrorAble.class), ((IMirrorAble) tile).getIsMirrored());
return state;
}
Aggregations