Skip to content

Instantly share code, notes, and snippets.

@marchermans
Created June 10, 2016 21:43
Show Gist options
  • Save marchermans/514d3b0533025f391bd19dac062a6a9a to your computer and use it in GitHub Desktop.
Save marchermans/514d3b0533025f391bd19dac062a6a9a to your computer and use it in GitHub Desktop.
MeshDefinition
public static ResourceLocation registerItemModelDefinition(Item item, final ResourceLocation location, String requiredExtension) {
if (!location.getResourcePath().endsWith(requiredExtension)) {
Armory.getLogger().error("The item-model " + location.toString() + " does not end with '"
+ requiredExtension
+ "' and will therefore not be loaded by the custom model loader!");
}
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation (ItemStack stack) {
return new ModelResourceLocation(location, "inventory");
}
});
// We have to read the default variant if we have custom variants, since it wont be added otherwise and therefore not loaded
ModelBakery.registerItemVariants(item, location);
Armory.getLogger().info("Added model definition for: " + item.getUnlocalizedName() + " add: " + location.getResourcePath() + " in the Domain: " + location.getResourceDomain());
return location;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment