Help with hitting projectiles where i look

Started by Wo0my64 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with hitting projectiles where i look

Basically i have an item in my mod that allows the player to reflect a projectile back in the direction that they're looking or "parry" it like a ghast fireball.

i've been struggling on this for a couple days and  decided to just ask the forums.

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Will be on this tomorrow. If…
Fri, 06/14/2024 - 23:41

Will be on this tomorrow. If I don't reply, I forgot it, but I will try not to.

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Below is what the first…
Sat, 06/15/2024 - 11:55

Below is what the first procedure should look like:

This procedure is just a model and should be altered to fit your items and so on.

The first procedure block checks if the entity is an arrow. You can change it to testing if the entity is a (sub-)type of a specific entity as well if you want something more specific, or add your own projectiles as an OR block.

Second is the item you want to use for blocking. I used a golden sword as an example here. Replace it with your item of choice.

Third is the variable. I used a local variable here, but you should create a PLAYER_LIFETIME variable in the variable tab of your workspace, since we want it to be saved on the player.

The rest of this procedure then cancels the player being hit by the arrow and sends it the direction the player is facing. It only overrides the direction, meaning velocity should be kept. Testing is needed.

 

Then, you need a second procedure that looks somewhat like this:

Once again, variable and item are just an example.

What this does is that it sets parrying to true if you do parry, and two ticks later (1/10 of a second), it "unparries," meaning you will only deflect arrows in this time. You can change the duration by increasing the number from 2 to something like 5.

Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nice Tutorial! Very help…
Sat, 09/28/2024 - 23:11

Nice Tutorial! Very help full for my Captain America Shield