Jump to content

Entity motion not smooth


Recommended Posts



I'm trying to make a block, that when you throw an item on it moves the item around the block on the ground and then creates a new item out of that. I've tried onEntityCollidedWithBlock and calling a function on my TileEntity and that works perfectly. But when i try to move the EntityItem with these motion vars, e.g. motionX += 1 the movement is just not smooth and it looks like the item is just teleporting. When i slow it down, it is smooth, but it's too slow for me. I'm looking for a function in EntityItem to adjust maybe the walkingSpeed, but there is no method or variable like this.


I hope you can help, because it's a little tricky.





You sir are a god damn hero.

Link to comment
Share on other sites

The motionX variable is a double. You are adding an integer to a double (which works, but gives the double the precision of an integer. You don't want that, you want the precision of a double. That's the entire reason the variable is a double :)). You need to specify the type in which you are adding to the double. I am willing to bet if you change:

motionX += 1




motionX += 1.0D


then it will be smoother. (Very very important in programming if you ever need anything to be precise that you specify the type.)

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.