Jump to content

Making Entity Data Persistent through logs 1.17x


spiritfilled

Recommended Posts

Whenever i logout and back-in in the game, the data resets to its define state

(how can i save the entity data to be persistent)

 

the code words, data is used flawlessly, but just doesn't save through game exit

public class TyBoss extends Monster{

	public static final EntityDataAccessor<Boolean> STILL_HOSTILE = SynchedEntityData.defineId(TyBoss.class, EntityDataSerializers.BOOLEAN);
	private static final EntityDataAccessor<Byte> SCOUNT_TAG = SynchedEntityData.defineId(TyBoss.class, EntityDataSerializers.BYTE);
(...)
      
	protected void defineSynchedData() {
	    super.defineSynchedData();
	    this.entityData.define(SCOUNT_TAG, (byte) 0);
	    this.entityData.define(STILL_HOSTILE, true);
	}
(...)
      
	public void startSeenByPlayer(ServerPlayer p_01_) {
	    super.startSeenByPlayer(p_01_);
	    if (this.entityData.get(STILL_HOSTILE)) { this.bossEvent.addPlayer(p_01_);}
	}

	public void stopSeenByPlayer(ServerPlayer p_01_) {
	    super.stopSeenByPlayer(p_01_);
	    this.bossEvent.removePlayer(p_01_);    
	}
(...)
}

 

Edited by spiritfilled
Link to comment
Share on other sites

  • spiritfilled changed the title to Making Entity Data Persistent through logs 1.17x

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.