Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

No particular reason. I just use the same annotation for all my events to stay consistent.

  • 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?

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.