Posted September 18, 201312 yr I have been trying for weeks to add functionality to my mob spawner which would run a check on a specific in game tick for all objects (mobs) within a specific radius and then if this check finds that the mobs exist it despawns them. I have been very unsuccessful. Currently I have a tile entity which I created called mobspawner and it has a working timer which is synced with the minecraft in game ticks. This mob spawner has the functionality to spawn mobs at a specific game time and does so forever. This is a problem since it eventually crashes the game due to too many entities being present. does anyone know of a way to implement such functionality? Any help is very much appreciated.
September 18, 201312 yr this is the method your looking for: this.worldObj.getEntitiesWithinAABB(par1Class, par2AxisAlignedBB) it gets all the entity's within the AABB. http://www.minecraftforum.net/topic/1937703-162smpforge-pet-mastery-hatch-level-battle/
September 26, 201312 yr Author I have found the following AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)xCoord, (double)yCoord, (double)zCoord, (double)(xCoord + 1), (double)(yCoord + 1), (double)(zCoord + 1)).expand(1, 1, 1); List list = worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb); Iterator iterator = list.iterator(); Entity ent; while (iterator.hasNext()){ ent = (Entity) iterator.next(); if(!(ent instanceof EntityLivingBase)){ (EntityLivingBase) ent).setDead(); } } but cant seem to get it to work any ideas?
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.