Protection from the Wither Effect

Started by lamon_damon on

Topic category: Help with modding (Java Edition)

Last seen on 18:11, 26. Jul 2024
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Protection from the Wither Effect
Wed, 11/01/2023 - 12:44 (edited)

I wanted to make an item that if you right click it, it gives you protection or something among those lines from the Wither Effect, like a blocker for around 1-2 minutes. After it's right clicked, I wanted it to be used after another 1-2 minutes and it changes its item texture when it can't be used. (If any of this is possible, not in code, then please help me if you can!)

Thank you for helping!

Edited by lamon_damon on Wed, 11/01/2023 - 12:44
Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You would want to make two…
Thu, 11/02/2023 - 03:23

You would want to make two blocks: a powered variant, and an unpowered variant. When the player right clicks on the powered variant, replace it with the unpowered variant, and give them a custom status effect. 

For the custom status effect, just make it's update tick trigger use the 'remove specific potion' function to remove the Wither effect from the event/target entity as long as they have your custom status effect.

...And for the block, go into 'advanced settings,' and tell it to update every tick. Then, make a procedure that triggers when the block is updated, and have it give the block a custom NBT number tag that increases by 1 every time the procedure is triggered. (You'll want to set this tag to zero when you initially transform the block, and then have the procedure set the tag to its current value + 1.) If the value equals two minutes, (2,400 ticks), then replace the block with the powered variant.

Last seen on 18:11, 26. Jul 2024
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you a lot! I…
Thu, 11/02/2023 - 13:00

Thank you a lot! I appreciate it!

Last seen on 13:24, 6. Jun 2024
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
what you can maybe do is…
Thu, 11/02/2023 - 23:00

what you can maybe do is when the player right-clicks with the item, they get a wither-protection effect that lasts for like 2 minutes, and with the effect applied, you add a procedure to remove the wither effect to the entity that has it