Implemented the ItemMeshDefinition for the Sentient Sword, allowing for me to make the sword enchantable while still allowing the texture to change. This may be expanded to other items.

This commit is contained in:
WayofTime 2016-01-10 18:31:48 -05:00
parent cb77b7821f
commit 1abae8e4ee
5 changed files with 66 additions and 9 deletions

View file

@ -56,6 +56,25 @@ public class InventoryRenderHelper
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(resName, "inventory"));
}
/**
* Registers a Model for the given Item and meta. This does not call
* setCustomModelResourceLocation, to allow the implementation of
* ItemMeshDefinition.
*
* @param item
* - Item to register Model for
* @param meta
* - Meta of Item
* @param name
* - Name of the model JSON
*/
public void customItemRender(Item item, int meta, String name)
{
ResourceLocation resName = new ResourceLocation(domain + name);
ModelBakery.registerItemVariants(item, resName);
}
/**
* Shorthand of {@code itemRender(Item, int, String)}
*
@ -69,6 +88,11 @@ public class InventoryRenderHelper
itemRender(item, meta, getClassName(item) + meta);
}
public void customItemRender(Item item, int meta)
{
customItemRender(item, meta, getClassName(item) + meta);
}
public void itemRender(Item item, String name)
{
itemRender(item, 0, name);