#EntityJS - Making arrows not fling off the player when damage is cancelled

43 messages · Page 1 of 1 (latest)

grim grove
#

Title explains it. I want to make it so that dodging with ParCool causes damage immunity and make arrows not act weird. I've got the ParCool dodge detection down but I can't figure out how to make arrows not fling away when damage is cancelled. @modern plaza

sly vaultBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

grim grove
#

i want to make the arrows phase through

modern plaza
#

ah, youll have to override the onHitEntity method

grim grove
#

hmm

modern plaza
#

which arrow/projectile class are you extending

grim grove
#

abstract arrow ig

modern plaza
#

hmm

grim grove
#

i want to modify all arrows

modern plaza
#

yeah

#

hmm

#

ok sec

#

youll wanna use the forge projectile hit event and use the event.setImpactResult to one that phases through, you have a couple options here for that #1363726743566946405 message

tardy barnBOT
#

[➤](#1363726743566946405 message)
mainhanditem isnt defined inside the switch statement, on top of that you have a break keyword outside of it which should be removed. if its only one check then you might as well just use another if statement instead of switch case as that is redundant logic. realistically this can be done via the forge projectile impact event where you get the projectile directly
Startup script: js ForgeEvents.onEvent("net.minecraftforge.event.entity.ProjectileImpactEvent", event => global.onProjectileImpact(event)) /**@param {Internal.ProjectileImpactEvent} event */ global.onProjectileImpact = event => { let { projectile, impactResult, rayTraceResult } = event try { if (projectile.type == "minecraft:trident") { if (rayTraceResult.type == "entity") { if (Math.random() >= 0.6) projectile.kill() } } } catch (error) { console.log("Error in onProjectileImpact: ", error) } }

modern plaza
#

"skip_entity"

grim grove
#

iiinteresting

#

alr

#

@modern plaza is event.entity the hit entity?

modern plaza
#

youll wanna go off the hit result

#

event.entity is probably the projectile but im not sure

#

you can console log it

grim grove
#

the ray trace result doesn't have an entity attached

#

wait

#

hold on

#

does it return either a hitresult or an entityhitresult?

modern plaza
#

oh actually youre right

#

uh

grim grove
#

like is it dynamic

#

or is it just hitresult

modern plaza
#

it should be the hit result but its just HitResult which only gives you the vec3 location and the type

#

so you may need to also go off the entity hurt event for that

modern plaza
# grim grove like is it dynamic

you can see if its dynamic, might be js if (event.getRayTraceResult() instanceof EntityHitResult) { let hitEntity = event.getRayTraceResult().getEntity(); }

grim grove
#

YOOOO

let entity = event.getRayTraceResult() instanceof $EntityHitResult
console.log(entity)
modern plaza
#

oo

#

well there you go then heh

grim grove
modern plaza
#

oo thats sick af

grim grove
#

thank you for the help 👍

willow rain
vale zephyr
#

necropost