Jump to content

[1.17.1] How to change the property of an entity by command


Recommended Posts

Posted

Thanks to this forum, I succeeded to summon my own entity.

Now I want to control it by command, but can not access to it.

 

MyEntity.java has a property, ‘isFlying’ like this:

public class MyEntity extends Animal {
	public boolean isFlying = false;
	…
}

 

And I want to change the flag by command like these, of course failed (showed no error message):

data merge entity @e[type=mymod:myentity, limit=1, name="myentity"] {isFlying: 1b}
data merge entity @e[type=mymod:myentity, limit=1, name="myentity"] {Attributes: [{Name:"generic.isFlying", Base:1b}]}

 

Any good way to change the flag of the entity object?

Thanks in advance.

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.