Started by
lamon_damon
on
Topic category: Help with Minecraft modding (Java Edition)
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
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.
Thank you a lot! I appreciate it!
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