Java Code Examples for net.minecraftforge.client.model.ModelLoader#setCustomModelResourceLocation()

The following examples show how to use net.minecraftforge.client.model.ModelLoader#setCustomModelResourceLocation() . 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 enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void registerAllItemBlockModels(BlockEnderUtilities blockIn, String variantPre, String variantPost)
{
    if (blockIn.isEnabled())
    {
        NonNullList<ItemStack> stacks = NonNullList.create();
        blockIn.getSubBlocks(blockIn.getCreativeTab(), stacks);
        String[] names = blockIn.getUnlocalizedNames();

        for (ItemStack stack : stacks)
        {
            Item item = stack.getItem();
            int meta = stack.getMetadata();
            ModelResourceLocation mrl = new ModelResourceLocation(item.getRegistryName(), variantPre + names[meta] + variantPost);
            ModelLoader.setCustomModelResourceLocation(item, meta, mrl);
        }
    }
}
 
Example 2
Source File: ClientProxy.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void registerItemModelWithNamePrefix(ItemEnderUtilities item, int meta, String namePrefix)
{
    if (item.isEnabled())
    {
        ResourceLocation rl = item.getRegistryName();
        ModelLoader.setCustomModelResourceLocation(item, meta,
                new ModelResourceLocation(rl.getNamespace() + ":" + namePrefix + rl.getPath(), "inventory"));
    }
}
 
Example 3
Source File: ItemOre.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel()	{
	
	ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation("exnihiloadscensio:itemOre", "type=piece"));
	ModelLoader.setCustomModelResourceLocation(this, 1, new ModelResourceLocation("exnihiloadscensio:itemOre", "type=hunk"));
	ModelLoader.setCustomModelResourceLocation(this, 2, new ModelResourceLocation("exnihiloadscensio:itemOre", "type=dust"));
	if (registerIngot)
		ModelLoader.setCustomModelResourceLocation(this, 3, new ModelResourceLocation("exnihiloadscensio:itemOre", "type=ingot"));
}
 
Example 4
Source File: ClientProxy.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
private void regRenderer(Item item, int meta, String modId, String name) {
  String resourceName;
  if (modId != null) {
    resourceName = modId + ":" + name;
  } else {
    resourceName = name;
  }
  ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(resourceName, "inventory"));
}
 
Example 5
Source File: BlockFload.java    From YouTubeModdingTutorial with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelResourceLocation fluidLocation = new ModelResourceLocation(FLOAD, "fluid");

    StateMapperBase customState = new StateMapperBase() {
        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState iBlockState) {
            return fluidLocation;
        }
    };
    ModelLoader.setCustomStateMapper(this, customState);
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(FLOAD, "inventory"));
}
 
Example 6
Source File: ClientProxy.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void registerItemModel(ItemEnderUtilities item, int meta)
{
    if (item.isEnabled())
    {
        ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    }
}
 
Example 7
Source File: BlockSuperchestPart.java    From YouTubeModdingTutorial with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
 
Example 8
Source File: PartOrderProc.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel() {
	ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
 
Example 9
Source File: ClientProxy.java    From Cyberware with MIT License 4 votes vote down vote up
private void registerRenders(Block block)
{
	Item item = Item.getItemFromBlock(block);
	ModelLoader.setCustomModelResourceLocation(item, 
			0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
}
 
Example 10
Source File: ItemFancyIngot.java    From YouTubeModdingTutorial with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
 
Example 11
Source File: ItemWand.java    From YouTubeModdingTutorial with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
 
Example 12
Source File: HammerBase.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel()
{
	ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));

}
 
Example 13
Source File: ClientUtil.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void simpleItemModel(Item i) {
	ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(Objects.requireNonNull(i.getRegistryName()), "inventory"));
}
 
