Jump to content

1.21 EntityConstructing event is no longer work

Recommended Posts

In the 1.21 the SynchedEntityData object is final and it's unable to add new Player attributes using traditional EntityConstructing. I make sense to fire the event a little earlier and pass SynchedEntityData.Builder object in it. See example below.

    public Entity(EntityType<?> p_19870_, Level p_19871_) {
        synchedentitydata$builder.define(DATA_TICKS_FROZEN, 0);
        // suggested injection net.minecraftforge.event.ForgeEventFactory.onEntityConstructing(this, synchedentitydata$builder);
        this.entityData = synchedentitydata$builder.build();
        this.setPos(0.0, 0.0, 0.0);
        this.eyeHeight = this.dimensions.eyeHeight();
        // current injection


Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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