Search in sources :

Example 1 with BlockTileEntity

use of ic2.core.block.BlockTileEntity in project TUMAT by canitzp.

the class IndustrialCraft2 method renderBlock.

@Override
public TooltipComponent renderBlock(WorldClient world, EntityPlayerSP player, BlockPos pos, EnumFacing side, TooltipComponent component, boolean shouldCalculate) {
    IBlockState state = world.getBlockState(pos);
    if (state.getBlock() instanceof BlockTileEntity) {
        if (InfoUtil.hasProperty(state, ((BlockTileEntity) state.getBlock()).typeProperty)) {
            IProperty<MetaTeBlock> property = ((BlockTileEntity) state.getBlock()).typeProperty;
            IBlockState actualState = state.getActualState(world, pos);
            MetaTeBlock teBlock = actualState.getValue(property);
            String name = property.getName(teBlock).replace("_active", "");
            String unlocalized = "ic2.te." + name;
            if (!name.contains("cable")) {
                component.setName(new TextComponent(Localization.translate(unlocalized)));
            }
        }
    }
    return component;
}
Also used : TextComponent(de.canitzp.tumat.api.components.TextComponent) IBlockState(net.minecraft.block.state.IBlockState) BlockTileEntity(ic2.core.block.BlockTileEntity) MetaTeBlock(ic2.core.ref.MetaTeBlock)

Aggregations

TextComponent (de.canitzp.tumat.api.components.TextComponent)1 BlockTileEntity (ic2.core.block.BlockTileEntity)1 MetaTeBlock (ic2.core.ref.MetaTeBlock)1 IBlockState (net.minecraft.block.state.IBlockState)1