private int countEntitesAround( World world, BlockPos pos ) { final AxisAlignedBB t = new AxisAlignedBB( pos ).grow( 8 ); final List<Entity> list = world.getEntitiesWithinAABB( Entity.class, t ); return list.size(); } }
AxisAlignedBB boundingBox = new AxisAlignedBB(posX, posY, posZ, posX, posY, posZ).grow(radius, radius, radius); List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox);
@Override public void updateBurst(IManaBurst burst, EntityThrowable entity, ItemStack stack) { if(burst.isFake()) { if(entity.world.isRemote) return; AxisAlignedBB axis = new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).grow(0.25); List<EntityLivingBase> entities = entity.world.getEntitiesWithinAABB(EntityLivingBase.class, axis); if(!entities.isEmpty()) { Entity e = (Entity) burst; e.getEntityData().setBoolean(TAG_TRIPPED, true); } } }
private void breakBlockAndStoreItems( final WorldServer w, final BlockPos pos ) { w.destroyBlock( pos, true ); final AxisAlignedBB box = new AxisAlignedBB( pos ).grow( 0.2 ); for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) ) { if( ei instanceof EntityItem ) { final EntityItem entityItem = (EntityItem) ei; this.storeEntityItem( entityItem ); } } }
@Override public void onUpdate() { super.onUpdate(); float dist = 1.5F; for(int i = 0; i < 10; i++) { float xs = (float) (Math.random() - 0.5) * dist; float ys = (float) (Math.random() - 0.5) * dist; float zs = (float) (Math.random() - 0.5) * dist; Botania.proxy.sparkleFX(posX + xs, posY + ys, posZ + zs, 1F, 0.4F, 1F, 2F, 6); } EntityLivingBase thrower = getThrower(); if(!world.isRemote && thrower != null) { AxisAlignedBB axis = new AxisAlignedBB(posX, posY, posZ, lastTickPosX, lastTickPosY, lastTickPosZ).grow(2); List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, axis); for(EntityLivingBase living : entities) { if(living == thrower) continue; if(living.hurtTime == 0) { onImpact(new RayTraceResult(living)); return; } } } if(ticksExisted > 200) setDead(); }
@Override public void onWornTick(ItemStack stack, EntityLivingBase player) { super.onWornTick(stack, player); if(!(player instanceof EntityPlayer)) return; EntityPlayer eplayer = (EntityPlayer) player; double range = 24; AxisAlignedBB aabb = new AxisAlignedBB(player.posX, player.posY, player.posZ, player.posX, player.posY, player.posZ).grow(range); List<EntityLivingBase> mobs = player.world.getEntitiesWithinAABB(EntityLivingBase.class, aabb, (Entity e) -> e instanceof IMob); if(!mobs.isEmpty()) for(EntityLivingBase e : mobs) { PotionEffect potion = e.getActivePotionEffect(MobEffects.GLOWING); if((potion == null || potion.getDuration() <= 2) && ManaItemHandler.requestManaExact(stack, eplayer, COST, true)) e.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 12, 0)); } }
@Override public void updateBurst(IManaBurst burst, EntityThrowable entity, ItemStack stack) { if (entity.world.isRemote) return; AxisAlignedBB axis = new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).grow(1); List<EntityLivingBase> entities = entity.world.getEntitiesWithinAABB(EntityLivingBase.class, axis); for(EntityLivingBase living : entities) { if(living instanceof EntityPlayer) continue; if(living.hurtTime == 0) { int mana = burst.getMana(); if(mana >= 16) { burst.setMana(mana - 16); if(!burst.isFake()) living.attackEntityFrom(DamageSource.MAGIC, 8); break; } } } }
@SubscribeEvent public static void onExplosion(ExplosionEvent.Detonate event) { Explosion e = event.getExplosion(); Vec3d vec = e.getPosition(); List<EntityPlayer> players = event.getWorld().getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(vec.x, vec.y, vec.z, vec.x, vec.y, vec.z).grow(8)); for(EntityPlayer player : players) { ItemStack charm = BaublesApi.getBaublesHandler(player).getStackInSlot(6); if(!charm.isEmpty() && charm.getItem() instanceof ItemGoddessCharm && ManaItemHandler.requestManaExact(charm, player, COST, true)) { event.getAffectedBlocks().clear(); return; } } }
int k = world.getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), (double) (blockpos.getX() + 1), (double) (blockpos.getY() + 1), (double) (blockpos.getZ() + 1))).grow((double) logic.spawnRange)).size();
RayTraceResult rtr = player.getEntityBoundingBox().grow(0.25).calculateIntercept(origPos, newPos); if(rtr != null) player.attackEntityFrom(DamageSource.causeMobDamage(this), 6);
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 ) .max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 ); final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 ); final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( Vec3d, Vec3d1 );
@Override public void updateBurst(IManaBurst burst, ItemStack stack) { EntityThrowable entity = (EntityThrowable) burst; AxisAlignedBB axis = new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).grow(1); List<EntityLivingBase> entities = entity.world.getEntitiesWithinAABB(EntityLivingBase.class, axis); String attacker = ItemNBTHelper.getString(burst.getSourceLens(), TAG_ATTACKER_USERNAME, ""); for(EntityLivingBase living : entities) { if(living instanceof EntityPlayer && (living.getName().equals(attacker) || FMLCommonHandler.instance().getMinecraftServerInstance() != null && !FMLCommonHandler.instance().getMinecraftServerInstance().isPVPEnabled())) continue; if(living.hurtTime == 0) { int cost = MANA_PER_DAMAGE / 3; int mana = burst.getMana(); if(mana >= cost) { burst.setMana(mana - cost); float damage = 4F + BotaniaAPI.terrasteelToolMaterial.getAttackDamage(); if(!burst.isFake() && !entity.world.isRemote) { EntityPlayer player = living.world.getPlayerEntityByName(attacker); living.attackEntityFrom(player == null ? DamageSource.MAGIC : DamageSource.causePlayerDamage(player), damage); entity.setDead(); break; } } } } }
if(e instanceof EntityMagicLandmine) { BlockPos bpos = e.getPosition(); AxisAlignedBB aabb = new AxisAlignedBB(bpos).offset(0, offY, 0).grow(2.5, 0, 2.5);
double y = lastPingbackY; double z = lastPingbackZ; AxisAlignedBB aabb = new AxisAlignedBB(x, y, z, x, y, z).grow(PINGBACK_EXPIRED_SEARCH_DISTANCE, PINGBACK_EXPIRED_SEARCH_DISTANCE, PINGBACK_EXPIRED_SEARCH_DISTANCE); List bursts = world.getEntitiesWithinAABB(EntityThrowable.class, aabb, Predicates.instanceOf(IManaBurst.class)); IManaBurst found = null;
List<EntityShulker> shulkers = world.getEntitiesWithinAABB(EntityShulker.class, new AxisAlignedBB(pos).grow(RADIUS)); if(!world.isRemote) for(EntityShulker shulker : shulkers) {
AxisAlignedBB axis = new AxisAlignedBB(posX, posY, posZ, lastTickPosX, lastTickPosY, lastTickPosZ).grow(2); List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, axis); for(EntityLivingBase living : entities) {
AxisAlignedBB aabb = ModBlocks.lightRelay.getBoundingBox(world.getBlockState(pos), world, pos).offset(pos); float range = 0.5F; List<EntityEnderPearl> enderPearls = world.getEntitiesWithinAABB(EntityEnderPearl.class, aabb.grow(range)); for(EntityEnderPearl pearl : enderPearls) { pearl.setPositionAndUpdate(
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().offset(motionX*2, motionY*2, motionZ*2).grow(2)); double d0 = 0.0D; if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || pickupDelay == 0)) { float f = 1.0F; AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(f); RayTraceResult RayTraceResult1 = axisalignedbb.calculateIntercept(vec3, vec31);