# Entity Movement problems (moving a entity to certain cords by adding velocity)

## Recommended Posts

Hi, I'm trying to make an item where when you right click on something (block or entity), it makes you jump to it.  I have all the code to get the difference in cords from the target to the player, but I need to know how much velocity to add to the player to get them to land at those cords.  It would also help if I could find the code that moves the entity (like gravity).

Edit:  Preferably, the launch angle would be 45 degrees.

Edit 2:  I could solve this with the Equations of Gravity if I new the units of an entity's motion and how minecraft's gravity works.

##### Share on other sites

This is an example of where I would suggest using "brute force" rather than trying to be mathematically correct.  Doing reverse trajectory calculations can be tricky in normal physics and Minecraft physics is even weirder.

What I would do is to simply experiment and record the velocity (and angle if you're changing that too) necessary to hit each distance.  Then once you have all the velocities known for different distances, then in your code just create an array with those values and look it up.  Understand what I mean?

I guarantee that that will be much faster to code than to try to figure out all the math for a closed form calculation.  No trigonometry required!

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

##### Share on other sites

That won't work, but I am doing something similar.  I am approximating the equations with simple linear equations.

When I use it though, it put noClip on.

##### Share on other sites

That won't work.

Well, it will work, but of course if you can figure it out mathematically then certainly do that.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

• ### Posts

• I've been trying to make a simple mod that increases the spawn rate of zombies on the overworld. I have tried importing the following 3 things:   import net.minecraft.world.biome.MobSpawnInfo; import net.minecraft.world.entity.EntityClassification; import net.minecraftforge.event.world.BiomeLoadingEvent; However, these three packages appear to throw errors, giving a "cannot resolve symbol" error for the words "world", "EntityClassification", and "biome". Is there any way I can fix this? I am using intelliJ to write the mod, with forge 1.20.6, with parchment mapping. I've double checked that all the versions line up and are the same, and the client game ran fine without the mod.
• Exit code -805306369 modpack - https://www.curseforge.com/minecraft/modpacks/create-mechanized-plus Crash Report -> https://pastebin.com/jiR3JtNS to recreate it simply create a world with the modpack
• In the Launcher it shows that I have 141 mods installed, in the in game main menu it shows that 147 mods are loaded... wtf

• ### Who's Online (See full list)

×

• #### Activity

×
• Create New...