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

Sorry for the terribly worded title, but here's what I want to do:

 

When a player is standing near a blood altar with <potion effect> then <thing happens>.

I have the code to do this, but I don't know how I would do this.

 

 

Why bother?

Check if the player has the specific potion effect or is standing by the block. If they are, then do something.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

The potion will be a custom potion I add, yes.

 

And I already have the code:

  List<EntityPlayer> list = SpellHelper.getPlayersInRange(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 15, 15);
//                for (EntityPlayer player : list)
//                {
//                    PotionEffect regenEffect = player.getActivePotionEffect(Potion.regeneration);
//                    if (regenEffect != null && regenEffect.getAmplifier() > 0)
//                    {
//                    	if(AlchemicalWizardry.causeHungerChatMessage && !player.isPotionActive(Potion.hunger.id))
//                    	{
//                        	player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("message.altar.hunger")));
//                    	}
//                        player.addPotionEffect(new PotionEffect(Potion.hunger.id, 40, regenEffect.getAmplifier() * 2 - 2));
//                    }
//                }

(Ignore that it is commented out)

That is what (used to be) there, and I want to replicate what I am doing, but instead of causing hunger it will fill the altar, slowly.

 

I already know how I will do this bit though. I just need to know how to "inject" my bit of code into the class file for the Blood Altar (which is a tile entity).

 

i.e. Blood Altar's tile entity file, which is where this code goes, will load with my bit of code added in.

Why bother?

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.