Posted August 16, 201411 yr 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)
August 16, 201411 yr Beacon is the thing you want to look at. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
August 16, 201411 yr 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/
August 16, 201411 yr TileEntity#getRenderBoundingBox().expand(RADIUS,RADIUS,RADIUS). Really? I had trouble with that and just copied how the Beacon tileEntity works for the AxisAlignedBB didin't know ant boundingBox would work. Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 18, 201411 yr 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)
August 18, 201411 yr 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. Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
August 18, 201411 yr 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.