protected ModelResourceLocation getModelResourceLocation(IBlockState state) { Map<IProperty, Comparable> map = Maps.<IProperty, Comparable>newLinkedHashMap(state.getProperties()); String s; if (this.name == null) { s = ((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock())).toString(); } else { s = ((IProperty)this.name).getName((Comparable)map.remove(this.name)); } if (this.suffix != null) { s = s + this.suffix; } for (IProperty<?> iproperty : this.ignored) { map.remove(iproperty); } return new ModelResourceLocation(s, this.getPropertyString(map)); }
public static IBakedModel getCustomItemModel(ItemStack p_getCustomItemModel_0_, IBakedModel p_getCustomItemModel_1_, ModelResourceLocation p_getCustomItemModel_2_) { if (p_getCustomItemModel_1_.isGui3d()) { return p_getCustomItemModel_1_; } else if (itemProperties == null) { return p_getCustomItemModel_1_; } else { CustomItemProperties customitemproperties = getCustomItemProperties(p_getCustomItemModel_0_, 1); return customitemproperties == null ? p_getCustomItemModel_1_ : customitemproperties.getModel(p_getCustomItemModel_2_); } }
public IBakedModel getModel(ModelResourceLocation p_getModel_1_) { if (p_getModel_1_ != null && this.mapTextures != null) { String s = p_getModel_1_.getResourcePath(); if (this.mapModels != null) { IBakedModel ibakedmodel = (IBakedModel)this.mapModels.get(s); if (ibakedmodel != null) { return ibakedmodel; } } } return this.model; }
@EventHandler public void postInit(FMLPostInitializationEvent event) { if (event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); BlockAuraStone.BlockType.registerRenders(); renderItem.getItemModelMesher().register(orb, 0, new ModelResourceLocation(MODID + ":" + ((ItemAuraOrb) orb).getNameFromDamage(0), "inventory")); renderItem.getItemModelMesher().register(orb, 1, new ModelResourceLocation(MODID + ":" + ((ItemAuraOrb) orb).getNameFromDamage(1), "inventory")); renderItem.getItemModelMesher().register(Item.getItemFromBlock(auramPlant), 0 , new ModelResourceLocation(MODID + ":" + (((BlockAuramPlant) auramPlant).getName()), "inventory")); } }
@SuppressWarnings("unused") @SubscribeEvent public void modelBake(ModelBakeEvent event) { List<IBakedModel> capacitors = new ArrayList<IBakedModel>(); IBakedModel teBasic = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=1")); IBakedModel teHardened = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=2")); IBakedModel teReinforced = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=3")); IBakedModel teResonant = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=4")); IBakedModel eioBasic = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=5")); IBakedModel eioDouble = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=6")); IBakedModel eioVibrant = event.modelRegistry.getObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "facing=north,type=7")); capacitors.add(teBasic); capacitors.add(teHardened); capacitors.add(teReinforced); capacitors.add(teResonant); capacitors.add(eioBasic); capacitors.add(eioDouble); capacitors.add(eioVibrant); SmartModelCapacitor capacitorModel = new SmartModelCapacitor(capacitors); event.modelRegistry.putObject(new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "inventory"), capacitorModel); }
@Override public void registerISensitiveMeshes(Collection<Item> items) { for (Item it : items) { if (!(it instanceof ISensitiveMesh)) { continue; } final ISensitiveMesh ism = (ISensitiveMesh) it; ModelLoader.setCustomMeshDefinition(it, new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { String meshName = ism.getMeshName(stack); return new ModelResourceLocation("factorization:" + meshName + "#inventory"); } }); for (ItemStack is : ism.getMeshSamples()) { ModelLoader.addVariantName(it, "factorization:" + ism.getMeshName(is)); } } }
public static void inventoryRender() { Item itemBlockBrickVariants = GameRegistry.findItem(MReference.MODID, "ministrapp_log"); ModelBakery.addVariantName(itemBlockBrickVariants, "ministrapp:redwood_log"); ModelBakery.addVariantName(itemBlockBrickVariants, "ministrapp:frozen_oak_log"); Item itemBlockVariants = GameRegistry.findItem(MReference.MODID, "ministrapp_log"); MWoodType[] aenumtype = MWoodType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { MWoodType enumtype = aenumtype[j]; ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation(MReference.MODID + ":" + enumtype .getUnlocalizedName() + "_log", "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(itemBlockVariants, enumtype.getMetadata(), itemModelResourceLocation); } }
public static void inventoryRender() { Item item = GameRegistry.findItem(MReference.MODID, "virtian_soil"); ModelBakery.addVariantName(item, "ministrapp:virtian_soil_dirt"); ModelBakery.addVariantName(item, "ministrapp:virtian_soil_coarse_dirt"); ModelBakery.addVariantName(item, "ministrapp:virtian_soil_podzol"); Item itemBlockVariants = GameRegistry.findItem(MReference.MODID, "virtian_soil"); DirtType[] aenumtype = BlockDirt.DirtType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { BlockDirt.DirtType enumtype = aenumtype[j]; ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation(MReference.MODID + ":" + "virtian_soil_" + enumtype .getName(), "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(itemBlockVariants, enumtype.getMetadata(), itemModelResourceLocation); } }
/** * ------------------------------------------------------------------------- */ @Override public void registerItemModels() { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); for (Item item : RealLifeMod_Items.itemList) { renderItem.getItemModelMesher().register(item, 0, new ModelResourceLocation( Reference.ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } for (Block b : RealLifeMod_Blocks.blockList) { renderItem.getItemModelMesher().register(Item.getItemFromBlock(b), 0, new ModelResourceLocation(Reference.ID + ":" + b.getUnlocalizedName().substring(5), "inventory")); } ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RealLifeMod_Blocks.transformer), 0, new ModelResourceLocation(Reference.ID + ":blockTransformer", "inventory")); }
public static final void initBlocks(FMLInitializationEvent event) { blocks = new ArrayList<CustomBlock>(); marble = (CustomBlock)new CustomBlock("marble", Material.rock).setHardness(1.5f).setResistance(10.0f).setStepSound(Block.soundTypePiston); marbleBricks = (CustomBlock)new CustomBlock("marbleBricks", Material.rock).setHardness(1.5f).setResistance(10.0f).setStepSound(Block.soundTypePiston); if (event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); for (CustomBlock block : blocks) { renderItem.getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(NaturalRocks.prefix + block.getName(), "inventory")); } } }
public static void inventoryRender() { Item item = GameRegistry.findItem(MReference.MODID, "cold_sand"); ModelBakery.addVariantName(item, "ministrapp:cold_sand"); ModelBakery.addVariantName(item, "ministrapp:cold_red_sand"); Item itemBlockVariants = GameRegistry.findItem(MReference.MODID, "cold_sand"); EnumType[] aenumtype = BlockSand.EnumType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { BlockSand.EnumType enumtype = aenumtype[j]; ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation(MReference.MODID + ":" + "cold_" + enumtype.getName(), "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(itemBlockVariants, enumtype.getMetadata(), itemModelResourceLocation); } }
@SideOnly(Side.CLIENT) public static void initModels() { woodenGearSwapperBlock.initModel(); ironGearSwapperBlock.initModel(); lapisGearSwapperBlock.initModel(); stoneGearSwapperBlock.initModel(); glassGearSwapperBlock.initModel(); if (!Config.customBlockName.isEmpty()) { Block b = Block.blockRegistry.getObject(new ResourceLocation(Config.customBlockName)); if (b != null) { ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); mesher.register(Item.getItemFromBlock(moddedGearSwapperBlock), 0, new ModelResourceLocation(b.getRegistryName(), "inventory")); // moddedGearSwapperBlock.initModel(); } } }
public void load(FMLInitializationEvent event) { if (ConfigHandler.enableCoalDimension) { GameRegistry.registerBlock(portal, "coalDimension_portal"); GameRegistry.registerItem(block, "coalDimension_trigger"); DimensionManager.registerProviderType(DIMID, CoalDimension.WorldProviderMod.class, false); DimensionManager.registerDimension(DIMID, DIMID); if (event.getSide() == Side.CLIENT) Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(block, 0, new ModelResourceLocation("moredimensions:coalDimension_trigger", "inventory")); GameRegistry.addRecipe(new ItemStack(block, 1), new Object[] { "XXX", "XXX", "X78", Character.valueOf('7'), new ItemStack(Blocks.coal_block, 1), Character.valueOf('8'), new ItemStack(Items.flint, 1), }); } }
public static void inventoryRender(String type) { Item itemBlockpVariants = GameRegistry.findItem(MReference.MODID, "pumpkin_minestrapp_" + type); ModelBakery.addVariantName(itemBlockpVariants, "ministrapp:simple_carved_" + type); ModelBakery.addVariantName(itemBlockpVariants, "ministrapp:average_carved_" + type); ModelBakery.addVariantName(itemBlockpVariants, "ministrapp:complex_carved_" + type); Item itemBlockVariants = GameRegistry.findItem(MReference.MODID, "pumpkin_minestrapp_" + type); MPumpkinType[] aenumtype = MPumpkinType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { MPumpkinType enumtype = aenumtype[j]; ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation(MReference.MODID + ":" + enumtype .getUnlocalizedName() + "_carved_" + type, "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(itemBlockVariants, enumtype.getMetadata(), itemModelResourceLocation); } }
@Override public ModelResourceLocation getModel(ItemStack itemstack, EntityPlayer playerIn, int useRemaining) { if(playerIn instanceof EntityPlayer) { SkillTrackerData tracker = SkillTrackerData.get(playerIn); if(tracker != null) { //System.out.println("tracker not null"); if(tracker.fishingEntity != null) { //System.out.println("Cast Model"); return new ModelResourceLocation(Skillz.MODID+ ":sk_fishing_rod_cast", "inventory"); } } } return null; }
public static void inventoryRender() { Item itemBlockBrickVariants = GameRegistry.findItem(MReference.MODID, "ministrapp_leaves"); ModelBakery.addVariantName(itemBlockBrickVariants, "ministrapp:redwood_leaves"); ModelBakery.addVariantName(itemBlockBrickVariants, "ministrapp:frozen_oak_leaves"); Item itemBlockVariants = GameRegistry.findItem(MReference.MODID, "ministrapp_leaves"); MWoodType[] aenumtype = MWoodType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { MWoodType enumtype = aenumtype[j]; ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation(MReference.MODID + ":" + enumtype .getUnlocalizedName() + "_leaves", "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(itemBlockVariants, enumtype.getMetadata(), itemModelResourceLocation); } }
public static void inventoryRender() { Item itemBlockBrickVariants = GameRegistry.findItem(MReference.MODID, "ministrapp_sapling"); ModelBakery.addVariantName(itemBlockBrickVariants, "ministrapp:redwood_sapling"); ModelBakery.addVariantName(itemBlockBrickVariants, "ministrapp:frozen_oak_sapling"); Item itemBlockVariants = GameRegistry.findItem(MReference.MODID, "ministrapp_sapling"); MWoodType[] aenumtype = MWoodType.values(); int i = aenumtype.length; for (int j = 0; j < i; ++j) { MWoodType enumtype = aenumtype[j]; ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation(MReference.MODID + ":" + enumtype .getUnlocalizedName() + "_sapling", "inventory"); Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(itemBlockVariants, enumtype.getMetadata(), itemModelResourceLocation); } }
public void rebuildCache() { this.simpleShapesCache.clear(); for (Entry<Integer, ModelResourceLocation> entry : this.simpleShapes.entrySet()) { this.simpleShapesCache.put(entry.getKey(), this.modelManager.getModel((ModelResourceLocation)entry.getValue())); } }
public void reloadModels() { this.bakedModelStore.clear(); for (Entry<IBlockState, ModelResourceLocation> entry : this.blockStateMapper.putAllStateModelLocations().entrySet()) { this.bakedModelStore.put(entry.getKey(), this.modelManager.getModel((ModelResourceLocation)entry.getValue())); } }
public Map<IBlockState, ModelResourceLocation> putAllStateModelLocations() { Map<IBlockState, ModelResourceLocation> map = Maps.<IBlockState, ModelResourceLocation>newIdentityHashMap(); for (Block block : Block.blockRegistry) { if (!this.setBuiltInBlocks.contains(block)) { map.putAll(((IStateMapper)Objects.firstNonNull(this.blockStateMap.get(block), new DefaultStateMapper())).putStateModelLocations(block)); } } return map; }
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block blockIn) { for (IBlockState iblockstate : blockIn.getBlockState().getValidStates()) { this.mapStateModelLocations.put(iblockstate, this.getModelResourceLocation(iblockstate)); } return this.mapStateModelLocations; }
public static void registerRenders() { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); for (int i = 0; i < values().length; i++) { renderItem.getItemModelMesher().register(Item.getItemFromBlock(AuraMod.AuraStone), i, new ModelResourceLocation(values()[i].getResouceLocation(), "inventory")); } }
@Override public void registerBlockItem(Block block) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); ModelResourceLocation location = new ModelResourceLocation(block.getRegistryName(), "inventory"); renderItem.getItemModelMesher().register(Item.getItemFromBlock(block), 0, location); }
@SideOnly(Side.CLIENT) public static void reg(Item item) { //Code to register item model locations //Location = modid:item_unlocalized_name //Example = psc:sugar_cane //An Example Model was made for reinforced_sugar_cane Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(item, 0, new ModelResourceLocation(MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); }
@SideOnly(Side.CLIENT) public static void reg(Block block) { //Code to register item model locations //Location = modid:item_unlocalized_name //Example = psc:sugar_cane //An Example Model was made for reinforced_sugar_cane Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(MODID + ":" + block.getUnlocalizedName().substring(5), "inventory")); }
@Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); RFUtilities.RFU_NET_WRAPPER.registerMessage(PacketGetThroughput.HandlerPacketGetThroughput.class, PacketGetThroughput.class, 1, Side.CLIENT); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RFUContent.blockCapacitor), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockCapacitor", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RFUContent.blockSwitch), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockSwitch", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RFUContent.blockDiode), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockDiode", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RFUContent.blockInvisTess), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockInvisibleTesseract", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RFUContent.blockResistor), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockResistor", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RFUContent.blockTransistor), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockTransistor", "inventory")); //ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RFUContent.blockRFMeter), 0, new ModelResourceLocation(Reference.MOD_ID + ":blockRFMeter", "inventory")); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRFMeter.class, new RenderRFMeter()); }
@Override protected void registerItem(Item item, String name) { super.registerItem(item, name); if (item instanceof IModelLoader) ((IModelLoader) item).registerRender(); else ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(TwistedSouls.MODID + ":" + name, "inventory")); }
@Override protected void registerBlock(Block block, String name) { super.registerBlock(block, name); if (block instanceof IModelLoader) ((IModelLoader) block).registerRender(); else ModelLoader.setCustomModelResourceLocation(ItemBlock.getItemFromBlock(block), 0, new ModelResourceLocation(TwistedSouls.MODID + ":" + name, "inventory")); }
public static void registerItemRenderer(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation( Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); item.setCreativeTab(Tannery.tabTannery); }
public static void registerRender(Block block) { Item item = Item.getItemFromBlock(block); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); item.setCreativeTab(Tannery.tabTannery); }