diff options
| author | Lance5057 <Lance5057@gmail.com> | 2018-06-05 22:13:46 -0500 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2018-06-05 22:13:46 -0500 |
| commit | c00efedf54aa760be041762be388f7f8adaab553 (patch) | |
| tree | a1325c8b09ea1fde6d162f73839d9f2be069245c /src/main/java/lance5057/tDefense/util/TDModelRegistar.java | |
| parent | f428bdd45dbe00fd0b674bce6ed7623caedca804 (diff) | |
Armor Rendering Part 1master
Diffstat (limited to 'src/main/java/lance5057/tDefense/util/TDModelRegistar.java')
| -rw-r--r-- | src/main/java/lance5057/tDefense/util/TDModelRegistar.java | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/main/java/lance5057/tDefense/util/TDModelRegistar.java b/src/main/java/lance5057/tDefense/util/TDModelRegistar.java deleted file mode 100644 index ad628b0..0000000 --- a/src/main/java/lance5057/tDefense/util/TDModelRegistar.java +++ /dev/null @@ -1,62 +0,0 @@ -package lance5057.tDefense.util; - -import javax.annotation.Nonnull; - -import lance5057.tDefense.core.tools.bases.ArmorCore; -import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ModelLoader; -import slimeknights.tconstruct.TConstruct; -import slimeknights.tconstruct.library.client.model.ToolModelLoader; -import slimeknights.tconstruct.library.tools.ToolCore; - -public class TDModelRegistar { - public static ResourceLocation registerToolModel(ArmorCore armor) { - if (armor == null || armor.getRegistryName() == null) { - return null; - } - ResourceLocation itemLocation = armor.getRegistryName(); - String path = "tools/" + itemLocation.getResourcePath() + ToolModelLoader.EXTENSION; - - ResourceLocation location = new ResourceLocation(itemLocation.getResourceDomain(), path); - TDModelLoader.addPartMapping(location, armor); - - return registerToolModel(armor, location); - } - - /** - * Manual registration of a tool model. You probably shouldn't be using this. - */ - public static ResourceLocation registerToolModel(Item item, final ResourceLocation location) { - if (!location.getResourcePath().endsWith(ToolModelLoader.EXTENSION)) { - TConstruct.log.error("The material-model " + location.toString() + " does not end with '" - + ToolModelLoader.EXTENSION + "' and will therefore not be loaded by the custom model loader!"); - } - - return registerIt(item, location); - } - - private static ResourceLocation registerIt(Item item, final ResourceLocation location) { - // plop it in. - // This here is needed for the model to be found ingame when the game looks for - // a model to render an Itemstack - // we use an ItemMeshDefinition because it allows us to do it no matter what - // metadata we use - ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { - @Nonnull - @Override - public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) { - return new ModelResourceLocation(location, "inventory"); - } - }); - - // We have to readd the default variant if we have custom variants, since it - // wont be added otherwise and therefore not loaded - ModelLoader.registerItemVariants(item, location); - - return location; - } -} |
