Jump to content

Client-side bug when adding velocity to a newly spawned entity


pelep

Recommended Posts

When I spawn an entity and immediately add velocity to it, it bugs up client-side. What happens is the entity ends up half sunken into the ground once it lands and continues to be like that until I reconnect. If there's no block under the block it landed on, it goes all the way through. It looks exactly like vanilla mobs when they glitch up and go through blocks.

 

Also, this only happens when I add velocity in the y-axis.

 

For example:

EntityPig ep = new EntityPig(world)
ep.setLocationAndAngles(x, y, z, yaw, pitch);
ep.rotationYawHead = yaw;
ep.renderYawOffset = yaw;
ep.motionX = 0.5D;

//If this line is taken out, the bug won't occur
ep.motionY = 0.5D;

ep.motionZ = 0.5D;
ep.isAirBorne = true;
ep.initCreature();

world.spawnEntityInWorld(ep);

 

I've tried it out in different situations and it always ends up the same. I've tried editing the ItemMonsterPlacer class by adding y-velocity to whatever it spawns to see if it acts the same way and it does.

 

Other things to note:

- If the entity is an EntityItem, the bug doesn't occur; it behaves like normal.

- Doesn't matter if "initCreature()" is called before adding velocity

 

So, am I doing something wrong or is this an MC thing?

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.

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.



×
×
  • Create New...

Important Information

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