Braquen Posted June 5, 2023 Posted June 5, 2023 So I want to give the player the strength effect when they use a totem, but I can't get it to work. I've tested and if you have an effect when you use a totem, it is removed when you get revived (presumably because you "die.") After testing with System.out.print(), I've concluded the entity is given strength then has it immediately removed. This occurs even if I set the event priority to lowest. Does anyone have any ideas on getting around this? Thanks! Quote
Warren Tode Posted June 5, 2023 Posted June 5, 2023 I copied the Totem of Undying event for my coin charm, and as you can see in line 113 it has the method removeAllEffects in there, so if you're building a similar event, simply don't add the method to prevent it from removing effects. https://github.com/toadie-odie/TodeCoins/blob/1.3.2/src/main/java/net/warrentode/todecoins/event/ModEvents.java 1 Quote
Braquen Posted June 5, 2023 Author Posted June 5, 2023 (edited) 7 hours ago, Warren Tode said: I copied the Totem of Undying event for my coin charm, and as you can see in line 113 it has the method removeAllEffects in there, so if you're building a similar event, simply don't add the method to prevent it from removing effects. https://github.com/toadie-odie/TodeCoins/blob/1.3.2/src/main/java/net/warrentode/todecoins/event/ModEvents.java Unfortunately this is not the case. I’m trying to add this effect on the base game Totem via an enchantment. This does help though, I’ll take a look at the code and see if I can find a work around! Do you know if there is a way to put a tick delay on a function? Like have the effect added the tick after the event completes, or even at the end of the current tick? Edited June 5, 2023 by Braquen Quote
Warren Tode Posted June 5, 2023 Posted June 5, 2023 Okay so you want to modify the existing totem's function and not create a brand new function or totem? Do I understand this correctly? If so, you'll probably need a mixin of some kind that targets the "checkTotemDeathProtection" in the LivingEntity class - that's the method I copied for my coin charm, but it's the built-in method for the game's totem. This is the way I would approach it at least. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.