Example 14
Source File: ClientProxy.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public void preInitBlocks()
{
	//Register Block models
	Item blockItem = Item.getItemFromBlock(AdvancedRocketryBlocks.blockLoader);
	ModelLoader.setCustomModelResourceLocation(blockItem, 0, new ModelResourceLocation("advancedrocketry:databus", "inventory"));
	ModelLoader.setCustomModelResourceLocation(blockItem, 1, new ModelResourceLocation("advancedrocketry:satelliteHatch", "inventory"));
	ModelLoader.setCustomModelResourceLocation(blockItem, 2, new ModelResourceLocation("libvulpes:inputHatch", "inventory"));
	ModelLoader.setCustomModelResourceLocation(blockItem, 3, new ModelResourceLocation("libvulpes:outputHatch", "inventory"));
	ModelLoader.setCustomModelResourceLocation(blockItem, 4, new ModelResourceLocation("libvulpes:fluidInputHatch", "inventory"));
	ModelLoader.setCustomModelResourceLocation(blockItem, 5, new ModelResourceLocation("libvulpes:fluidOutputHatch", "inventory"));
	ModelLoader.setCustomModelResourceLocation(blockItem, 6, new ModelResourceLocation("advancedrocketry:guidancecomputeraccesshatch", "inventory"));

	blockItem = Item.getItemFromBlock(AdvancedRocketryBlocks.blockCrystal);
	for(int i = 0; i < BlockCrystal.numMetas; i++)
		ModelLoader.setCustomModelResourceLocation(blockItem, i, new ModelResourceLocation("advancedrocketry:crystal", "inventory"));


	blockItem = Item.getItemFromBlock(AdvancedRocketryBlocks.blockAirLock);

	blockItem = Item.getItemFromBlock(AdvancedRocketryBlocks.blockLaunchpad);
	ModelLoader.setCustomModelResourceLocation(blockItem, 0, new ModelResourceLocation("advancedrocketry:launchpad_all", "inventory"));

	blockItem = Item.getItemFromBlock(AdvancedRocketryBlocks.blockPlatePress);
	ModelLoader.setCustomModelResourceLocation(blockItem, 0, new ModelResourceLocation("advancedrocketry:platePress", "inventory"));
	
	//TODO fluids
	registerFluidModel((IFluidBlock) AdvancedRocketryBlocks.blockOxygenFluid);
	registerFluidModel((IFluidBlock) AdvancedRocketryBlocks.blockNitrogenFluid);
	registerFluidModel((IFluidBlock) AdvancedRocketryBlocks.blockHydrogenFluid);
	registerFluidModel((IFluidBlock) AdvancedRocketryBlocks.blockFuelFluid);
	/*ModelLoader.setCustomMeshDefinition(Item, new ItemMeshDefinition() {

	@Override
	public ModelResourceLocation getModelLocation(ItemStack stack) {
		return new ModelResourceLocation("advancedRocketry:fluid", "rocketFuel");
	}
});*/


	/*Item item = Item.getItemFromBlock((Block) AdvancedRocketryBlocks.blockFuelFluid);
ModelBakery.registerItemVariants(item, );
ModelResourceLocation modeEgylResourceLocation = new ModelResourceLocation(FLUID_MODEL_PATH, fluidBlock.getFluid().getName());
ModelLoader.setCustomMeshDefinition(AdvancedRocketryItems.itemBucketRocketFuel, new ItemMeshDefinition() {
	@Override
	public ModelResourceLocation getModelLocation(ItemStack stack) {
		FluidStack fluidStack = AdvancedRocketryItems.itemBucketRocketFuel.getFluid(stack);
		return fluidStack != null ? new ModelResourceLocation("advancedrocketry:bucket/" + fluidStack.getFluid().getName(), "inventory") : null;
	}
});
//Register Fluid Block
ModelLoader.setCustomStateMapper(AdvancedRocketryBlocks.blockFuelFluid, new StateMapperBase() {

	@Override
	protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
		return new ModelResourceLocation("advancedrocketry:fluid");
	}
});*/
}
 
Example 15
Source File: PartFPGA.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel() {
	ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
 
Example 16
Source File: ItemSeedBase.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
public void initModel() {
	ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation("exnihiloadscensio:itemSeed", "type="+name));
}
 
Example 17
Source File: BlockBaseFalling.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel()
{
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
    //ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "normal"));
}
 
Example 18
Source File: ItemWrench.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@Override
public void initModel() {
	ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
 
Example 19
Source File: SubModTightPants.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void registerModels (ModelRegistryEvent event) {
    
	ModelLoader.setCustomModelResourceLocation(tightPants, 0, new ModelResourceLocation(pantsId, "inventory"));
}
 
Example 20
Source File: BlockOreRutile.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void initModel(){
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}