FilipZocktan
-
Posts
4 -
Joined
-
Last visited
Posts posted by FilipZocktan
-
-
There is no error log...
Previous it was
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("zocrpmod:" + itemName, "inventory"));
And now @Draco18s told me to do it like this:
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation("zocrpmod:" + itemName, "inventory"));
And since I applied this, I don't get the textures anymore, but this black-pink square...
-
Could you maybe explain the Registry events to me? I don't understand them...
//EDIT: I got the problem fixed by putting a random String in a place where the person the tutorial was from said it didn't matter what's in there.
Instead of:
public static ArmorMaterial PoSiTIonBarrierSuit = EnumHelper.addArmorMaterial("PoSiTIonBarrierSuit", null, 1000000000, new int[] {3, 8, 6, 3}, 3, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 10.0F);
I made it:
public static ArmorMaterial PoSiTIonBarrierSuit = EnumHelper.addArmorMaterial("PoSiTIonBarrierSuit", "wurscht", 1000000000, new int[] {3, 8, 6, 3}, 3, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 10.0F);
Now it's almost working, except for the items, which now don't have a texture...
(I already applied the patch 2)
-
Hey Guys,
I'm quite new to Forge Modding and just trying to create an Armor (in the Version 1.10.2). I found a tutorial for the 1.8 and added the things not given there from Internet research.
Now I'm ready, but when I start Minecraft for testing, and open my Inventory with the Armor on I get the following Stacktrace:
Spoiler[22:35:27] [Client thread/ERROR]: Couldn't render entity java.lang.NullPointerException at net.minecraft.client.renderer.entity.layers.LayerArmorBase.getArmorResource(LayerArmorBase.java:192) ~[LayerArmorBase.class:?] at net.minecraft.client.renderer.entity.layers.LayerArmorBase.renderArmorLayer(LayerArmorBase.java:66) ~[LayerArmorBase.class:?] at net.minecraft.client.renderer.entity.layers.LayerArmorBase.doRenderLayer(LayerArmorBase.java:39) ~[LayerArmorBase.class:?] at net.minecraft.client.renderer.entity.RenderLivingBase.renderLayers(RenderLivingBase.java:456) ~[RenderLivingBase.class:?] at net.minecraft.client.renderer.entity.RenderLivingBase.doRender(RenderLivingBase.java:196) [RenderLivingBase.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:74) [RenderPlayer.class:?] at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:28) [RenderPlayer.class:?] at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:372) [RenderManager.class:?] at net.minecraft.client.gui.inventory.GuiInventory.drawEntityOnScreen(GuiInventory.java:121) [GuiInventory.class:?] at net.minecraft.client.gui.inventory.GuiInventory.drawGuiContainerBackgroundLayer(GuiInventory.java:90) [GuiInventory.class:?] at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:94) [GuiContainer.class:?] at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:59) [InventoryEffectRenderer.class:?] at net.minecraft.client.gui.inventory.GuiInventory.drawScreen(GuiInventory.java:75) [GuiInventory.class:?] at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:382) [ForgeHooksClient.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1147) [EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?]
My code is the following:
Main Class (extracts):
Spoiler/* Armor Materials */ public static ArmorMaterial PoSiTIonBarrierSuit = EnumHelper.addArmorMaterial("PoSiTIonBarrierSuit", null, 1000000000, new int[] {3, 8, 6, 3}, 3, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 10.0F); /* Items */ public static ItemArmor ItemPoSiTIonBarrierSuitHelmet = new ItemPoSiTIonBarrierSuit(PoSiTIonBarrierSuit, 0, EntityEquipmentSlot.HEAD); public static ItemArmor ItemPoSiTIonBarrierSuitChestplate = new ItemPoSiTIonBarrierSuit(PoSiTIonBarrierSuit, 0, EntityEquipmentSlot.CHEST); public static ItemArmor ItemPoSiTIonBarrierSuitLeggings = new ItemPoSiTIonBarrierSuit(PoSiTIonBarrierSuit, 0, EntityEquipmentSlot.LEGS); public static ItemArmor ItemPoSiTIonBarrierSuitBoots = new ItemPoSiTIonBarrierSuit(PoSiTIonBarrierSuit, 0, EntityEquipmentSlot.FEET); EventHandler public void init(FMLInitializationEvent ev) { registerArmorItem(ItemPoSiTIonBarrierSuitHelmet, "position_barrier_helmet"); registerArmorItem(ItemPoSiTIonBarrierSuitChestplate, "position_barrier_chestplate"); registerArmorItem(ItemPoSiTIonBarrierSuitLeggings, "position_barrier_leggings"); registerArmorItem(ItemPoSiTIonBarrierSuitBoots, "position_barrier_boots"); } public static void registerArmorItem(Item item, String itemName) { GameRegistry.registerItem(item, itemName); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation("zocrpmod:" + itemName, "inventory")); }
ItemPoSiTIonBarrierSuit:
Spoilerpackage ga.zcktn.mcmodding.forge.rp.zocrpmod.items; import ga.zcktn.mcmodding.forge.rp.zocrpmod.ZocRPMod; import net.minecraft.entity.Entity; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; public class ItemPoSiTIonBarrierSuit extends ItemArmor { public ItemPoSiTIonBarrierSuit(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) { super(materialIn, renderIndexIn, equipmentSlotIn); switch (equipmentSlotIn) { case CHEST: setUnlocalizedName("position_barrier_chestplate"); break; case FEET: setUnlocalizedName("position_barrier_boots"); break; case HEAD: setUnlocalizedName("position_barrier_helmet"); break; case LEGS: setUnlocalizedName("position_barrier_leggings"); break; case MAINHAND: throw new NullPointerException("No EntityEquipmentSlot defined."); case OFFHAND: throw new NullPointerException("No EntityEquipmentSlot defined."); default: throw new NullPointerException("No EntityEquipmentSlot defined."); } setCreativeTab(ZocRPMod.TimeMasterTab); } @Override public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { if(slot == EntityEquipmentSlot.CHEST || slot == EntityEquipmentSlot.HEAD || slot == EntityEquipmentSlot.FEET) { return "zocrpmod:textures/models/armor/position_barrier_layer_1.png"; } else if(slot == EntityEquipmentSlot.LEGS) { return "zocrpmod:textures/models/armor/position_barrier_layer_2.png"; } else { throw new NullPointerException("Wrong EntityEquipmentSlot defined."); } } }
Note: The path to the file is correct. I already checked that.
Thanks for your replies in advance.
Filip Zocktan
[1.10.2] Rendering Armor throws NullPointerException
in Modder Support
Posted
Okay, here you are: