Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

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


Tats
 Share

Recommended Posts

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.

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.

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.