Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

No Potion Effect Hooks?


MCenderdragon
 Share

Recommended Posts

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).

Link to comment
Share on other sites

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?
 

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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 by MCenderdragon

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.