Search in sources :

Example 1 with IMirrorAble

use of blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IMirrorAble 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;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IProperty(net.minecraft.block.properties.IProperty) PropertyDirection(net.minecraft.block.properties.PropertyDirection) IAttachedIntegerProperies(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IAttachedIntegerProperies) TileEntityMultiblockPart(blusunrize.immersiveengineering.common.blocks.TileEntityMultiblockPart) IMirrorAble(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IMirrorAble) IDualState(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDualState) IActiveState(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IActiveState) IHasDummyBlocks(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IHasDummyBlocks) IDirectionalTile(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDirectionalTile)

Aggregations

IActiveState (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IActiveState)1 IAttachedIntegerProperies (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IAttachedIntegerProperies)1 IDirectionalTile (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDirectionalTile)1 IDualState (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDualState)1 IHasDummyBlocks (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IHasDummyBlocks)1 IMirrorAble (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IMirrorAble)1 TileEntityMultiblockPart (blusunrize.immersiveengineering.common.blocks.TileEntityMultiblockPart)1 IProperty (net.minecraft.block.properties.IProperty)1 PropertyDirection (net.minecraft.block.properties.PropertyDirection)1 TileEntity (net.minecraft.tileentity.TileEntity)1