Started by
Wo0my64
on
Topic category: Help with Minecraft modding (Java Edition)
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.
Will be on this tomorrow. If I don't reply, I forgot it, but I will try not to.
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.
Nice Tutorial! Very help full for my Captain America Shield