Started by
varuniemcfruity
on
Topic category: Help with Minecraft modding (Java Edition)
Help with making every entity that attacks the player get an effect.
I'm working on a mod using MCreator, and I'm trying to implement a new feature where players can eat a special food item that grants them temporary protection against enemy attacks. Specifically, I want to apply the wither effect to any entity that attacks the player for 2400 ticks after they consume the food item.
To achieve this, I've already created a procedure in MCreator and set it to trigger after the player eats the food item. However, I'm not sure how to proceed from there. Can someone please help me figure out how to apply the wither effect to attacking entities for the specified duration? Any guidance or advice would be greatly appreciated!
make logic player lifetime variable. then in that item triggers find: if player finished using item and add procedure, in that procedure do next: set "your variable" to true, then add wait 2400 ticks on server side then set "your variable" to false
another procedure. set if entity attacked in global triggers, then add if get "your variable" for event/target entity = true, add potion to source entity procedure block
when i put set "my variable" to false in wait 2400 ticks on server side do i get a error saying "statement do does not support local variables"
nvm i didnt realize i was supposed to use a player lifetime variable
ok so i just tested it out and if any mob attacks another mob they get wither, it doesnt matter if they ate the food
nvm i made some changes and got it working thanks so much