Posted August 14, 201411 yr I am following this tutorial http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and . My extendedEntity class never gets its loadNBTData method called and the data gets reset every time I exit Minecraft. How can I solve this?
August 14, 201411 yr Posting your code would be the logical first step. http://i.imgur.com/NdrFdld.png[/img]
August 14, 201411 yr Author Here is my extendedEntityClass public class WerewolfData implements IExtendedEntityProperties { public static final String PROP_NAME="WerewolfData"; private final EntityPlayer player; private boolean isWerewolf=true; private boolean isInWerewolfForm=true; public WerewolfData(EntityPlayer player){ this.player = player; } public static final void register(EntityPlayer player){ player.registerExtendedProperties(PROP_NAME, new WerewolfData(player)); } public static final WerewolfData get(EntityPlayer player){ return (WerewolfData)player.getExtendedProperties(PROP_NAME); } @Override public void saveNBTData(NBTTagCompound compound) { NBTTagCompound properties=new NBTTagCompound(); properties.setBoolean("isWerewolf", isWerewolf); properties.setBoolean("isInWerewolfForm", isInWerewolfForm); compound.setTag(PROP_NAME, properties); System.out.println("has been saved"); } @Override public void loadNBTData(NBTTagCompound compound) { NBTTagCompound properties = (NBTTagCompound)compound.getTag(PROP_NAME); isWerewolf = properties.getBoolean("isWerewolf"); isInWerewolfForm = properties.getBoolean("isInWerewolfForm"); System.out.println("has been loaded"); } @Override public void init(Entity entity, World world) { // TODO Auto-generated method stub } public final void makeWerewolf(boolean input){ isWerewolf=input; } public final boolean isWerewolf(){ return isWerewolf; } public final void changeIntoWerewolfForm(boolean input){ isInWerewolfForm=input; } public final boolean isInWerewolfForm(){ return isInWerewolfForm; } } Here is my constructing event. @SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled=true) public void constructPlayers(EntityConstructing event){ if(event.entity instanceof EntityPlayer){ EntityPlayer player=(EntityPlayer)event.entity; WerewolfData.register((EntityPlayer)event.entity); System.out.println("fdafasfa"); } }
August 14, 201411 yr Author No particular reason. I just use the same annotation for all my events to stay consistent.
August 14, 201411 yr Author After some testing I discovered the problem. The values for the client are reset when Minecraft starts and the values for the server are loaded. How can I fix these syncing issues? Should I use packets?
August 14, 201411 yr Author I am confused on the client and the server communications. Is all the data allocated on the server and the client? Is why I must send some data in packets or use the data watcher. Is the construction event server side only? That would explain why the client would need to have its data updated.
August 15, 201411 yr Construction / NBT loading is only done on the server, so anything you want the client to know about, you need to send a packet. http://i.imgur.com/NdrFdld.png[/img]
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.