Posted March 3, 201411 yr So for some reason, i'm getting a npe in in my sendChatToPlayer function, but it was working previously. Here's all it is : public static void sendChatToPlayer(EntityPlayer player, String message) { player.addChatComponentMessage(new ChatComponentText(message)); } And the stacktrace is : Caused by: java.lang.NullPointerException at net.minecraft.entity.player.EntityPlayerMP.addChatComponentMessage(EntityPlayerMP.java:987) ~[EntityPlayerMP.class:?] at mymod.util.ChatMessageHandler.sendChatToPlayer(ChatMessageHandler.java:33) ~[ChatMessageHandler.class:?] The line it fails at is : this.playerNetServerHandler.sendPacket(new S02PacketChat(p_146105_1_)); in the EntityPlayerMP class in the net.minecraft.blah.blah bit. Whats going wrong?
March 3, 201411 yr Author I personally wasnt calling that, the player.addChatComponentMessage(new ChatComponentText(message)) calls it. As in, the function addChatComponentMessage is as follows : public void addChatComponentMessage(IChatComponent p_146105_1_) { this.playerNetServerHandler.sendPacket(new S02PacketChat(p_146105_1_)); }
March 3, 201411 yr Author I call sendChatToPlayer(EntityPlayer player, String message) in er, almost everywhere, but the problem is in my "setSkill" method in my ExtendedEntityProperties. The method is : public void setSkill(Skill lookup, int i, EntityPlayer player) { Side side = FMLCommonHandler.instance().getEffectiveSide(); RSLogging.log(this.getClass(), "Increasing level"); if (side == Side.CLIENT) { RSLogging.log(this.getClass(), "So not doing anything"); } else { this.SkillAmounts[lookup.ordinal()] = i; this.ExpAmounts[lookup.ordinal()] = this.limits[i - 1]; RSChatMessageHandler.sendChatToPlayer(player, "Congratulations, you are now " + this.getSkill(lookup) +" " + lookup.name().toLowerCase()); } } (RSLogging.log takes the class and a message, and prints the class, effective side and message)
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.