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 a mod maker who has run into some issues with making a hook that activates when a player is hit with a splash potion of ANY type. I would like to see a dedicated hook that is fired when potions splash on entities.

 

If there is another possible way to do this without editing a base class, please inform me ASAP.

 

EDIT:

Here's some code I came up with...

 

private boolean checkRecentPotions()

    {

    EntityPlayer pl = Mod_Main.mc.thePlayer;

    AxisAlignedBB var1 = AxisAlignedBB.getBoundingBox(pl.posX - 4.5D, pl.posY - 5.0D, pl.posZ - 4.5D, pl.posX + 4.5D, pl.posY + 2.0D, pl.posZ + 4.5D);

   

    ArrayList potionList = (ArrayList) Mod_Main.mc.theWorld.getEntitiesWithinAABB(EntityPotion.class, var1);

   

    for(int i = 0;i < potionList.size();i++)

    {

    EntityPotion var4 = (EntityPotion) potionList.get(i);

   

    double tv1 = pl.posX;

double tv2 = pl.posY;

double tv3 = pl.posZ;

double tv4 = var4.posX;

double tv5 = var4.posY;

double tv6 = var4.posZ;

   

                        //distance variable if wanted

double distance = Math.sqrt(this.sq(tv1 - tv4) + this.sq(tv2 - tv5) + this.sq(tv3 - tv6);

 

    if(var4.isDead)

    {

    potionList.remove(i);

   

    return true;

    }

    }

return false;

}

Hmm maybe something like

@Forgesubscribe(entityDeathEvent event){

if(event.entity instanceof entitypotion){

Get entities within the AABB pool and do stuff to them

}

 

}

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

  • Author

I'm pretty sure there is no EntityDeathEvent, although that would work if it existed. All I can find is LivingDeathEvent, and potions aren't living entities.

Thrown potions are indeed entities.

Also, I could've sworn there was an entity death event in minecraftforge.event.entityliving

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

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.