Search in sources :

Example 51 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project SilentGems by SilentChaos512.

the class ToolPartGem method getModel.

@Override
public ModelResourceLocation getModel(ItemStack tool, ToolPartPosition pos, int frame) {
    String name = ((IRegistryObject) tool.getItem()).getName();
    name = SilentGems.RESOURCE_PREFIX + name + "/" + name;
    String gemNum = tool.getItem() instanceof ItemGemBow ? "" : "" + gem.ordinal();
    String frameNum = frame == 3 ? "_3" : "";
    switch(pos) {
        case HEAD:
            name += gemNum + frameNum;
            break;
        case ROD_DECO:
            name += "_deco";
            break;
        default:
            return null;
    }
    if (modelMap.containsKey(name)) {
        return modelMap.get(name);
    }
    name = name.toLowerCase();
    ModelResourceLocation model = new ModelResourceLocation(name, "inventory");
    modelMap.put(name, model);
    return model;
}
Also used : IRegistryObject(net.silentchaos512.lib.registry.IRegistryObject) ItemGemBow(net.silentchaos512.gems.item.tool.ItemGemBow) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 52 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project SilentGems by SilentChaos512.

the class ToolPartRodGems method getModel.

@Override
public ModelResourceLocation getModel(ItemStack tool, ToolPartPosition pos, int frame) {
    String name = ((IRegistryObject) tool.getItem()).getName();
    name = SilentGems.RESOURCE_PREFIX + name.toLowerCase() + "/" + name + "_" + rodName;
    if (modelMap.containsKey(name)) {
        return modelMap.get(name);
    }
    name = name.toLowerCase();
    ModelResourceLocation model = new ModelResourceLocation(name, "inventory");
    modelMap.put(name, model);
    return model;
}
Also used : IRegistryObject(net.silentchaos512.lib.registry.IRegistryObject) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 53 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project SilentGems by SilentChaos512.

the class BlockGemSubtypes method getModels.

@Override
public void getModels(Map<Integer, ModelResourceLocation> models) {
    for (int i = 0; i < 16; ++i) {
        EnumGem gem = EnumGem.values()[i];
        models.put(i, new ModelResourceLocation(getFullName().toLowerCase(), "gem=" + gem.getName()));
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 54 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project SilentGems by SilentChaos512.

the class ModBlockRenderers method register.

private static void register(Item item, int meta, String name, String variantData) {
    ResourceLocation resName = new ResourceLocation(SilentGems.RESOURCE_PREFIX + name);
    ModelBakery.registerItemVariants(item, resName);
    ModelResourceLocation model = new ModelResourceLocation(resName, variantData);
    ModelLoader.setCustomModelResourceLocation(item, meta, model);
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 55 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project SilentGems by SilentChaos512.

the class ItemEnchantmentToken method getModels.

@Override
public void getModels(Map<Integer, ModelResourceLocation> models) {
    String fullName = getFullName().toLowerCase();
    models.put(0, new ModelResourceLocation(fullName, "inventory"));
    int i = 1;
    for (String type : MODEL_TYPES) {
        String name = fullName + "_" + type.toLowerCase();
        models.put(i++, new ModelResourceLocation(name, "inventory"));
    }
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Aggregations

ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)320 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)129 ResourceLocation (net.minecraft.util.ResourceLocation)101 Item (net.minecraft.item.Item)55 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)52 IBlockState (net.minecraft.block.state.IBlockState)48 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)26 ArrayList (java.util.ArrayList)25 Block (net.minecraft.block.Block)21 StateMapperBase (net.minecraft.client.renderer.block.statemap.StateMapperBase)20 ItemStack (net.minecraft.item.ItemStack)16 EnumFacing (net.minecraft.util.EnumFacing)13 Map (java.util.Map)12 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)11 IModel (net.minecraftforge.client.model.IModel)11 Nonnull (javax.annotation.Nonnull)10 IProperty (net.minecraft.block.properties.IProperty)9 Side (net.minecraftforge.fml.relauncher.Side)9 DefaultStateMapper (net.minecraft.client.renderer.block.statemap.DefaultStateMapper)8 RenderItem (net.minecraft.client.renderer.RenderItem)7