launch player towards specific block

Started by Oreli on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
launch player towards specific block

i'm currently trying to make a grappling hook in my mod. it's a ranged item, and the projectile is supposed to launch you towards the block it lands on. how would i go about doing this? 

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't know how to launch a…
Tue, 08/31/2021 - 22:14

I don't know how to launch a player toward it but I can make it so you teleport there here is how.

first create a ranged item then fill all information. when this is done click green plus next to when bullet hits block and put execute command / "clear" at x: x y: y z: z where it says clear change it to tp @s. this block is found in world management tab. it should work but I have not tested yet

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i'd prefer it not just work…
Tue, 08/31/2021 - 23:27

i'd prefer it not just work as a damageless enderpearl, but thanks for the help regardless

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
alternatively, if i had a…
Sun, 09/05/2021 - 20:41

alternatively, if i had a way to set the player's motion to the bullet's motion, that might work as well, but every attempt i've had using the attempt to override motion block has failed. even if i just set it to some random numbers instead of the velocity of the bullet, nothing works.

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can anyone help with this?
Thu, 09/09/2021 - 02:28

can anyone help with this?

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmm, you could take the…
Thu, 09/09/2021 - 06:05

Hmm, you could take the coordonny of the projectile when you it a block then you compare it with the player coordonny and you creat velocity in X, Y and Y to launch the player in the right direction, let me see this on MCreator

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
while that webslinger…
Thu, 09/09/2021 - 14:23

while that webslinger concept isn't exactly what i'd hoped for, it's the best i've seen so far. thank you

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmm. You might be able to…
Fri, 09/10/2021 - 08:02

Hmm. You might be able to fiddle around with this command thought: /tp @p ^ ^ ^1

It teleports the player 1 block in the direction they're looking. So then you could try making it so that when the bullet is shot, it will automatically spawn a new entity (Invisible, no AI, no movement entity) and that entity points in a specific direction that the player was looking at, then it continuously runs the tp @p ^ ^ ^1 then tp @p ^ ^ ^2 and so on until when the bullet you threw hits the ground, it kills that entity and stops the player's movement. This one might take a while to do though, so maybe there's 3 variables: Where the bullet lands x, y and z. It compares this to the player that threw the bullet. Then it kinda slowly teleports the player there little by little. Let's say the player's coordinates were 0 0 0. And the bullet landed at 10 20 -30. First, it calculates the distance the X value traveled by. 10-0=10. Next the difference in Y. 20-0=20. And Z. -30-0=-30. Next, let's say you want to teleport there in a series of 10 teleports. It'll divide all three values by 10 to get 1, 2, -3. Each time the player will teleport 1X, 2Y and -3Z. That way, after 10 teleports the player will be at 10 20 -30. Sorry if my explaining was bad.

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i've given up on trying to…
Sat, 09/25/2021 - 23:51

i've given up on trying to get this fixed, sorry for wasting all your time