Posted December 1, 20186 yr Anyone know of any methods or events to test for when a player gets a potion effect, and when that effect wears off? I've tried onNewPotionEffect, but it being protected makes it impossible for me to use. "Be patient with me, because I'm an absolute moron half the time."
December 1, 20186 yr 5 hours ago, Daring Do said: I've tried onNewPotionEffect That method applies the attribute modifiers of a given potion to the entity. 5 hours ago, Daring Do said: but it being protected makes it impossible for me to use No it doesn't. Reflection is a thing. 5 hours ago, Daring Do said: Anyone know of any methods or events to test for when a player gets a potion effect, and when that effect wears off? As far as I know forge has no relevant hooks so your best bet is to store a collection of all currently active potion effects in a capability attached to the entity, then each tick compare your collection to the entity's. If some entries in the entity's collection are missing but are present in yours then the potion effect expired. If there are entries in the entity's collection but not in yours then the potion was added. After you are done update your collection to be even with the entity's.
December 1, 20186 yr You basicaly want this Pull Request getting accepted: https://github.com/MinecraftForge/MinecraftForge/pull/4614. catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
December 1, 20186 yr Author 7 hours ago, V0idWa1k3r said: No it doesn't. Reflection is a thing. The bit about reflection is what I tried. And, as far as I could tell, I couldn't set it up so that I could use it to send a new packet. I'm working with networking currently, and was hoping I could find a better method of sending the packets than what I'm doing now. I can try the capability approach, but I know jackshit about them. "Be patient with me, because I'm an absolute moron half the time."
December 1, 20186 yr Author 45 minutes ago, MCenderdragon said: You basicaly want this Pull Request getting accepted: https://github.com/MinecraftForge/MinecraftForge/pull/4614. Ah. Well, hopefully it happens. "Be patient with me, because I'm an absolute moron half the time."
December 2, 20186 yr the pr is in now https://github.com/MinecraftForge/MinecraftForge/commit/2a5268c6993f2de7612789bfac2b674d04c87e89
December 2, 20186 yr Author 2 hours ago, loordgek said: the pr is in now https://github.com/MinecraftForge/MinecraftForge/commit/2a5268c6993f2de7612789bfac2b674d04c87e89 \o/ "Be patient with me, because I'm an absolute moron half the time."
December 2, 20186 yr Author Hmm... any ideas on how to use the PotionApplicableEvent? "Be patient with me, because I'm an absolute moron half the time."
December 2, 20186 yr Author Never mind, I've figured it out. I should read more. "Be patient with me, because I'm an absolute moron half the time."
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.