Search in sources :

Example 1 with TileEntityImmersiveConnectable

use of blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable in project ImmersiveEngineering by BluSunrize.

the class BlockClothDevice method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    state = super.getExtendedState(state, world, pos);
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState ext = (IExtendedBlockState) state;
        TileEntity te = world.getTileEntity(pos);
        if (te instanceof TileEntityImmersiveConnectable)
            ext = ext.withProperty(IEProperties.CONNECTIONS, ((TileEntityImmersiveConnectable) te).genConnBlockstate());
        state = ext;
    }
    return state;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityImmersiveConnectable(blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 2 with TileEntityImmersiveConnectable

use of blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable in project ImmersiveEngineering by BluSunrize.

the class BlockMetalDevice1 method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    state = super.getExtendedState(state, world, pos);
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof TileEntityImmersiveConnectable && state instanceof IExtendedBlockState)
        state = ((IExtendedBlockState) state).withProperty(IEProperties.CONNECTIONS, ((TileEntityImmersiveConnectable) tile).genConnBlockstate());
    if (tile instanceof TileEntityElectricLantern)
        state = state.withProperty(IEProperties.BOOLEANS[0], ((TileEntityElectricLantern) tile).active);
    if (tile instanceof TileEntityFloodlight)
        state = state.withProperty(IEProperties.BOOLEANS[0], ((TileEntityFloodlight) tile).active);
    return state;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityImmersiveConnectable(blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 3 with TileEntityImmersiveConnectable

use of blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable in project Immersive-Tech by FerroO2000.

the class BlockITTileProvider method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    state = super.getExtendedState(state, world, pos);
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState extended = (IExtendedBlockState) state;
        TileEntity te = world.getTileEntity(pos);
        if (te != null) {
            if (te instanceof IConfigurableSides)
                for (int i = 0; i < 6; i++) if (extended.getUnlistedNames().contains(IEProperties.SIDECONFIG[i]))
                    extended = extended.withProperty(IEProperties.SIDECONFIG[i], ((IConfigurableSides) te).getSideConfig(i));
            if (te instanceof IAdvancedHasObjProperty)
                extended = extended.withProperty(Properties.AnimationProperty, ((IAdvancedHasObjProperty) te).getOBJState());
            else if (te instanceof IHasObjProperty)
                extended = extended.withProperty(Properties.AnimationProperty, new OBJState(((IHasObjProperty) te).compileDisplayList(), true));
            if (te instanceof IDynamicTexture)
                extended = extended.withProperty(IEProperties.OBJ_TEXTURE_REMAP, ((IDynamicTexture) te).getTextureReplacements());
            if (te instanceof IOBJModelCallback)
                extended = extended.withProperty(IOBJModelCallback.PROPERTY, (IOBJModelCallback) te);
            if (te.hasCapability(CapabilityShader.SHADER_CAPABILITY, null))
                extended = extended.withProperty(CapabilityShader.BLOCKSTATE_PROPERTY, te.getCapability(CapabilityShader.SHADER_CAPABILITY, null));
            if (te instanceof IPropertyPassthrough && ((IExtendedBlockState) state).getUnlistedNames().contains(IEProperties.TILEENTITY_PASSTHROUGH))
                extended = extended.withProperty(IEProperties.TILEENTITY_PASSTHROUGH, te);
            if (te instanceof TileEntityImmersiveConnectable && ((IExtendedBlockState) state).getUnlistedNames().contains(IEProperties.CONNECTIONS))
                extended = extended.withProperty(IEProperties.CONNECTIONS, ((TileEntityImmersiveConnectable) te).genConnBlockstate());
        }
        state = extended;
    }
    return state;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityImmersiveConnectable(blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable) IDynamicTexture(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDynamicTexture) IPropertyPassthrough(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IPropertyPassthrough) IOBJModelCallback(blusunrize.immersiveengineering.client.models.IOBJModelCallback) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IAdvancedHasObjProperty(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IAdvancedHasObjProperty) IHasObjProperty(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IHasObjProperty) IConfigurableSides(blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IConfigurableSides) OBJState(net.minecraftforge.client.model.obj.OBJModel.OBJState)

