Jump to content

Recommended Posts

Posted

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");
	}
}

Posted

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?

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.