net.minecraft.client.renderer.block.model.ModelBakery Java Examples
The following examples show how to use
net.minecraft.client.renderer.block.model.ModelBakery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientProxy.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); if (ConfigValues.versionCheckerEnabled) VersionChecker.register(); ModEntities.initModels(); CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_crystal_ring")); CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_crystal_ring_outer")); CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_crystal")); CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/outputPearl")); CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_orb")); CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/mana_pearl_cube")); CustomBlockMapSprites.INSTANCE.register(new ResourceLocation(Wizardry.MODID, "blocks/nacre_pearl_cube")); // Load and bake the 2D models ModelBakery.registerItemVariants(ModItems.BOOK, new ModelResourceLocation("wizardry:book", "inventory")); ModelResourceLocation default3dPath = new ModelResourceLocation("wizardry:book", "inventory"); ModelLoader.setCustomMeshDefinition(ModItems.BOOK, stack -> default3dPath); ModKeybinds.register(); }
Example #2
Source File: Fluids.java From BaseMetals with GNU Lesser General Public License v2.1 | 6 votes |
@SideOnly(Side.CLIENT) public static void bakeModels(String modID){ for(Fluid fluid : fluidBlocks.keySet()){ BlockFluidBase block = fluidBlocks.get(fluid); Item item = Item.getItemFromBlock(block); final ModelResourceLocation fluidModelLocation = new ModelResourceLocation( modID.toLowerCase() + ":" + fluidBlockNames.get(block), "fluid"); ModelBakery.registerItemVariants(item); ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation(ItemStack stack) { return fluidModelLocation; } }); ModelLoader.setCustomStateMapper(block, new StateMapperBase() { protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return fluidModelLocation; } }); } }
Example #3
Source File: OreRegistry.java From ExNihiloAdscensio with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public static void initModels() { final ItemMeshDefinition ORES = new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { switch (stack.getItemDamage()) { case 0: return new ModelResourceLocation("exnihiloadscensio:itemOre", "type=piece"); case 1: return new ModelResourceLocation("exnihiloadscensio:itemOre", "type=hunk"); case 2: return new ModelResourceLocation("exnihiloadscensio:itemOre", "type=dust"); case 3: return new ModelResourceLocation("exnihiloadscensio:itemOre", "type=ingot"); default: return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory"); } } }; for (ItemOre ore : itemOreRegistry) { ModelLoader.setCustomMeshDefinition(ore, ORES); ModelBakery.registerItemVariants(ore, new ModelResourceLocation("exnihiloadscensio:itemOre", "type=piece"), new ModelResourceLocation("exnihiloadscensio:itemOre", "type=hunk"), new ModelResourceLocation("exnihiloadscensio:itemOre", "type=dust"), new ModelResourceLocation("exnihiloadscensio:itemOre", "type=ingot")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ore, ORES); } }
Example #4
Source File: BlockMinecoprocessor.java From Minecoprocessors with GNU General Public License v3.0 | 4 votes |
public static void preRegisterRenders() { ModelBakery.registerItemVariants(ITEM_INSTANCE, REGISTRY_NAME, REGISTRY_OVERCLOCKED_NAME); }
Example #5
Source File: ClientProxy.java From Signals with GNU General Public License v3.0 | 4 votes |
private static void registerItemModel(ItemStack stack, String suffix){ String resourceName = stack.getUnlocalizedName().substring(5) + suffix; ResourceLocation resLoc = new ResourceLocation(Constants.MOD_ID, resourceName); ModelBakery.registerItemVariants(stack.getItem(), resLoc); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(stack.getItem(), stack.getItemDamage(), new ModelResourceLocation(resLoc, "inventory")); }
Example #6
Source File: ClientProxy.java From AdvancedRocketry with MIT License | 3 votes |
private void registerFluidModel(IFluidBlock fluidBlock) { Item item = Item.getItemFromBlock((Block) fluidBlock); ModelBakery.registerItemVariants(item); final ModelResourceLocation modelResourceLocation = new ModelResourceLocation("advancedrocketry:fluid", fluidBlock.getFluid().getName()); //ModelLoader.setCustomMeshDefinition(item, MeshDefinitionFix.create(stack -> modelResourceLocation)); StateMapperBase ignoreState = new FluidStateMapper(modelResourceLocation); ModelLoader.setCustomStateMapper((Block) fluidBlock, ignoreState); ModelLoader.setCustomMeshDefinition(item, new FluidItemMeshDefinition(modelResourceLocation)); ModelBakery.registerItemVariants(item, modelResourceLocation); }
Example #7
Source File: ModelUtils.java From OpenModsLib with MIT License | 3 votes |
public static void registerMetaInsensitiveModel(Item item, String variant) { final ModelResourceLocation location = new ModelResourceLocation(item.getRegistryName(), variant); ModelBakery.registerItemVariants(item, location); ModelLoader.setCustomMeshDefinition(item, stack -> location); }