@Override public void registerItemRenderer(Item i, int meta, String id) { ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(ModInfo.MODID + ":" + id, "inventory")); }
@SideOnly(Side.CLIENT) public void registerRenders() { enumInstanceMap.values().stream().map(Map::entrySet).map(Collection::stream).forEach(entries -> entries.forEach(entry -> { if (Item.class.isAssignableFrom(entry.getValue().getClass())) { if (entry.getValue() instanceof CustomModelMasking) { registerRender((Item) entry.getValue(), 0, ((CustomModelMasking) entry.getValue()).getModelLocation()); FoodCraftReloaded.getLogger().debug("Registered custom model " + entry.getValue().getClass() + " as " + ((CustomModelMasking) entry.getValue()).getModelLocation()); } else if (((Item) entry.getValue()).getRegistryName() != null) { registerRender((Item) entry.getValue(), 0, new ModelResourceLocation(((Item) entry.getValue()).getRegistryName(), "inventory")); } } else if (BlockFluidBase.class.isAssignableFrom(entry.getValue().getClass())) { // TODO Null condition registerFluidRender((BlockFluidBase) entry.getValue(), ((Block)entry.getValue()).getRegistryName().getResourcePath()); } else if (Block.class.isAssignableFrom(entry.getValue().getClass())) { if (entry.getValue() instanceof CustomModelMasking) ModelLoader.setCustomStateMapper((Block) entry.getValue(), block -> ((CustomModelMasking) entry.getValue()).getStateModelLocations()); } })); }
@Override public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(),"inventory")); ModelLoader.setCustomModelResourceLocation(this, 1, new ModelResourceLocation(getRegistryName(),"inventory")); ModelLoader.setCustomModelResourceLocation(this, 2, new ModelResourceLocation(getRegistryName(),"inventory")); ModelLoader.setCustomModelResourceLocation(this, 3, new ModelResourceLocation(getRegistryName(),"inventory")); ModelLoader.setCustomModelResourceLocation(this, 4, new ModelResourceLocation(getRegistryName(),"inventory")); }
@SideOnly(Side.CLIENT) @SubscribeEvent public static void registerInventoryModels(final ModelRegistryEvent event) { for (Item item : items) { if (item instanceof IMultiItem) { final Class enumClass = (Class<?>)ReflectionUtils.getGenericInterfaceType(item.getClass(), IMultiItem.class); for (ISubItem value : (ISubItem[])enumClass.getEnumConstants()) { ModelLoader.setCustomModelResourceLocation(item, value.getMetadata(), new ModelResourceLocation(item.getRegistryName(), "inventory")); } } else { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } } }
public void registerItemModel(Item item) { ResourceLocation loc = Item.REGISTRY.getNameForObject(item); if (item instanceof ItemBlockEquivalentState) { NonNullList<ItemStack> subItems = NonNullList.create(); item.getSubItems(ThermionicsWorld.TAB_THERMIONICS_WORLD, subItems); for(ItemStack stack : subItems) { Item stackItem = stack.getItem(); if (stackItem!=item) continue; //The contract of getSubItems prohibits this condition. String keys = ((ItemBlockEquivalentState)item).getStateStringForItem(stack); //System.out.println("Registering model for "+loc+"#"+keys+" == meta:"+stack.getItemDamage()); ModelLoader.setCustomModelResourceLocation(stackItem, stack.getItemDamage(), new ModelResourceLocation(loc, keys) ); } } else if (item instanceof ItemBlockGemrock) { for(int i=0; i<16; i++) { ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc,"variant="+i)); } } else if (item instanceof ItemBlockVarieties) { for(int i=0; i<16; i++) { ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc,"variant="+i)); } } else { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(loc, "inventory")); } }
@SideOnly(Side.CLIENT) private static void registerRender(Item item, int meta, String name) { ModelResourceLocation model = new ModelResourceLocation(name, "inventory"); ModelLoader.setCustomModelResourceLocation(item, meta, model); }
public static void registerShrubberyModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 0, new ModelResourceLocation(new ResourceLocation("exp", "tropical_shrubbery"), "color=none,leaf=0")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 1, new ModelResourceLocation(new ResourceLocation("exp", "flower_shrubbery"), "color=white")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 2, new ModelResourceLocation(new ResourceLocation("exp", "small_shrubbery"), "color=white")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 3, new ModelResourceLocation(new ResourceLocation("exp", "mushroom_shrubbery"), "color=red")); }
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")); } }
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"); }
@SubscribeEvent public static void registerModels(ModelRegistryEvent event){ StateMapperBase mapper=new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return new ModelResourceLocation(new ResourceLocation(Constants.MODID, "creosote"), "creosote"); } }; if(FluidsRegistry.BlockCreosote!=null) ModelLoader.setCustomStateMapper(FluidsRegistry.BlockCreosote, mapper); }
public static <BBItem extends Item & IBBName> void registerItem(BBItem item) { if(item instanceof ISpecialRender) ((ISpecialRender) item).registerRender(); else ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); }
@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); } }
@Override @SideOnly(Side.CLIENT) public void setupModels() { for(MagibenchRegistry.Tier t : PurMag.INSTANCE.getMagibenchRegistry().getTiers()) { ModelLoader.setCustomModelResourceLocation(this, t.getTier(), new ModelResourceLocation(t.getSmartModel(), "normal")); } }
@Override public void registerFluidBlockRendering(Block block, String name) { final ModelResourceLocation fluidLocation = new ModelResourceLocation(HarshenCastle.MODID.toLowerCase() + ":fluids", name); ModelLoader.setCustomStateMapper(block, new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return fluidLocation; } }); }
public static void registerFluidModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.saltWater), 0, new ModelResourceLocation(ExPBlocks.saltWater.getRegistryName(), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.freshWater), 0, new ModelResourceLocation(ExPBlocks.freshWater.getRegistryName(), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.lava), 0, new ModelResourceLocation(ExPBlocks.lava.getRegistryName(), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.oil), 0, new ModelResourceLocation(ExPBlocks.oil.getRegistryName(), "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")); }
@SubscribeEvent public void onModelRegistry(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Torched.itemTorchGun, 0, new ModelResourceLocation("torched:torchgun", "inventory")); ModelLoader.setCustomModelResourceLocation(Torched.itemTorchFirework, 0, new ModelResourceLocation("torched:torchfirework", "inventory")); ModelLoader.setCustomModelResourceLocation(Torched.itemTorchFirework, 1, new ModelResourceLocation("torched:torchrpt", "inventory")); ModelLoader.setCustomModelResourceLocation(Torched.itemTorchLauncher, 0, new ModelResourceLocation("torched:torchlauncher", "inventory")); ModelBakery.registerItemVariants(Torched.itemTorchFirework, new ResourceLocation("torched", "torchfirework"), new ResourceLocation("torched", "torchrpt")); }
@Override public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { IBakedModel[] connections = new IBakedModel[6]; IBakedModel[] endings = new IBakedModel[6]; IBakedModel[] nodeSides = new IBakedModel[6]; //IBakedModel node = null; // d u n s w e ModelRotation[] rotations = new ModelRotation[] { ModelRotation.X90_Y0, ModelRotation.X270_Y0, ModelRotation.X0_Y0, ModelRotation.X0_Y180, ModelRotation.X0_Y270, ModelRotation.X0_Y90 }; try { IModel nodeSideModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_node_side")); IModel connectionModel = ModelLoaderRegistry .getModel(new ResourceLocation(Etheric.MODID, "block/pipe_connection")); IModel endingModel = ModelLoaderRegistry.getModel(new ResourceLocation(Etheric.MODID, "block/pipe_end")); //node = nodeModel.bake(new TRSRTransformation(ModelRotation.X0_Y0), DefaultVertexFormats.BLOCK, // ModelLoader.defaultTextureGetter()); for (int i = 0; i < connections.length; i++) { connections[i] = connectionModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter()); endings[i] = endingModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter()); nodeSides[i] = nodeSideModel.bake(new TRSRTransformation(rotations[i]), DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter()); } } catch (Exception e) { Etheric.logger.warn(e.getMessage()); } if (connections[0] == null) { return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter); } return new BakedPipeModel(nodeSides, connections, endings); }
@SideOnly(Side.CLIENT) @Override public void registerRender() { JointList<ResourceLocation> names = new JointList(); if(sameIcon) { for(int meta = 0; meta < nSubItems; meta++) { ModelLoader.setCustomModelResourceLocation(this, meta, new ModelResourceLocation(this.getRegistryName(), "inventory")); } } else { for(int meta = 0; meta < nSubItems; meta++) { ModelLoader.setCustomModelResourceLocation(this, meta, new ModelResourceLocation(this.getRegistryName() + "_" + meta, "inventory")); } } }
@Override public void registerItemBlock(ItemBlock item) { for (int i = 0; i < 16; i++) ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName(), "inventory")); }
@Override @SideOnly(Side.CLIENT) public void initModel() { for (int i = 0; i < 6; i++) { ModelLoader.setCustomModelResourceLocation(this, i, new ModelResourceLocation(new ResourceLocation(ModGlobals.MODID, "dank_null_") + "" + i, "inventory")); } }
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))); } }
@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"); } }); }
@SubscribeEvent @SideOnly(Side.CLIENT) public static void registerModels (ModelRegistryEvent event) { ModelRegistry modelRegistry = Chameleon.instance.modelRegistry; modelRegistry.registerItemVariants(stoneMaterial); modelRegistry.registerItemVariants(metalMaterial); modelRegistry.registerItemVariants(bloomeryFurnace); modelRegistry.registerItemVariants(metalFence); modelRegistry.registerItemVariants(candelabra); modelRegistry.registerItemVariants(candelilla); ModelLoader.setCustomStateMapper(metalFence, (new StateMap.Builder()).withName(BlockFence.VARIANT).withSuffix("_wrought_iron_fence").build()); ModelLoader.setCustomStateMapper(metalLattice, (new StateMap.Builder()).withName(BlockLattice.VARIANT).withSuffix("_lattice").build()); ModelLoader.setCustomStateMapper(candelabra, (new StateMap.Builder()).withName(BlockCandelabra.VARIANT).withSuffix("_candelabra").build()); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalFence), 0, new ModelResourceLocation("gardenstuff:metal_fence_0", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalFence), 1, new ModelResourceLocation("gardenstuff:metal_fence_1", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalFence), 2, new ModelResourceLocation("gardenstuff:metal_fence_2", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalFence), 3, new ModelResourceLocation("gardenstuff:metal_fence_3", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalLattice), 0, new ModelResourceLocation("gardenstuff:lattice_iron", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalLattice), 1, new ModelResourceLocation("gardenstuff:lattice_wrought_iron", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalLattice), 2, new ModelResourceLocation("gardenstuff:lattice_rust", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalLattice), 3, new ModelResourceLocation("gardenstuff:lattice_aged", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(metalLattice), 4, new ModelResourceLocation("gardenstuff:lattice_moss", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(candelabra), 0, new ModelResourceLocation("gardenstuff:candelabra_level0", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(candelabra), 1, new ModelResourceLocation("gardenstuff:candelabra_level1", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(candelabra), 2, new ModelResourceLocation("gardenstuff:candelabra_level2", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(candelabra), 3, new ModelResourceLocation("gardenstuff:candelabra_level3", "inventory")); }
@Override @SideOnly(Side.CLIENT) public void setupModels() { StateMapperBase st = new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { MagibenchRegistry.Tier t = PurMag.INSTANCE.getMagibenchRegistry().getTier(state.getValue(TIER)); return new ModelResourceLocation(t.getSmartModel(), "normal"); } }; ModelLoader.setCustomStateMapper(this, st); }
public static void registerOreModels() { for (int i = 0; i < EnumRockClass.values().length * EnumOre.values().length * 3; ++i) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.ore), i, new ModelResourceLocation(ExPBlocks.ore.getRegistryName(), "class=" + EnumRockClass.values()[i % EnumRockClass.values().length].getName() + ",oretexture=" + EnumOre.values()[(i / EnumRockClass.values().length) % EnumOre.values().length].getTextureIndex())); if (i < EnumRockClass.values().length * EnumOre.values().length) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.boulderOre), i, new ModelResourceLocation(ExPBlocks.boulderOre.getRegistryName(), "class=" + EnumRockClass.values()[i % EnumRockClass.values().length].getName() + ",oretexture=" + EnumOre.values()[(i / EnumRockClass.values().length) % EnumOre.values().length].getTextureIndex())); } } }
@Override @SideOnly(Side.CLIENT) public void initModel() { for (int i : meta_map.keySet()) { String domain = meta_map.get(i).getModId(); String path = "th_" + getRegistryName().getResourcePath(); ModelLoader.setCustomModelResourceLocation(this, i, new ModelResourceLocation(domain + ":" + path + "_" + meta_map.get(i).getName(), "inventory")); } }
@SideOnly(Side.CLIENT) private static void setModelLocation(Item item, String variantSettings) { ModelLoader.setCustomMeshDefinition(item, stack -> new ModelResourceLocation(item.getRegistryName().toString(), variantSettings)); }
public static void registerModel(Item item, int meta, ModelResourceLocation location) { ModelLoader.setCustomModelResourceLocation(item, meta, location); }
@SubscribeEvent public void onModelRegistry(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Clef.itemInstrument, 0, new ModelResourceLocation("clef:instrument", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(Clef.blockInstrumentPlayer), 0, new ModelResourceLocation("clef:block_instrument_player", "inventory")); }
@Override public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(id, "inventory")); }
public static void registerModel(Item item, int meta, String variant) { ModelResourceLocation location = new ModelResourceLocation(item.getRegistryName(), variant); ModelLoader.setCustomModelResourceLocation(item, meta, location); }
public static void registerItemResourceLoc(Block block, ResourceLocation resLoc) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(resLoc, "inventory")); }
@SideOnly(Side.CLIENT) private void registerModel(Block block) { Item item = ItemBlock.getItemFromBlock(block); ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); }
private void registerItemModel(Block block) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); }
@SubscribeEvent public static void registerModels(@SuppressWarnings("unused") ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(INSTANCE, 0, new ModelResourceLocation(REGISTRY_NAME, "inventory")); }
@Override @SideOnly(Side.CLIENT) public void loadModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GlobalXP.xp_block), 0, new ModelResourceLocation("globalxp:xp_block", "inventory")); }
@SideOnly(Side.CLIENT) public void registerModel() { ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), null); ModelLoader.setCustomModelResourceLocation(this, 0, location); }
public void registerRender() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(this.getRegistryName(), "inventory")); }