Search in sources :

Example 21 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Witchworks by Um-Mitternacht.

the class BlockFluid method registerModels.

@Override
@SideOnly(Side.CLIENT)
public void registerModels() {
    final Item item = Item.getItemFromBlock(this);
    assert item != null;
    ModelBakery.registerItemVariants(item);
    final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(LibMod.MOD_ID + ":fluid", getFluid().getName());
    ModelLoader.setCustomMeshDefinition(item, stack -> modelResourceLocation);
    ModelLoader.setCustomStateMapper(this, new StateMapperBase() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState p_178132_1_) {
            return modelResourceLocation;
        }
    });
}
Also used : StateMapperBase(net.minecraft.client.renderer.block.statemap.StateMapperBase) Item(net.minecraft.item.Item) IBlockState(net.minecraft.block.state.IBlockState) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 22 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class ButtonEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    for (EnumFacing facing : EnumFacing.VALUES) ModelLoader.setCustomStateMapper(getBlock(facing), stateMapper);
    for (int meta = 0; meta < button().getNbVariants(); ++meta) {
        String variants = "type=" + button().getVariantName(meta);
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName), variants);
        ModelLoader.setCustomModelResourceLocation(getItemBlock(), meta, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 23 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class ItemEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    if (getItem() instanceof Variable) {
        Variable varItem = (Variable) getItem();
        for (int meta = 0; meta < varItem.getNbVariants(); ++meta) {
            ModelResourceLocation location = new ModelResourceLocation(externalName(varItem.getVariantName(meta)));
            ModelLoader.setCustomModelResourceLocation(getItem(), meta, location);
            LOGGER.debug("Model location: " + location);
        }
    } else {
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName));
        ModelLoader.setCustomModelResourceLocation(getItem(), 0, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : Variable(exterminatorjeff.undergroundbiomes.api.common.Variable) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 24 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class StairsEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    for (EnumFacing facing : EnumFacing.HORIZONTALS) ModelLoader.setCustomStateMapper(getBlock(facing), stateMapper);
    for (int meta = 0; meta < stairs().getNbVariants(); ++meta) {
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName), stairs().getVariantName(meta));
        ModelLoader.setCustomModelResourceLocation(getItemBlock(), meta, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 25 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Realistic-Terrain-Generation by Team-RTG.

the class BlockEntry method doRegisterModel.

@Override
protected void doRegisterModel(IStateMapper stateMapper) {
    for (int meta = 0; meta < getUBBlock().getNbVariants(); ++meta) {
        ModelResourceLocation location = new ModelResourceLocation(externalName(internalName), "type=" + getUBBlock().getVariantName(meta));
        ModelLoader.setCustomModelResourceLocation(getItemBlock(), meta, location);
        LOGGER.debug("Model location: " + location);
    }
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Aggregations

ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)95 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)42 ResourceLocation (net.minecraft.util.ResourceLocation)28 Item (net.minecraft.item.Item)19 ArrayList (java.util.ArrayList)17 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)15 ItemStack (net.minecraft.item.ItemStack)13 IBlockState (net.minecraft.block.state.IBlockState)10 Block (net.minecraft.block.Block)7 RenderItem (net.minecraft.client.renderer.RenderItem)7 StateMapperBase (net.minecraft.client.renderer.block.statemap.StateMapperBase)7 EnumFacing (net.minecraft.util.EnumFacing)6 Map (java.util.Map)5 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)4 StateMap (net.minecraft.client.renderer.block.statemap.StateMap)4 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)4 HashMap (java.util.HashMap)3 BlockFenceGate (net.minecraft.block.BlockFenceGate)3 BlockSlab (net.minecraft.block.BlockSlab)3 BlockWall (net.minecraft.block.BlockWall)3