public void registerRenderer() { ArrayList<ItemStack> subtypes = new ArrayList<ItemStack>(); this.getSubItems(this, this.getCreativeTab(), subtypes); for (ItemStack subtype : subtypes) { String unlocalizedName = this.getUnlocalizedName(subtype); String modelName = unlocalizedName.replace("item.", ""); System.out.println("Registering "+this.getRegistryName()+" metadata "+subtype.getMetadata()+" as model "+modelName); ModelLoader.setCustomModelResourceLocation( this, subtype.getMetadata(), new ModelResourceLocation(modelName, "inventory") ); } //Minecraft.getMinecraft().getRenderItem().getItemModelMesher() // .register(this, 0, new ModelResourceLocation(this.getRegistryName().toString(), "inventory")); }
@Override public void registerItemRenderer(Item i, int meta, String id) { ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(ModInfo.MODID + ":" + id, "inventory")); }
@Override public MultiLayerModel process(ImmutableMap<String, String> customData) { ImmutableMap.Builder<Optional<BlockRenderLayer>, ModelResourceLocation> builder = ImmutableMap.builder(); for(String key : customData.keySet()) { if("base".equals(key)) { builder.put(Optional.<BlockRenderLayer>absent(), getLocation(customData.get(key))); } for(BlockRenderLayer layer : BlockRenderLayer.values()) { if(layer.toString().equals(key)) { builder.put(Optional.of(layer), getLocation(customData.get(key))); } } } ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models = builder.build(); if(models.isEmpty()) return INSTANCE; return new MultiLayerModel(models); }
@SubscribeEvent @SideOnly(Side.CLIENT) public void handleModels(ModelRegistryEvent event) { for (Map.Entry<ItemStack, ModelResourceLocation> entry : LOCATIONS.entrySet()) { ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue()); } }
public void register(Item item, int meta, ModelResourceLocation location) { TIntObjectHashMap<ModelResourceLocation> locs = locations.get(item); TIntObjectHashMap<IBakedModel> mods = models.get(item); if (locs == null) { locs = new TIntObjectHashMap<ModelResourceLocation>(); locations.put(item, locs); } if (mods == null) { mods = new TIntObjectHashMap<IBakedModel>(); models.put(item, mods); } locs.put(meta, location); mods.put(meta, getModelManager().getModel(location)); }
default public void initModel(ModelRegistryEvent e) { System.out.println(((IForgeRegistryEntry<?>) this).getRegistryName()); if (this instanceof Item) ModelLoader.setCustomModelResourceLocation((Item) this, 0, new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory")); else if (this instanceof Block) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock((Block) this), 0, new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory")); System.out.println("block"); } else throw new IllegalArgumentException("No/invalid object for model"); }
public static void mkCustomModelResourceLocations(Item item, int amount, Function<Integer, String> ptrFunc) { for (int i = 0; i < amount; i++) { ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName(), ptrFunc == null ? "inventory" : ptrFunc.apply(i))); } }
public void registerRender() { int i = 0; Item item = Item.getItemFromBlock(this); ResourceLocation[] list = new ResourceLocation[getVariantNames().size()]; for (String s : getVariantNames()) { String loc = this.getRegistryName().toString();// +"#variants="+s; ResourceLocation res = new ResourceLocation(loc); ModelResourceLocation mrl = new ModelResourceLocation(loc, "variants=" + s); ModelLoader.setCustomModelResourceLocation(item, i, mrl); list[i] = res; i++; } ModelBakery.registerItemVariants(Item.getItemFromBlock(this), list); }
public static <BBBlock extends Block & IBBName> void registerBlock(BBBlock block) { Item item = Item.getItemFromBlock(block); if(item != null) { if(item instanceof ISpecialRender) ((ISpecialRender) item).registerRender(); else ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); } }
private void setBucketModel(Item item) { for(String s : getVariantNames(item)) { ModelResourceLocation memory = getInventoryVariant(s); IModel model = stateModels.get(ModelDynBucket.LOCATION); if(model != null) { stateModels.put(memory, model); } } }
public static void registerItemRenderer() { Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(ModItems.woodSpear.getItem(), 0, new ModelResourceLocation("polearms:woodSpear", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(ModItems.stoneSpear.getItem(), 0, new ModelResourceLocation("polearms:stoneSpear", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(ModItems.ironSpear.getItem(), 0, new ModelResourceLocation("polearms:ironSpear", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(ModItems.goldSpear.getItem(), 0, new ModelResourceLocation("polearms:goldSpear", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(ModItems.diamondSpear.getItem(), 0, new ModelResourceLocation("polearms:diamondSpear", "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(ModItems.pole.getItem(), 0, new ModelResourceLocation("polearms:pole", "inventory")); }
public static <T extends Enum<T> & IStringSerializable> void registerModel(Item item, Class<T> clazz) { for (T t : clazz.getEnumConstants()) { ResourceLocation location = new ResourceLocation(item.getRegistryName() + "_" + t.getName()); ModelResourceLocation modelResourceLocation = new ModelResourceLocation(location, "inventory"); ModelLoader.setCustomModelResourceLocation(item, t.ordinal(), modelResourceLocation); } }
@SideOnly(Side.CLIENT) @Override public void initModel(){ ModelBakery.registerItemVariants(this, new ModelResourceLocation(Melodium.MODID+":composition_paper"), new ModelResourceLocation(Melodium.MODID+":song_paper")); ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition(){ @Override public ModelResourceLocation getModelLocation(ItemStack stack) { if (isLearned(stack)){ return new ModelResourceLocation(Melodium.MODID+":song_paper"); } return new ModelResourceLocation(Melodium.MODID+":composition_paper"); } }); }
@Override public void registerModel() { for (int meta = 0; meta < 4; meta++) { ResourceLocation rl = new ResourceLocation(getRegistryName() + "_" + BlockCircleGlyph.GlyphType.values()[meta].name().toLowerCase()); ModelResourceLocation mrl = new ModelResourceLocation(rl, "inventory"); ModelLoader.setCustomModelResourceLocation(this, meta, mrl); } }
@SideOnly(Side.CLIENT) protected void registerFluidRender(BlockFluidBase blockFluid, String blockStateName) { final String location = FoodCraftReloaded.MODID + ":" + blockStateName; final Item itemFluid = Item.getItemFromBlock(blockFluid); ModelLoader.setCustomMeshDefinition(itemFluid, stack -> new ModelResourceLocation(location, "fluid")); ModelLoader.setCustomStateMapper(blockFluid, new StateMapperBase() { @Nonnull @Override protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) { return new ModelResourceLocation(location, "fluid"); } }); }
public static void regRender(Block block) { block.setCreativeTab(HarshenCastle.harshenTab); int timesToLoad = 1; boolean flag = blockDataMap.keySet().contains(block); if(flag) timesToLoad = blockDataMap.get(block); for(int i = 0; i < timesToLoad; i++) ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), i, new ModelResourceLocation(block.getRegistryName() + (flag ? "." + ((IMetaItemBlock)block).getNames()[i]: ""), "inventory")); }
@SubscribeEvent public void onModelRegistry(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlass), 0, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlass), 1, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass_projector", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlass), 2, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlassTerminal), 0, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass_terminal", "inventory")); }
@Override public void register(ModelRegistryEvent event) { // register the models ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(this.getRegistryName(), "inventory")); ModelLoader.setCustomModelResourceLocation(this, 1, new ModelResourceLocation(this.getRegistryName() + "_bound", "inventory")); }
public Map<IBlockState, ModelResourceLocation> putAllStateModelLocations() { Map<IBlockState, ModelResourceLocation> map = Maps.<IBlockState, ModelResourceLocation>newIdentityHashMap(); for (Block block : Block.REGISTRY) { map.putAll(this.getVariants(block)); } return map; }
@SubscribeEvent @SideOnly(Side.CLIENT) public static void registerModels(ModelRegistryEvent event) { blocks.forEach( block->ModelLoader.setCustomModelResourceLocation( Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")) ); }
@SideOnly(Side.CLIENT) public void bakeModels(){ ModelLoader.setCustomModelResourceLocation(pickaxe, 0, new ModelResourceLocation(pickaxe.getRegistryName(), "invenory")); ModelLoader.setCustomModelResourceLocation(shovel, 0, new ModelResourceLocation(shovel.getRegistryName(), "invenory")); ModelLoader.setCustomModelResourceLocation(sword, 0, new ModelResourceLocation(sword.getRegistryName(), "invenory")); ModelLoader.setCustomModelResourceLocation(axe, 0, new ModelResourceLocation(axe.getRegistryName(), "invenory")); }
@SideOnly(Side.CLIENT) private static void registerBlockModel(Block block, int metadata) { // Register the item model. ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), metadata, new ModelResourceLocation(block.getRegistryName(), "inventory")); System.out.println("Registered block model ~ " + block.getRegistryName() + " ~ " + block.getUnlocalizedName()); }
@Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { switch (state.getValue(ExPBlockProperties.SHRUBBERY_TYPE)) { case TROPICAL: { return new ModelResourceLocation("exp:tropical_shrubbery", String.format("color=%s,leaf=%d", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName(), state.getValue(BlockGenericShrubbery.TROPIC_PLANT_LEAF))); } case FLOWER: { return new ModelResourceLocation("exp:flower_shrubbery", String.format("color=%s", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName())); } case SMALL_SHRUB: { return new ModelResourceLocation("exp:small_shrubbery", String.format("color=%s", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName())); } case MUSHROOM: { return new ModelResourceLocation("exp:mushroom_shrubbery", String.format("color=%s", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName())); } default: { return new ModelResourceLocation(b.getRegistryName(), "normal"); } } }
@SideOnly(Side.CLIENT) default public void initModels(ModelRegistryEvent e) { if (this instanceof Item) sMRL("items", (Item) this, 0, "item=" + ((Item) this).getRegistryName().getResourcePath()); else if (this instanceof Block) ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock((Block) this), 0, new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory")); else throw new IllegalStateException("wat are u doin"); }
public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName().toString())); }
@SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory")); }
protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return new ModelResourceLocation((ResourceLocation)Block.REGISTRY.getNameForObject(state.getBlock()), this.getPropertyString(state.getProperties())); }
public static void onModelBake(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader) { MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader)); modelLoader.onPostBakeEvent(modelRegistry); }
@SideOnly(Side.CLIENT) public static void initModels() { UCBaubles.initModels(); registerItemModel(seedsNormal); registerItemModel(seedsPrecision); registerItemModel(seedsKnowledge); registerItemModel(seedsDirigible); registerItemModel(seedsMillennium); registerItemModel(seedsEnderlily); registerItemModel(seedsCollis); registerItemModel(seedsInvisibilia); registerItemModel(seedsMaryjane); registerItemModel(seedsWeepingbells); registerItemModel(seedsMusica); registerItemModel(seedsCinderbella); registerItemModel(seedsMerlinia); registerItemModel(seedsFeroxia); registerItemModel(seedsEula); registerItemModel(seedsCobblonia); registerItemModel(seedsDyeius); registerItemModel(seedsAbstract); registerItemModel(seedsWafflonia); registerItemModel(seedsDevilsnare); registerItemModel(seedsPixelsius); registerItemModel(seedsArtisia); registerItemModel(seedsPetramia); registerItemModel(seedsMalleatoris); for (int i = 0; i < EnumItems.values().length; ++i) ModelLoader.setCustomModelResourceLocation(generic, i, new ModelResourceLocation(generic.getRegistryName() + "." + EnumItems.values()[i].getName(), "inventory")); registerItemModel(largeplum); registerItemModel(teriyaki); registerItemModel(heart); registerItemModel(potionreverse); registerItemModel(goldenbread); registerItemModel(dietpills); registerItemModel(waffle); registerItemModel(edibleDiamond); registerItemModel(edibleEmerald); registerItemModel(edibleLapis); registerItemModel(edibleIngotIron); registerItemModel(edibleIngotGold); registerItemModel(edibleNuggetGold); registerItemModel(endersnooker); registerItemModel(glasses3D); registerItemModel(poncho); registerItemModel(slippers); registerItemModel(pixelglasses); registerItemModel(precisionPick); registerItemModel(precisionAxe); registerItemModel(precisionShovel); }
@Override public void initModel(){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName().toString(),"inventory")); }
public FluidStateMapper(Fluid fluid) { this.fluid = fluid; this.location = new ModelResourceLocation(RL("fluid"), fluid.getName()); }
private static void registerRendersHelmet() { Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(INSTANCE_HELMET, 0, new ModelResourceLocation(PowerProbe.MODID + ":" + NAME + "_helmet", "inventory")); }
@Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return location; }
@SideOnly(Side.CLIENT) private void registerModel(Block block) { Item item = ItemBlock.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); }
private static void registerItem(Item item, int meta){ ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + (meta == 0 ? "" : meta + ""), "inventory")); }
private static void registerRender(String file, int meta) { ModelResourceLocation model = new ModelResourceLocation(file, "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ITEM_INSTANCE, meta, model); }
@SubscribeEvent public static void registerModels(@SuppressWarnings("unused") ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(INSTANCE, 0, new ModelResourceLocation(REGISTRY_NAME, "inventory")); }
@Nullable @Override public ModelResourceLocation getModelLocation() { return new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, NameBuilder.buildRegistryName("vegetable", vegetableType.toString())), "inventory"); }
@Nullable @Override public ModelResourceLocation getModelLocation() { return new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "juice"), "inventory"); }
public static void sMRL(String statePath, Item k, int meta, String variant) { ModelLoader.setCustomModelResourceLocation(k, meta, new ModelResourceLocation(ArcaneMagic.MODID + ":" + statePath, variant)); }