Search in sources :

Example 96 with ModelResourceLocation

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

the class BlockFluid method registerModel.

@Override
@SideOnly(Side.CLIENT)
public void registerModel() {
    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 97 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Fracture by HellFirePvP.

the class ClientProxy method registerDisplayInformationInit.

public void registerDisplayInformationInit() {
    for (RenderInfoItem modelEntry : itemRegister) {
        if (modelEntry.variant) {
            registerVariantName(modelEntry.item, modelEntry.name);
        }
        Item item = modelEntry.item;
        ModelResourceLocation def = new ModelResourceLocation(Fracture.MODID + ":" + modelEntry.name, "inventory");
        ModelLoader.setCustomModelResourceLocation(item, modelEntry.metadata, def);
    }
    for (RenderInfoBlock modelEntry : blockRegister) {
        Item item = Item.getItemFromBlock(modelEntry.block);
        ModelResourceLocation def = new ModelResourceLocation(Fracture.MODID + ":" + modelEntry.name, "inventory");
        ModelLoader.setCustomModelResourceLocation(item, modelEntry.metadata, def);
    }
}
Also used : Item(net.minecraft.item.Item) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 98 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project YABBA by LatvianModder.

the class YabbaItems method registerModels.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerModels(ModelRegistryEvent event) {
    ModelLoaderRegistry.registerLoader(BarrelModelLoader.INSTANCE);
    ModelLoader.setCustomModelResourceLocation(ITEM_BARREL_ITEM, 0, BarrelModelLoader.MODEL_LOCATION);
    ModelLoader.setCustomStateMapper(ITEM_BARREL, BarrelModelLoader.INSTANCE);
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ITEM_BARREL_CONNECTOR), 0, new ModelResourceLocation(ITEM_BARREL_CONNECTOR.getRegistryName(), "normal"));
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ANTIBARREL), 0, new ModelResourceLocation(ANTIBARREL.getRegistryName(), "normal"));
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(COMPOUND_ITEM_BARREL), 0, new ModelResourceLocation(COMPOUND_ITEM_BARREL.getRegistryName(), "normal"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_BLANK, 0, new ModelResourceLocation(UPGRADE_BLANK.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_STONE_TIER, 0, new ModelResourceLocation(UPGRADE_STONE_TIER.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_IRON_TIER, 0, new ModelResourceLocation(UPGRADE_IRON_TIER.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_GOLD_TIER, 0, new ModelResourceLocation(UPGRADE_GOLD_TIER.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_DIAMOND_TIER, 0, new ModelResourceLocation(UPGRADE_DIAMOND_TIER.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_STAR_TIER, 0, new ModelResourceLocation(UPGRADE_STAR_TIER.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_CREATIVE, 0, new ModelResourceLocation(UPGRADE_CREATIVE.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_OBSIDIAN_SHELL, 0, new ModelResourceLocation(UPGRADE_OBSIDIAN_SHELL.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_REDSTONE_OUT, 0, new ModelResourceLocation(UPGRADE_REDSTONE_OUT.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_HOPPER, 0, new ModelResourceLocation(UPGRADE_HOPPER.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_VOID, 0, new ModelResourceLocation(UPGRADE_VOID.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(UPGRADE_PICKUP, 0, new ModelResourceLocation(UPGRADE_PICKUP.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(HAMMER, 0, new ModelResourceLocation(HAMMER.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(PAINTER, 0, new ModelResourceLocation(PAINTER.getRegistryName(), "inventory"));
    ClientRegistry.bindTileEntitySpecialRenderer(TileItemBarrel.class, new RenderItemBarrel());
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) RenderItemBarrel(com.latmod.yabba.client.RenderItemBarrel) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 99 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Cavern2 by kegare.

the class CaveItems method registerModels.

@SideOnly(Side.CLIENT)
public static void registerModels(@Nullable String prefix, Item item, String... modelNames) {
    List<ModelResourceLocation> models = Lists.newArrayList();
    for (String model : modelNames) {
        models.add(new ModelResourceLocation(CaveUtils.getKey(ObjectUtils.defaultIfNull(prefix, "") + model), "inventory"));
    }
    ModelBakery.registerItemVariants(item, models.toArray(new ResourceLocation[models.size()]));
    for (int i = 0; i < models.size(); ++i) {
        ModelLoader.setCustomModelResourceLocation(item, i, models.get(i));
    }
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 100 with ModelResourceLocation

use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project BetterQuesting by Funwayguy.

the class ClientProxy method registerBlockModel.

@SideOnly(Side.CLIENT)
public static void registerBlockModel(Block block, int meta, String name) {
    Item item = Item.getItemFromBlock(block);
    ModelResourceLocation model = new ModelResourceLocation(name, "inventory");
    if (!name.equals(item.getRegistryName())) {
        ModelBakery.registerItemVariants(item, model);
    }
    ModelLoader.setCustomModelResourceLocation(item, meta, model);
// Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, model);
}
Also used : Item(net.minecraft.item.Item) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

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