Search in sources :

Example 11 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project BuildCraft by BuildCraft.

the class RedstoneBoardMeshDefinition method getModelLocation.

@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
    RedstoneBoardNBT<?> board;
    if (stack == null || !stack.hasTagCompound()) {
        board = RedstoneBoardRegistry.instance.getEmptyRobotBoard();
    } else {
        NBTTagCompound nbt = stack.getTagCompound();
        board = RedstoneBoardRegistry.instance.getRedstoneBoard(nbt);
    }
    ModelResourceLocation loc = new ModelResourceLocation(board.getItemModelLocation(), "inventory");
    return loc;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation)

Example 12 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project RFToolsDimensions by McJty.

the class KnownDimlet method initModel.

@Override
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelResourceLocation[] models = new ModelResourceLocation[DimletType.values().length];
    int meta = 0;
    for (DimletType type : DimletType.values()) {
        models[meta] = new ModelResourceLocation(getRegistryName() + "_" + type.dimletType.getName().toLowerCase(), "inventory");
        ModelBakery.registerItemVariants(this, models[meta]);
        meta++;
    }
    ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {

        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return models[stack.getItemDamage()];
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 13 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project RFToolsDimensions by McJty.

the class DimletTypeControllerItem method initModel.

@Override
@SideOnly(Side.CLIENT)
public void initModel() {
    Map<DimletType, ModelResourceLocation> models = new HashMap<>();
    for (DimletType type : DimletType.values()) {
        models.put(type, new ModelResourceLocation(getRegistryName() + calculateUnlocalizedNameSuffix(type), "inventory"));
        ModelBakery.registerItemVariants(this, models.get(type));
    }
    ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {

        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return models.get(DimletType.values()[stack.getItemDamage()]);
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) HashMap(java.util.HashMap) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 14 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project RFToolsDimensions by McJty.

the class StructureEssenceItem method initModel.

@Override
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelResourceLocation resource = new ModelResourceLocation(getRegistryName(), "inventory");
    ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {

        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return resource;
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 15 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project RFToolsDimensions by McJty.

the class DimletControlCircuitItem method initModel.

@Override
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelResourceLocation[] models = new ModelResourceLocation[7];
    for (int i = 0; i <= 6; i++) {
        models[i] = new ModelResourceLocation(getRegistryName() + i, "inventory");
        ModelBakery.registerItemVariants(this, models[i]);
    }
    ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {

        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return models[stack.getItemDamage()];
        }
    });
}
Also used : ItemMeshDefinition(net.minecraft.client.renderer.ItemMeshDefinition) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ModelResourceLocation (net.minecraft.client.resources.model.ModelResourceLocation)21 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)14 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)8 ItemStack (net.minecraft.item.ItemStack)8 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 DimletType (mcjty.rftoolsdim.dimensions.dimlets.types.DimletType)2 IBlockState (net.minecraft.block.state.IBlockState)2 StateMapperBase (net.minecraft.client.renderer.block.statemap.StateMapperBase)2 IBakedModel (net.minecraft.client.resources.model.IBakedModel)2 Joiner (com.google.common.base.Joiner)1 HashMultimap (com.google.common.collect.HashMultimap)1 Multimap (com.google.common.collect.Multimap)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Minecraft (net.minecraft.client.Minecraft)1 BlockModelShaper (net.minecraft.client.renderer.block.BlockModelShaper)1 BlockRenderDispatcher (net.minecraft.client.renderer.block.BlockRenderDispatcher)1 BakedModel (net.minecraft.client.resources.model.BakedModel)1 ModelManager (net.minecraft.client.resources.model.ModelManager)1