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?