Example 4 with TileEntityImmersiveConnectable

use of blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable in project Immersive-Tech by FerroO2000.

the class BlockConnectors method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    state = super.getExtendedState(state, world, pos);
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState ext = (IExtendedBlockState) state;
        TileEntity te = world.getTileEntity(pos);
        if (!(te instanceof TileEntityImmersiveConnectable))
            return state;
        state = ext.withProperty(IEProperties.CONNECTIONS, ((TileEntityImmersiveConnectable) te).genConnBlockstate());
    }
    return state;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityImmersiveConnectable(blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 5 with TileEntityImmersiveConnectable

use of blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable in project ImmersiveEngineering by BluSunrize.

the class BlockIETileProvider method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    state = super.getExtendedState(state, world, pos);
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState extended = (IExtendedBlockState) state;
        TileEntity te = world.getTileEntity(pos);
        if (te != null) {
            if (te instanceof IConfigurableSides)
                for (int i = 0; i < 6; i++) if (extended.getUnlistedNames().contains(IEProperties.SIDECONFIG[i]))
                    extended = extended.withProperty(IEProperties.SIDECONFIG[i], ((IConfigurableSides) te).getSideConfig(i));
            if (te instanceof IAdvancedHasObjProperty)
                extended = extended.withProperty(Properties.AnimationProperty, ((IAdvancedHasObjProperty) te).getOBJState());
            else if (te instanceof IHasObjProperty)
                extended = extended.withProperty(Properties.AnimationProperty, new OBJState(((IHasObjProperty) te).compileDisplayList(), true));
            if (te instanceof IDynamicTexture)
                extended = extended.withProperty(IEProperties.OBJ_TEXTURE_REMAP, ((IDynamicTexture) te).getTextureReplacements());
            if (te instanceof IOBJModelCallback)
                extended = extended.withProperty(IOBJModelCallback.PROPERTY, (IOBJModelCallback) te);
            if (te.hasCapability(CapabilityShader.SHADER_CAPABILITY, null))
                extended = extended.withProperty(CapabilityShader.BLOCKSTATE_PROPERTY, te.getCapability(CapabilityShader.SHADER_CAPABILITY, null));
            if (te instanceof IPropertyPassthrough && ((IExtendedBlockState) state).getUnlistedNames().contains(IEProperties.TILEENTITY_PASSTHROUGH))
                extended = extended.withProperty(IEProperties.TILEENTITY_PASSTHROUGH, te);
            if (te instanceof TileEntityImmersiveConnectable && ((IExtendedBlockState) state).getUnlistedNames().contains(IEProperties.CONNECTIONS))
                extended = extended.withProperty(IEProperties.CONNECTIONS, ((TileEntityImmersiveConnectable) te).genConnBlockstate());
        }
        state = extended;
    }
    return state;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityImmersiveConnectable(blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable) IOBJModelCallback(blusunrize.immersiveengineering.client.models.IOBJModelCallback) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) OBJState(net.minecraftforge.client.model.obj.OBJModel.OBJState)

Aggregations

TileEntityImmersiveConnectable (blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable)6 TileEntity (net.minecraft.tileentity.TileEntity)6 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)6 IOBJModelCallback (blusunrize.immersiveengineering.client.models.IOBJModelCallback)2 OBJState (net.minecraftforge.client.model.obj.OBJModel.OBJState)2 IAdvancedHasObjProperty (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IAdvancedHasObjProperty)1 IConfigurableSides (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IConfigurableSides)1 IDynamicTexture (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDynamicTexture)1 IHasObjProperty (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IHasObjProperty)1 IPropertyPassthrough (blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IPropertyPassthrough)1