Posted May 2, 20178 yr I am currently trying to protect the player from Potion effects from the outside, but there are a few problems: 1) forge adds no hooks, so I have to use a tick handler but is there a better way? 2) is there a way to know from were an effect comes? I want to block all effects except when you drink a potion yourself For better understanding I am making a space suit, so your are isulated and should no longer get potions from witches, wither skelletons... catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
May 2, 20178 yr You can't overwrite this from EntityLivingBase:public boolean isPotionApplicable(PotionEffect potioneffectIn) public void addPotionEffect(PotionEffect potioneffectIn) And check if the player has the suit on?
May 2, 20178 yr Author well I cant overwrite the player class, if it was a custom entity, yes, but I want it also useable for the normal player. catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
May 2, 20178 yr Author 24 minutes ago, Raycoms said: Ahh yeah. and if you catch the event? wich event? There are no PotionEvents or wich do you mean ? catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
May 2, 20178 yr I know that's not that reliable. But in our mod we're catching potion throw events (right click something with splash potion). You might use that.
May 2, 20178 yr Author are they also fired if a witch throw them ? catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
May 2, 20178 yr Author Or do you mean the ThrowableImpactEvent ? catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
May 2, 20178 yr Author So fluids applying effects and effect clouds are left. catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
May 2, 20178 yr Hmm I think to be 100% sure you'll have to use something that ticks and checks if something is trying to apply a potion effect to the player to remove it. Did you already dig in what "saves" the player of potion effects when he is in another gamemode. And make the armour apply it to him?
May 2, 20178 yr Author the player also gets potion effect in creative/adventure and spectator. But selecting players in spectator is by default disabled by the world (getEntityWithAABB filters spectators out) catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
May 2, 20178 yr Author The thing is removing all potion effects is simple but I want to let the player have his self drunken potion effects and there is also no event before/after a potion was drunken. With an Event fired at addPotionEffect it would be easy becaue I cold just search the stacktravc from were the potion effect was added and just cancel everything out eccept from ItemPotion.class Edited May 2, 20178 yr by MCenderdragon catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
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.