Created
June 10, 2016 21:43
-
-
Save marchermans/514d3b0533025f391bd19dac062a6a9a to your computer and use it in GitHub Desktop.
MeshDefinition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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