Started by
Pepper
on
Topic category: Help with Minecraft modding (Java Edition)
I made a bear trap that traps entities stuck in it, i want the thing caught in it to have high knockback resist. how do i do that?
Topic category: Help with Minecraft modding (Java Edition)
I made a bear trap that traps entities stuck in it, i want the thing caught in it to have high knockback resist. how do i do that?
Have the bear trap execute this command on update tick:
/data merge entity @e[limit=1,sort=nearest,dx=0,dy=1,dz=0] {Attributes:[{Name:generic.knockback_resistance,Base:1},{Name:generic.movement_speed,Base:0}]}
This command will take any one entity that is 1 block above the bear trap and change the entity's knockback_resistance attribute to 100%, and also change movement_speed to 0.
It might need some tweaking, I have not tested it fully. Hopefully it is what you are looking for.
I made this using https://mcstacker.net. It is a very helpful tool.