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

Hey,  I was looking to make a block that gives players around it (in a given radius) and gives them a potion effect, I have everything already done, I just cant figure out how to search around a block for entitys.

 

~Any help would be appreciated, Shaun O'Neill.

View my website at -> http://www.xelitexirish.com/

You can nearly always contact me on my twitter (XeliteXirish)

You can use World#getEntitiesWithinAABB(ENTITY_CLASS,BOUNDING_BOX). You can replace the ENTITY_CLASS with EntityPlayer.class for a player. For the BOUNDING_BOX, you can use TileEntity#getRenderBoundingBox().expand(RADIUS,RADIUS,RADIUS).

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

  • Author

Hey, I've looked at what you both said, but I keep getting an error.  The GitHub page for the block is https://github.com/XeliteXirish/Quantum-Energistics-2/blob/master/src/main/Common/com/XeliteXirish/QuantumEnergistics2/tileEntity/TileEntityPotionDispencer.java

 

The error I get is-

-- Head --
Stacktrace:
at com.XeliteXirish.QuantumEnergistics2.tileEntity.TileEntityPotionDispencer.<init>(TileEntityPotionDispencer.java:21)
at com.XeliteXirish.QuantumEnergistics2.block.blockPotionDispencer.createNewTileEntity(blockPotionDispencer.java:17)
at net.minecraft.block.Block.createTileEntity(Block.java:1778)
at net.minecraft.world.chunk.Chunk.func_150806_e(Chunk.java:947)
at net.minecraft.world.ChunkCache.getTileEntity(ChunkCache.java:102)
at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:189)
at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1624)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1271)

 

The error is on line: List players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);

Any help would be nice :)

View my website at -> http://www.xelitexirish.com/

You can nearly always contact me on my twitter (XeliteXirish)

try moving that code into your update method like:

 

@Override
public void updateEntity() 
{
	if (!getWorldObj().isRemote)
	{
		List players = getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, this.getRenderBoundingBox().expand(range, range, range));
	        Iterator iterator = players.iterator();
                        EntityPlayer entityplayer;
                        while (iterator.hasNext())
                        {
                              entityplayer = (EntityPlayer)iterator.next();
                              ExtendPlayerRotManaStam props = ExtendPlayerRotManaStam.get(entityplayer);
                              if (props.needsMana())
                              {
             	                 if (mana > 1)
            	                 {
            		             props.regenMana(1f);
            		             mana -= 1;            		
            	                 }
                               }
                           }
                        repairItemsOnPlayers(players);
	}
}

 

remember you want to check whenever there is a nearby player.

  • Author

Sorry I don't have any clue how I forgot that haha, anyways I have it working perfectly now :) For anyone interested in seeing it:https://github.com/XeliteXirish/Quantum-Energistics-2/blob/master/src/main/Common/com/XeliteXirish/QuantumEnergistics2/tileEntity/TileEntityPotionDispencer.java (Il commit in in a minute)

View my website at -> http://www.xelitexirish.com/

You can nearly always contact me on my twitter (XeliteXirish)

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.