Search in sources :

Example 1 with EnumDecoBlock

use of crazypants.enderio.base.render.property.EnumDecoBlock in project EnderIO by SleepyTrousers.

the class BlockDecoration method registerRenderers.

@Override
@SideOnly(Side.CLIENT)
public void registerRenderers(@Nonnull IModObject modObject) {
    Item item = Item.getItemFromBlock(this);
    Map<IBlockState, ModelResourceLocation> locations = new DefaultStateMapper().putStateModelLocations(this);
    NNIterator<EnumDecoBlock> iterator = NNList.of(EnumDecoBlock.class).iterator();
    while (iterator.hasNext()) {
        EnumDecoBlock type = iterator.next();
        IBlockState state = getDefaultState().withProperty(EnumDecoBlock.TYPE, type);
        ModelResourceLocation mrl = locations.get(state);
        if (mrl != null) {
            ModelLoader.setCustomModelResourceLocation(item, EnumDecoBlock.getMetaFromType(type), mrl);
        }
    }
}
Also used : Item(net.minecraft.item.Item) IBlockState(net.minecraft.block.state.IBlockState) DefaultStateMapper(net.minecraft.client.renderer.block.statemap.DefaultStateMapper) EnumDecoBlock(crazypants.enderio.base.render.property.EnumDecoBlock) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with EnumDecoBlock

use of crazypants.enderio.base.render.property.EnumDecoBlock in project EnderIO by SleepyTrousers.

the class BlockDecoration method getSubBlocks.

@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> list) {
    NNIterator<EnumDecoBlock> iterator = NNList.of(EnumDecoBlock.class).iterator();
    while (iterator.hasNext()) {
        EnumDecoBlock type = iterator.next();
        list.add(new ItemStack(this, 1, EnumDecoBlock.getMetaFromType(type)));
        if (type == maxMeta) {
            return;
        }
    }
}
Also used : EnumDecoBlock(crazypants.enderio.base.render.property.EnumDecoBlock) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with EnumDecoBlock

use of crazypants.enderio.base.render.property.EnumDecoBlock in project EnderIO by SleepyTrousers.

the class BlockDecorationFacing method registerRenderers.

@Override
@SideOnly(Side.CLIENT)
public void registerRenderers(@Nonnull IModObject modObject) {
    Item item = Item.getItemFromBlock(this);
    Map<IBlockState, ModelResourceLocation> locations = new DefaultStateMapper().putStateModelLocations(this);
    NNIterator<EnumDecoBlock> iterator = NNList.of(EnumDecoBlock.class).iterator();
    while (iterator.hasNext()) {
        EnumDecoBlock type = iterator.next();
        IBlockState state = getDefaultState().withProperty(EnumDecoBlock.TYPE, type).withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false);
        ModelResourceLocation mrl = locations.get(state);
        if (mrl != null) {
            ModelLoader.setCustomModelResourceLocation(item, EnumDecoBlock.getMetaFromType(type), mrl);
        }
    }
}
Also used : Item(net.minecraft.item.Item) IBlockState(net.minecraft.block.state.IBlockState) DefaultStateMapper(net.minecraft.client.renderer.block.statemap.DefaultStateMapper) EnumDecoBlock(crazypants.enderio.base.render.property.EnumDecoBlock) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EnumDecoBlock (crazypants.enderio.base.render.property.EnumDecoBlock)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 IBlockState (net.minecraft.block.state.IBlockState)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 DefaultStateMapper (net.minecraft.client.renderer.block.statemap.DefaultStateMapper)2 Item (net.minecraft.item.Item)2 ItemStack (net.minecraft.item.ItemStack)1