Search in sources :

Example 16 with ModelResourceLocation

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

the class DimletMemoryUnitItem method initModel.

@Override
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelResourceLocation[] models = new ModelResourceLocation[3];
    for (int i = 0; i < 3; 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)

Example 17 with ModelResourceLocation

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

the class ForgeModelBakery method onPostBakeEvent.

/**
 * Internal, do not use.
 */
public void onPostBakeEvent(Map<ResourceLocation, BakedModel> modelRegistry) {
    BakedModel missingModel = modelRegistry.get(MISSING_MODEL_LOCATION);
    for (Map.Entry<ResourceLocation, Exception> entry : loadingExceptions.entrySet()) {
        // ignoring pure ResourceLocation arguments, all things we care about pass ModelResourceLocation
        if (entry.getKey() instanceof ModelResourceLocation) {
            LOGGER.debug(MODELLOADING, () -> new ModelLoaderErrorMessage((ModelResourceLocation) entry.getKey(), entry.getValue()));
            final ModelResourceLocation location = (ModelResourceLocation) entry.getKey();
            final BakedModel model = modelRegistry.get(location);
            if (model == null) {
                modelRegistry.put(location, missingModel);
            }
        }
    }
    loadingExceptions.clear();
    isLoading = false;
}
Also used : ModelLoaderErrorMessage(net.minecraftforge.logging.ModelLoaderErrorMessage) ResourceLocation(net.minecraft.resources.ResourceLocation) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) BakedModel(net.minecraft.client.resources.model.BakedModel) ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) Map(java.util.Map)

Example 18 with ModelResourceLocation

use of net.minecraft.client.resources.model.ModelResourceLocation in project CodeChickenLib by Chicken-Bones.

the class ModelRegistryHelper method registerItemRenderer.

public static void registerItemRenderer(Item item, IItemRenderer renderer, ResourceLocation location) {
    final ModelResourceLocation modelLoc = new ModelResourceLocation(location, "inventory");
    register(modelLoc, renderer);
    registerItemMesher(item, new ItemMeshDefinition() {

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

Example 19 with ModelResourceLocation

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

the class ProxyClient method onPostBake.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPostBake(ModelBakeEvent event) {
    event.modelRegistry.putObject(new ModelResourceLocation("charsetwires:wire", "multipart"), rendererWire);
    event.modelRegistry.putObject(new ModelResourceLocation("charsetwires:wire", "inventory"), rendererWire);
}
Also used : ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 20 with ModelResourceLocation

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

the class ProxyClient method onPostBake.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPostBake(ModelBakeEvent event) {
    for (String s : ModCharsetGates.gateParts.keySet()) {
        event.modelRegistry.putObject(new ModelResourceLocation(s, "multipart"), RendererGate.INSTANCE);
        event.modelRegistry.putObject(new ModelResourceLocation(s, "inventory"), RendererGate.INSTANCE);
    }
}
Also used : ModelResourceLocation(net.minecraft.client.resources.model.ModelResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) 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