The_Fireplace Posted February 22, 2014 Posted February 22, 2014 My game crashes with the following error only if my chestplate isn't worn while the other 3 pieces of the armor set are: Reveal hidden contents ---- Minecraft Crash Report ---- // Uh... Did I do that? Time: 2/21/14 11:32 PM Description: Ticking entity java.lang.NullPointerException at devonmod.armor.FireArmor.onArmorTickUpdate(FireArmor.java:79) at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:367) at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:606) at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:307) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1826) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:342) at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:78) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350) at net.minecraft.world.World.updateEntity(World.java:2311) at net.minecraft.world.World.updateEntities(World.java:2157) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1921) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:910) at net.minecraft.client.Minecraft.run(Minecraft.java:838) at net.minecraft.client.main.Main.main(Main.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) at net.minecraft.launchwrapper.Launch.main(Launch.java:27) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at devonmod.armor.FireArmor.onArmorTickUpdate(FireArmor.java:79) at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:367) at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:606) at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:307) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1826) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:342) at net.minecraft.client.entity.EntityClientPlayerMP.onUpdate(EntityClientPlayerMP.java:78) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350) at net.minecraft.world.World.updateEntity(World.java:2311) -- Entity being ticked -- Details: Entity Type: null (net.minecraft.client.entity.EntityClientPlayerMP) Entity ID: 33 Entity Name: Player127 Entity's Exact location: 209.50, 5.62, -1383.50 Entity's Block location: World: (209,5,-1384), Chunk: (at 1,0,8 in 13,-87; contains blocks 208,0,-1392 to 223,255,-1377), Region: (0,-3; contains chunks 0,-96 to 31,-65, blocks 0,0,-1536 to 511,255,-1025) Entity's Momentum: 0.00, -0.08, 0.00 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2157) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player127'/33, l='MpServer', x=209.50, y=5.62, z=-1383.50]] Chunk stats: MultiplayerChunkCache: 441 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (213,4,-1388), Chunk: (at 5,0,4 in 13,-87; contains blocks 208,0,-1392 to 223,255,-1377), Region: (0,-3; contains chunks 0,-96 to 31,-65, blocks 0,0,-1536 to 511,255,-1025) Level time: 314 game time, 314 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 1 total; [EntityClientPlayerMP['Player127'/33, l='MpServer', x=209.50, y=5.62, z=-1383.50]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2312) at net.minecraft.client.Minecraft.run(Minecraft.java:856) at net.minecraft.client.main.Main.main(Main.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) at net.minecraft.launchwrapper.Launch.main(Launch.java:27) -- System Details -- Details: Minecraft Version: 1.6.4 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.7.0_51, Oracle Corporation Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation Memory: 762825576 bytes (727 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 11635 (651560 bytes; 0 MB) allocated, 5 (280 bytes; 0 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 9 mods loaded, 9 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available betterrecipes{1.0} [better Recipes] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available devonmod{4.8} [DevonMod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available MechPistons{1.1} [Mech Pistons] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available mobrebirth{1.1} [mobrebirth] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available newstructures{dev1.0} [New Structures] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available nothing{1.0} [Nothing] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: GeForce GT 620/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Pack: Default Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 49 (2744 bytes; 0 MB) allocated, 12 (672 bytes; 0 MB) used And here is the class for that set of armor: Reveal hidden contents package devonmod.armor; import devonmod.ModBase; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class FireArmor extends ItemArmor { public FireArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4, String armornamePrefix) { super(par1, par2EnumArmorMaterial, par3, par4); this.material = par2EnumArmorMaterial; par2EnumArmorMaterial.getDamageReductionAmount(par4); this.setMaxDamage(par2EnumArmorMaterial.getDurability(par4)); this.maxStackSize = 1; this.setCreativeTab(ModBase.TabDevonMod); armorNamePrefix = armornamePrefix; } public String armorNamePrefix; public EnumArmorMaterial material; @Override public boolean getIsRepairable(ItemStack tool, ItemStack material) { return material.itemID == ModBase.fireCore.itemID; } public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { if (stack.toString().contains("leggings")) { return "devonmod:textures/models/armor/fire2.png"; } if (stack.toString().contains("Leggings")) if (itemID == ModBase.FireLeggings.itemID) { return "devonmod:textures/models/armor/fire2.png"; } return "devonmod:textures/models/armor/fire1.png"; } public void registerIcons(IconRegister par1iconRegister) { if (itemID == ModBase.FireHelmet.itemID) { itemIcon = par1iconRegister.registerIcon("devonmod:FireHelmet"); } if (itemID == ModBase.FireChestplate.itemID) { itemIcon = par1iconRegister.registerIcon("devonmod:FireChestplate"); } if (itemID == ModBase.FireLeggings.itemID) { itemIcon = par1iconRegister.registerIcon("devonmod:FireLeggings"); } if (itemID == ModBase.FireBoots.itemID) { itemIcon = par1iconRegister.registerIcon("devonmod:FireBoots"); } } @Override public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { if (player.getCurrentItemOrArmor(4) != null && player.getCurrentArmor(3) != null && player.getCurrentItemOrArmor(2) != null && player.getCurrentItemOrArmor(1) != null) { ItemStack helmet = player.getCurrentItemOrArmor(4); ItemStack plate = player.getCurrentItemOrArmor(3); ItemStack legs = player.getCurrentItemOrArmor(2); ItemStack boots = player.getCurrentItemOrArmor(1); if (helmet.getItem() == ModBase.FireHelmet && plate.getItem() == ModBase.FireChestplate && legs.getItem() == ModBase.FireLeggings && boots.getItem() == ModBase.FireBoots) { player.addPotionEffect((new PotionEffect(Potion.fireResistance.getId(), 400, 0))); } if (helmet.getItem() == ModBase.FireHelmet) { player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 400, 0))); } if (legs.getItem() == ModBase.FireLeggings) { player.addPotionEffect((new PotionEffect(Potion.moveSpeed.getId(), 400, 0))); } } } } What do I need to add/change to fix it? Let me know if I left anything out of the post, I will edit it in. If I helped please press the Thank You button. Check out my mods at http://www.curse.com/users/The_Fireplace/projects
coolAlias Posted February 22, 2014 Posted February 22, 2014 You mixed up the methods: // this method uses 0-3 for the armor slots, rather than 1-4 player.getCurrentArmor(3) != null Whereas all the rest you use getCurrentItemOrArmor, for which 0 is the held item and 1-4 are armor slots. http://i.imgur.com/NdrFdld.png[/img]
Recommended Posts