Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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?

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

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

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.

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

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

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

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?
 

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

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.