Started by
Kamikase26
on
Topic category: Help with Minecraft modding (Java Edition)
Hello! I've been trying to make a sword that when i attack a enderman it deals more damage then if i was attacking a zombie, it isn't working.
I tried doing it troung the triggers of the tool but it didn't work, also tried doing it in a procedure alone but it didn't worked either.
If someone has any help or any procedure that does what im trying to do, i would appreciate leaving a comment or any help possible.
Thank you.
If you make a procedure for 'When living entity is hit with tool' of your tool/sword. And make a If statement that checks if the subtype is an enderman, then make it do the additional damage you want in the if statement. it should work
There's no clean and easy way to do this unfortunately. Applying damage on a hit trigger runs afoul of damage immunity, where a mob becomes immune to most damage for 10 ticks after being damaged.
I've found that reducing the target's current health on a "before entity is hurt" trigger works pretty well to get a similar result. One issue with this method is that it has the same effect on a spammed attack as it does with a full swing. I mitigated this by checking if the damage "amount" was less than 3.5, and if so, reduced the health reduction by 2/3. It's not perfect, works well enough for me. One also needs to include a check to see if the damage reduction would kill the entity, and if so set health to 1 instead.
Thanks for the help! Do you think this works?
https://gyazo.com/69aa08a1982598be04b801b9fe0ffadd