Search in sources :

Example 26 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project ImmersiveEngineering by BluSunrize.

the class BlockConveyor 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 TileEntityConveyorBelt))
            return state;
        state = ext.withProperty(ICONEYOR_PASSTHROUGH, ((TileEntityConveyorBelt) te).getConveyorSubtype());
    }
    return state;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 27 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project ImmersiveEngineering by BluSunrize.

the class ClientProxy method drawSpecificFluidPipe.

@Override
public void drawSpecificFluidPipe(String configuration) {
    final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    IBlockState state = IEContent.blockMetalDevice1.getStateFromMeta(BlockTypes_MetalDevice1.FLUID_PIPE.getMeta());
    IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state);
    if (state instanceof IExtendedBlockState)
        state = ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, TileEntityFluidPipe.getStateFromKey(configuration));
    GlStateManager.pushMatrix();
    GlStateManager.translate(0, 0, 1);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(770, 771);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();
    if (Minecraft.isAmbientOcclusionEnabled())
        GlStateManager.shadeModel(7425);
    else
        GlStateManager.shadeModel(7424);
    //		if(model instanceof ISmartBlockModel)
    //			model = ((ISmartBlockModel) model).handleBlockState(state);
    blockRenderer.getBlockModelRenderer().renderModelBrightness(model, state, .75f, false);
    GlStateManager.popMatrix();
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 28 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project AgriCraft by AgriCraft.

the class RenderBlockCustomWood method renderWorldBlockStatic.

@Override
public void renderWorldBlockStatic(ITessellator tessellator, IBlockState state, B block, EnumFacing side) {
    if (state instanceof IExtendedBlockState) {
        CustomWoodType type = ((IExtendedBlockState) state).getValue(AgriProperties.CUSTOM_WOOD_TYPE);
        this.renderWorldBlockWoodStatic(tessellator, (IExtendedBlockState) state, block, side, type.getIcon());
    }
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) CustomWoodType(com.infinityraider.agricraft.utility.CustomWoodType)

Example 29 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Railcraft by Railcraft.

the class BlockRailcraftWall method getActualState.

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    boolean north = canConnectTo(worldIn, pos.north());
    boolean east = canConnectTo(worldIn, pos.east());
    boolean south = canConnectTo(worldIn, pos.south());
    boolean west = canConnectTo(worldIn, pos.west());
    boolean smooth = north && !east && south && !west || !north && east && !south && west;
    state = state.withProperty(UP, !smooth || !worldIn.isAirBlock(pos.up())).withProperty(NORTH, north).withProperty(EAST, east).withProperty(SOUTH, south).withProperty(WEST, west);
    IExtendedBlockState actState = (IExtendedBlockState) state;
    actState = actState.withProperty(Materials.MATERIAL_PROPERTY, MatTools.getMat(worldIn, pos));
    return actState;
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Aggregations

IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)29 IBlockState (net.minecraft.block.state.IBlockState)8 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)8 OBJState (net.minecraftforge.client.model.obj.OBJModel.OBJState)8 TileEntity (net.minecraft.tileentity.TileEntity)6 EnumFacing (net.minecraft.util.EnumFacing)6 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)5 BlockPos (net.minecraft.util.math.BlockPos)5 TileEntityImmersiveConnectable (blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable)4 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)4 CustomWoodType (com.infinityraider.agricraft.utility.CustomWoodType)2 SidedConnection (com.infinityraider.infinitylib.block.blockstate.SidedConnection)2 UnpackedBakedQuad (net.minecraftforge.client.model.pipeline.UnpackedBakedQuad)2 IModelState (net.minecraftforge.common.model.IModelState)2 ComparableItemStack (blusunrize.immersiveengineering.api.ComparableItemStack)1 SideConfig (blusunrize.immersiveengineering.api.IEEnums.SideConfig)1 Connection (blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection)1 ShaderWrapper (blusunrize.immersiveengineering.api.shader.CapabilityShader.ShaderWrapper)1 IShaderItem (blusunrize.immersiveengineering.api.shader.IShaderItem)1 ShaderCase (blusunrize.immersiveengineering.api.shader.ShaderCase)1