Posted March 10, 201510 yr Hey me and some others are working on a mod that gives armor weight! We are currently having a problem or two and was wondering if someone could point us in the right direction! Here's the source codes: This ticks with the player and checks if the player is wearing armor: package MinecraftRPGOverhaul.events; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerCapabilities; import MinecraftRPGOverhaul.items.ModArmor; import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; public class ModEventHandler { private EntityPlayer player; @SubscribeEvent public void onEntityUpdate(PlayerTickEvent event) { PlayerCapabilities cap = ObfuscationReflectionHelper.getPrivateValue(EntityPlayer.class, player, "capabilities", "field_71075_bZ"); ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, cap, ModArmor.armorCall(player), "walkSpeed", "field_73357_f"); ModArmor.armorCall(player); } This is wear we check armor and assign values and such. It's really rough as we are just trying to get it to work before optimizing and prettying it up, sorry. package MinecraftRPGOverhaul.items; import java.awt.List; import java.util.ArrayList; import java.util.Arrays; import cpw.mods.fml.common.ObfuscationReflectionHelper; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerCapabilities; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class ModArmor extends ItemArmor{ //set the different weight classes private static final float HEAVYARMOR = 0.05f; private static final float MEDIUMARMOR = 0.025f; private static final float LIGHTARMOR = 0.01f; //weight for each armor piece private static float bootWeight = 0.0f; private static float chestplateWeight = 0.0f; private static float helmetWeight = 0.0f; private static float leggingWeight = 0.0f; //total armor weight private static float totalWeight = 0.0f; public static Item heavyBoots[] = new Item[] { ModItems.puriteBoots }; public String textureName; //The texture name, the name is passed in via the 'ModArmor' method public ModArmor(String unlocalizedName, ArmorMaterial material, String textureName, int type){ //ModArmor method, passes in all pertinent information to create a piece of armor super(material, 0, type); this.textureName = textureName; this.setTextureName(unlocalizedName); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){ //getArmorTexture method, uses previous information passed in to assure you have the right texture return "rpgmod" + ":armor/" + this.textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png"; } public static float armorCall(EntityPlayer player) { setCurrentArmorWeight(player); PlayerCapabilities cap = ObfuscationReflectionHelper.getPrivateValue(EntityPlayer.class, player, "capabilities", "field_71075_bZ"); return ((1.0f - totalWeight)/10); } public static boolean wearingArmor (EntityPlayer player) { try { player.getCurrentArmor(0); System.out.println("Checked Armor!"); return true; } catch(NullPointerException e) { System.out.println("Not wearing armour"); return false; } } public static void setCurrentArmorWeight(EntityPlayer player) { if (wearingArmor(player)) { //TODO change to switch statements? if(player.getCurrentArmor(0).getItem().equals(ModItems.puriteBoots)){ bootWeight = HEAVYARMOR; } if(player.getCurrentArmor(1).getItem().equals(ModItems.puriteLeggings)){ leggingWeight = HEAVYARMOR; } if(player.getCurrentArmor(2).getItem().equals(ModItems.puriteChestplate)){ chestplateWeight = HEAVYARMOR; } if(player.getCurrentArmor(3).getItem().equals(ModItems.puriteHelmet)) { helmetWeight = HEAVYARMOR; } totalWeight = bootWeight + helmetWeight + chestplateWeight + leggingWeight; } else { totalWeight = 0.0f; } } Here's the error, lol: [22:14:09] [server thread/ERROR] [FML]: Unable to access any field [capabilities, field_71075_bZ] on type net.minecraft.entity.player.EntityPlayer cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.NullPointerException at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:121) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:60) [ObfuscationReflectionHelper.class:?] at MinecraftRPGOverhaul.events.ModEventHandler.onEntityUpdate(ModEventHandler.java:18) [ModEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ModEventHandler_onEntityUpdate_PlayerTickEvent.invoke(.dynamic) [?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) [ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?] at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) [FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:259) [EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) [EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) [C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) [C03PacketPlayer$C06PacketPlayerPosLook.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.lang.NullPointerException at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) ~[?:1.8.0_31] at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source) ~[?:1.8.0_31] at java.lang.reflect.Field.get(Unknown Source) ~[?:1.8.0_31] at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:117) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] ... 18 more [22:14:09] [server thread/ERROR] [FML]: Exception caught during firing event cpw.mods.fml.common.gameevent.TickEvent$PlayerTickEvent@5ac0d47d: cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.NullPointerException at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:121) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:60) ~[ObfuscationReflectionHelper.class:?] at MinecraftRPGOverhaul.events.ModEventHandler.onEntityUpdate(ModEventHandler.java:18) ~[ModEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ModEventHandler_onEntityUpdate_PlayerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?] at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) [FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:259) [EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) [EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) [C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) [C03PacketPlayer$C06PacketPlayerPosLook.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: java.lang.NullPointerException at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) ~[?:1.8.0_31] at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source) ~[?:1.8.0_31] at java.lang.reflect.Field.get(Unknown Source) ~[?:1.8.0_31] at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:117) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] ... 18 more [22:14:09] [server thread/ERROR] [FML]: Index: 1 Listeners: [22:14:09] [server thread/ERROR] [FML]: 0: NORMAL [22:14:09] [server thread/ERROR] [FML]: 1: ASM: MinecraftRPGOverhaul.events.ModEventHandler@381ed137 onEntityUpdate(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V [22:14:09] [server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking player at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?] Caused by: cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.NullPointerException at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:121) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:60) ~[ObfuscationReflectionHelper.class:?] at MinecraftRPGOverhaul.events.ModEventHandler.onEntityUpdate(ModEventHandler.java:18) ~[ModEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ModEventHandler_onEntityUpdate_PlayerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?] at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) ~[FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:259) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) ~[C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) ~[C03PacketPlayer$C06PacketPlayerPosLook.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?] ... 5 more Caused by: java.lang.NullPointerException at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) ~[?:1.8.0_31] at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source) ~[?:1.8.0_31] at java.lang.reflect.Field.get(Unknown Source) ~[?:1.8.0_31] at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:117) ~[forgeSrc-1.7.10-10.13.2.1291.jar:?] at cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:60) ~[ObfuscationReflectionHelper.class:?] at MinecraftRPGOverhaul.events.ModEventHandler.onEntityUpdate(ModEventHandler.java:18) ~[ModEventHandler.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ModEventHandler_onEntityUpdate_PlayerTickEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?] at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) ~[FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:259) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) ~[C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) ~[C03PacketPlayer$C06PacketPlayerPosLook.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?] ... 5 more [22:14:09] [server thread/ERROR]: This crash report has been saved to: C:\Users\Alex\Documents\GitHub\MinecraftRPGMod\eclipse\.\crash-reports\crash-2015-03-09_22.14.09-server.txt [22:14:09] [server thread/INFO]: Stopping server [22:14:09] [server thread/INFO]: Saving players [22:14:09] [server thread/INFO]: Saving worlds [22:14:09] [server thread/INFO]: Saving chunks for level 'New World'/Overworld [22:14:09] [server thread/INFO]: Saving chunks for level 'New World'/Nether [22:14:09] [server thread/INFO]: Saving chunks for level 'New World'/The End [22:14:10] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ---- // Why is it breaking Time: 09/03/15 10:14 PM Description: Ticking player cpw.mods.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: java.lang.NullPointerException at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:121) at cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:60) at MinecraftRPGOverhaul.events.ModEventHandler.onEntityUpdate(ModEventHandler.java:18) at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ModEventHandler_onEntityUpdate_PlayerTickEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:259) at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) Caused by: java.lang.NullPointerException at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source) at java.lang.reflect.Field.get(Unknown Source) at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:117) ... 18 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at cpw.mods.fml.relauncher.ReflectionHelper.getPrivateValue(ReflectionHelper.java:121) at cpw.mods.fml.common.ObfuscationReflectionHelper.getPrivateValue(ObfuscationReflectionHelper.java:60) at MinecraftRPGOverhaul.events.ModEventHandler.onEntityUpdate(ModEventHandler.java:18) at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ModEventHandler_onEntityUpdate_PlayerTickEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:259) -- Player being ticked -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 193 Entity Name: Player99 Entity's Exact location: -118.09, 72.00, 251.67 Entity's Block location: World: (-119,72,251), Chunk: (at 9,4,11 in -8,15; contains blocks -128,0,240 to -113,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Entity's Momentum: 0.00, -0.08, 0.00 Stacktrace: at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@2312cc52 Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_31, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 934180696 bytes (890 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available RPGMod{1.0} [RPGMod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player99'/193, l='New World', x=-118.09, y=72.00, z=251.67]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' [22:14:10] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-03-09_22.14.09-server.txt [22:14:10] [Client thread/INFO] [FML]: Waiting for the server to terminate/save. [22:14:10] [server thread/INFO] [FML]: Unloading dimension 0 [22:14:10] [server thread/INFO] [FML]: Unloading dimension -1 [22:14:10] [server thread/INFO] [FML]: Unloading dimension 1 [22:14:10] [server thread/INFO] [FML]: Applying holder lookups [22:14:10] [server thread/INFO] [FML]: Holder lookups applied [22:14:10] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. [22:14:10] [Client thread/INFO] [FML]: Server terminated.
March 10, 201510 yr Hey me and some others are working on a mod that gives armor weight! We are currently having a problem or two and was wondering if someone could point us in the right direction! Here's the source codes: This ticks with the player and checks if the player is wearing armor: http://pastebin.com/5t6iZ6Tr This is wear we check armor and assign values and such. It's really rough as we are just trying to get it to work before optimizing and prettying it up, sorry. http://pastebin.com/iXNMyYex Here's the error, lol: http://pastebin.com/KsHNXfHS The hell? Don't use reflection. Use player.capabilities... Maker of the Craft++ mod.
March 10, 201510 yr Author Hmm, I was told that could cause problems down the road when handling server side and such. EDIT: Ok well that seems to have solved that error, any idea on why we're getting an error on ticking the player? EDIT2: appears to be saying player is null, but i cant figure out why... A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at MinecraftRPGOverhaul.events.ModEventHandler.onEntityUpdate(ModEventHandler.java:17) at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_ModEventHandler_onEntityUpdate_PlayerTickEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:345) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:259) -- Player being ticked -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 193 Entity Name: Player163 Entity's Exact location: -118.09, 72.00, 251.67 Entity's Block location: World: (-119,72,251), Chunk: (at 9,4,11 in -8,15; contains blocks -128,0,240 to -113,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Entity's Momentum: 0.00, -0.08, 0.00 Stacktrace: at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@5cb42fdf Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)
March 10, 201510 yr BAD: private EntityPlayer player; GOOD: event.player / event.entity EDIT: Also you design is kinda "static". I'd suggest making weigh values in NBT. Always keep in mind that items and block are singletons and there is only one instance per game (client/server). EDIT 2 For speed look at potion and AttributeModifier. I'd stay with base value of speed and if you are wearing something heavy add slowing Modifier with value of x in every beggining of a tick for one tick. Many ways to do that actually. You could just add PotionEffect ;p 1.7.10 is no longer supported by forge, you are on your own.
March 10, 201510 yr Author Thanks for the advice! Do you have any links or tips for getting started with NBT's, they sound kind of intimidating ahaha.
March 10, 201510 yr http://www.minecraftforge.net/wiki/Creating_NBT_for_items Should get you the idea. Everything else is just matter of logic, plan and code 1.7.10 is no longer supported by forge, you are on your own.
March 11, 201510 yr Author Hey, I've done a little looking around on AttributeModifier, and i don't quite understand how to use it. I'm commonly seeing these three lines pop up in descriptions: AttributeModifier attributemodifier = (AttributeModifier)entry.getValue(); attributeinstance.func_111124_b(attributemodifier); attributeinstance.func_111121_a(new AttributeModifier(attributemodifier.func_111167_a(), this.getName() + " " + par3, this.func_111183_a(par3, attributemodifier), attributemodifier.func_111169_c())); Also what are all the func_#####? I know what they /are/ but not what specific ones are, or where to find out what they all are, it always takes me forever to dig around enough to figure it out. Also bonus points if you can explain why the hell functions are called numbers and not by a name that told people what they do, like what is the advantage to that?
March 12, 201510 yr Methods/Functions are called by numbers because when minecraft is compiled it also gets obfuscated, people then find out what these functions do and put it into the MCP Bot to help make it readable. I'm not sure if there's a benefit to the code being obfuscated other than preventing people from easily reading it. func_111124_b -> removeModifier func_111121_a -> applyModifier func_111167_a -> getID func_111183_a -> getAttributeModifierAmount func_111169_c -> getOperation
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.