Java 类net.minecraft.command.IEntitySelector 实例源码

项目:NyaSamaRailway    文件:RailMonoMagnetDetector.java   
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int i)
{
    if ((world.getBlockMetadata(x, y, z) & 8) > 0)
    {
        float f = 0.125F;
        List list = world.getEntitiesWithinAABB(EntityMinecartCommandBlock.class, AxisAlignedBB.getBoundingBox((double)((float)x + f), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)((float)(y + 1) - f), (double)((float)(z + 1) - f)));

        if (list.size() > 0)
        {
            return ((EntityMinecartCommandBlock)list.get(0)).func_145822_e().func_145760_g();
        }

        List list1 = world.selectEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox((double)((float)x + f), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)((float)(y + 1) - f), (double)((float)(z + 1) - f)), IEntitySelector.selectInventories);

        if (list1.size() > 0)
        {
            return Container.calcRedstoneFromInventory((IInventory)list1.get(0));
        }
    }

    return 0;
}
项目:Coding    文件:EntityAINearestAttackableDragon.java   
public EntityAINearestAttackableDragon(EntityCreature attacker, int p_i1665_3_, boolean p_i1665_4_, boolean p_i1665_5_, final IEntitySelector p_i1665_6_) {
        super(attacker, p_i1665_4_, p_i1665_5_);
        this.targetClass = EntityPlayer.class;
        this.targetChance = p_i1665_3_;
        this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(attacker);
        this.setMutexBits(1);
        this.targetEntitySelector = new IEntitySelector() {
//            private static final String __OBFID = "CL_00001621";
            /**
             * Return whether the specified entity is applicable to this filter.
             */
            public boolean isEntityApplicable(Entity p_82704_1_) {
                return !(p_82704_1_ instanceof EntityLivingBase) ? false : 
                    (p_i1665_6_ != null && !p_i1665_6_.isEntityApplicable(p_82704_1_) ? false : 
                        EntityAINearestAttackableDragon.this.isSuitableTarget((EntityLivingBase)p_82704_1_, false));
            }
        };
    }
项目:Coding    文件:EntityBaron.java   
public EntityBaron(World world){
    super(world);
    // TODO: Add a new AI that summons 2 guards if no guards are nearby
    this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, 
            new IEntitySelector() {
                public boolean isEntityApplicable(Entity entity) {
                    if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie)
                        return true;
                    return false;
                }
        }));        
    // Summons 2 guards
    this.targetTasks.addTask(3, new EntityAISummonGuards(this, EntityPlayer.class, true, true, 2));

    setGuardWeaponType(type);
}
项目:Coding    文件:EntitySpearGuard.java   
public EntitySpearGuard(World world){
    super(world);
    if (this.worldObj.difficultySetting == EnumDifficulty.EASY)
        this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true));
    else
        this.tasks.addTask(1, new EntityAISpearAttack(this, 1.0D, 20, 60, 15.0F));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, 
            new IEntitySelector() {
                public boolean isEntityApplicable(Entity entity) {
                    if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie)
                        return true;
                    return false;
                }
        }));                
    setGuardWeaponType(type);
}
项目:Coding    文件:EntityLongbowGuard.java   
public EntityLongbowGuard(World world){
    super(world);
    if (this.worldObj.difficultySetting == EnumDifficulty.EASY)
        this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true));
    else
        this.tasks.addTask(1, new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, 
            new IEntitySelector() {
                public boolean isEntityApplicable(Entity entity) {
                    if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie)
                        return true;
                    return false;
                }
        }));                
    setGuardWeaponType(type);
}
项目:Coding    文件:EntityCrossbowGuard.java   
public EntityCrossbowGuard(World world){
    super(world);
    if (this.worldObj.difficultySetting == EnumDifficulty.EASY)
        this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true));
    else
        this.tasks.addTask(1, new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityCreature.class, 0, true, false, 
            new IEntitySelector() {
                public boolean isEntityApplicable(Entity entity) {
                    if (!isLookingForHome && ((EntityCreature) entity).isWithinHomeDistanceCurrentPosition() && entity instanceof EntityZombie)
                        return true;
                    return false;
                }
        }));                
    setGuardWeaponType(type);
}
项目:FutureCraft    文件:TileEntityMovingSidewalk.java   
@Override
public void update() {

    if (!worldObj.isRemote) {

        List<?> list = worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY() + 1.0D, this.pos.getZ(), this.pos.getX() + 1.0D, this.pos.getY() + 1.1D, this.pos.getZ() + 1.0D), IEntitySelector.selectAnything);

        for (int i = 0; i < list.size(); i++) {

            if (list.get(i) instanceof Entity || list.get(i) instanceof EntityPlayer) {
                Entity entity = null;
                if (list.get(i) instanceof Entity) entity = (Entity) list.get(i);
                else if (list.get(i) instanceof EntityPlayer) entity = (EntityPlayer) list.get(i);
                if (worldObj.getBlockState(this.getPos()) == BlockList.moving_sidewalk.getStateFromMeta(0)) entity.addVelocity(0, 0, 0.1);
                if (worldObj.getBlockState(this.getPos()) == BlockList.moving_sidewalk.getStateFromMeta(1)) entity.addVelocity(-0.1, 0, 0);
                if (worldObj.getBlockState(this.getPos()) == BlockList.moving_sidewalk.getStateFromMeta(2)) entity.addVelocity(0, 0, -0.1);
                if (worldObj.getBlockState(this.getPos()) == BlockList.moving_sidewalk.getStateFromMeta(3)) entity.addVelocity(0.1, 0, 0);
                     }
        }
    }

}
项目:Resilience-Client-Source    文件:Chunk.java   
/**
 * Gets all entities that can be assigned to the specified class. Args: entityClass, aabb, listToFill
 */
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector)
{
    int var5 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
    int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);
    var5 = MathHelper.clamp_int(var5, 0, this.entityLists.length - 1);
    var6 = MathHelper.clamp_int(var6, 0, this.entityLists.length - 1);

    for (int var7 = var5; var7 <= var6; ++var7)
    {
        List var8 = this.entityLists[var7];

        for (int var9 = 0; var9 < var8.size(); ++var9)
        {
            Entity var10 = (Entity)var8.get(var9);

            if (par1Class.isAssignableFrom(var10.getClass()) && var10.boundingBox.intersectsWith(par2AxisAlignedBB) && (par4IEntitySelector == null || par4IEntitySelector.isEntityApplicable(var10)))
            {
                par3List.add(var10);
            }
        }
    }
}
项目:Resilience-Client-Source    文件:World.java   
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
    ArrayList var4 = new ArrayList();
    int var5 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D);
    int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D);
    int var7 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D);
    int var8 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D);

    for (int var9 = var5; var9 <= var6; ++var9)
    {
        for (int var10 = var7; var10 <= var8; ++var10)
        {
            if (this.chunkExists(var9, var10))
            {
                this.getChunkFromChunkCoords(var9, var10).getEntitiesWithinAABBForEntity(par1Entity, par2AxisAlignedBB, var4, par3IEntitySelector);
            }
        }
    }

    return var4;
}
项目:Resilience-Client-Source    文件:World.java   
public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
    int var4 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D);
    int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D);
    int var6 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D);
    int var7 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D);
    ArrayList var8 = new ArrayList();

    for (int var9 = var4; var9 <= var5; ++var9)
    {
        for (int var10 = var6; var10 <= var7; ++var10)
        {
            if (this.chunkExists(var9, var10))
            {
                this.getChunkFromChunkCoords(var9, var10).getEntitiesOfTypeWithinAAAB(par1Class, par2AxisAlignedBB, var8, par3IEntitySelector);
            }
        }
    }

    return var8;
}
项目:Resilience-Client-Source    文件:EntityAINearestAttackableTarget.java   
public EntityAINearestAttackableTarget(EntityCreature par1EntityCreature, Class par2Class, int par3, boolean par4, boolean par5, final IEntitySelector par6IEntitySelector)
{
    super(par1EntityCreature, par4, par5);
    this.targetClass = par2Class;
    this.targetChance = par3;
    this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(par1EntityCreature);
    this.setMutexBits(1);
    this.targetEntitySelector = new IEntitySelector()
    {
        private static final String __OBFID = "CL_00001621";
        public boolean isEntityApplicable(Entity par1Entity)
        {
            return !(par1Entity instanceof EntityLivingBase) ? false : (par6IEntitySelector != null && !par6IEntitySelector.isEntityApplicable(par1Entity) ? false : EntityAINearestAttackableTarget.this.isSuitableTarget((EntityLivingBase)par1Entity, false));
        }
    };
}
项目:Resilience-Client-Source    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.func_145891_a(this))
    {
        return true;
    }
    else
    {
        List var1 = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (var1.size() > 0)
        {
            TileEntityHopper.func_145898_a(this, (EntityItem)var1.get(0));
        }

        return false;
    }
}
项目:Resilience-Client-Source    文件:BlockRailDetector.java   
public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, int p_149736_5_)
{
    if ((p_149736_1_.getBlockMetadata(p_149736_2_, p_149736_3_, p_149736_4_) & 8) > 0)
    {
        float var6 = 0.125F;
        List var7 = p_149736_1_.getEntitiesWithinAABB(EntityMinecartCommandBlock.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)p_149736_2_ + var6), (double)p_149736_3_, (double)((float)p_149736_4_ + var6), (double)((float)(p_149736_2_ + 1) - var6), (double)((float)(p_149736_3_ + 1) - var6), (double)((float)(p_149736_4_ + 1) - var6)));

        if (var7.size() > 0)
        {
            return ((EntityMinecartCommandBlock)var7.get(0)).func_145822_e().func_145760_g();
        }

        List var8 = p_149736_1_.selectEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)p_149736_2_ + var6), (double)p_149736_3_, (double)((float)p_149736_4_ + var6), (double)((float)(p_149736_2_ + 1) - var6), (double)((float)(p_149736_3_ + 1) - var6), (double)((float)(p_149736_4_ + 1) - var6)), IEntitySelector.selectInventories);

        if (var8.size() > 0)
        {
            return Container.calcRedstoneFromInventory((IInventory)var8.get(0));
        }
    }

    return 0;
}
项目:hungryZombies    文件:EntityAICustomNearestAttackableTarget.java   
public EntityAICustomNearestAttackableTarget(EntityCreature p_i1665_1_, Class p_i1665_2_, int p_i1665_3_, boolean p_i1665_4_, boolean p_i1665_5_, final IEntitySelector p_i1665_6_)
{
    super(p_i1665_1_, p_i1665_4_, p_i1665_5_);
    this.targetClass = p_i1665_2_;
    this.targetChance = p_i1665_3_;
    this.theNearestAttackableTargetSorter = new EntityAICustomNearestAttackableTarget.Sorter(p_i1665_1_);
    this.setMutexBits(1);
    this.targetEntitySelector = new IEntitySelector()
    {
        private static final String __OBFID = "CL_00001621";
        /**
         * Return whether the specified entity is applicable to this filter.
         */
        public boolean isEntityApplicable(Entity p_82704_1_)
        {
            return !(p_82704_1_ instanceof EntityLivingBase) ? false : (p_i1665_6_ != null && !p_i1665_6_.isEntityApplicable(p_82704_1_) ? false : EntityAICustomNearestAttackableTarget.this.isSuitableTarget((EntityLivingBase)p_82704_1_, false));
        }
    };
}
项目:Magicians-Artifice    文件:EntityHelper.java   
public static Entity getClosestEntity(World world, int x, int y, int z, int range, EntityPlayer player) {
    // unfortunately the method returns a list without a generic type, so we have to treat the elements of the list as objects. thats why i didn't do List<Entity>, its not my fault
    List entities = world.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(x - range, y - range, z - range, x + range, y + range, z + range), IEntitySelector.selectAnything);

    Entity closest = null;
    double dist = -1;
    for(Object o : entities) {
        System.out.println(o);
        Entity e = (Entity) o;

        double d = Math.sqrt((x - e.posX) + (x - e.posY) + (z + e.posZ));
        if(dist == -1 && d < dist) {
            dist = d;
            closest = e;
        }
    }

    //System.out.println(closest);
    return closest;
}
项目:vintagecraft    文件:EntityAIStayCloseToGroup.java   
public Entity findNearestEntityWithinAABB(Class entityType, AxisAlignedBB aabb, Entity closestTo, int excludingEntityId) {
    List list = entity.worldObj.getEntitiesWithinAABB(entityType, aabb);
    Entity closestEntity = null;
    double smallestDistance = Double.MAX_VALUE;

    for (int i = 0; i < list.size(); ++i) {
        Entity entity2 = (Entity)list.get(i);

        if (entity2 != closestTo && IEntitySelector.NOT_SPECTATING.apply(entity2)) {
            double dist = closestTo.getDistanceSqToEntity(entity2);

            if (dist <= smallestDistance && excludingEntityId != entity2.getEntityId()) {
                closestEntity = entity2;
                smallestDistance = dist;
            }
        }
    }

    return closestEntity;
}
项目:Cauldron    文件:Chunk.java   
public void getEntitiesOfTypeWithinAAAB(Class p_76618_1_, AxisAlignedBB p_76618_2_, List p_76618_3_, IEntitySelector p_76618_4_)
{
    int i = MathHelper.floor_double((p_76618_2_.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((p_76618_2_.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
    i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
    j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);

    for (int k = i; k <= j; ++k)
    {
        List list1 = this.entityLists[k];

        for (int l = 0; l < list1.size(); ++l)
        {
            Entity entity = (Entity)list1.get(l);

            if (p_76618_1_.isAssignableFrom(entity.getClass()) && entity.boundingBox.intersectsWith(p_76618_2_) && (p_76618_4_ == null || p_76618_4_.isEntityApplicable(entity)))
            {
                p_76618_3_.add(entity);
            }
        }
    }
}
项目:Cauldron    文件:World.java   
public List getEntitiesWithinAABBExcludingEntity(Entity p_94576_1_, AxisAlignedBB p_94576_2_, IEntitySelector p_94576_3_)
{
    ArrayList arraylist = new ArrayList();
    int i = MathHelper.floor_double((p_94576_2_.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((p_94576_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((p_94576_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((p_94576_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D);

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(p_94576_1_, p_94576_2_, arraylist, p_94576_3_);
            }
        }
    }

    return arraylist;
}
项目:Cauldron    文件:World.java   
public List selectEntitiesWithinAABB(Class p_82733_1_, AxisAlignedBB p_82733_2_, IEntitySelector p_82733_3_)
{
    int i = MathHelper.floor_double((p_82733_2_.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((p_82733_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((p_82733_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((p_82733_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
    ArrayList arraylist = new ArrayList();

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(p_82733_1_, p_82733_2_, arraylist, p_82733_3_);
            }
        }
    }

    return arraylist;
}
项目:Cauldron    文件:EntityAINearestAttackableTarget.java   
public EntityAINearestAttackableTarget(EntityCreature p_i1665_1_, Class p_i1665_2_, int p_i1665_3_, boolean p_i1665_4_, boolean p_i1665_5_, final IEntitySelector p_i1665_6_)
{
    super(p_i1665_1_, p_i1665_4_, p_i1665_5_);
    this.targetClass = p_i1665_2_;
    this.targetChance = p_i1665_3_;
    this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(p_i1665_1_);
    this.setMutexBits(1);
    this.targetEntitySelector = new IEntitySelector()
    {
        private static final String __OBFID = "CL_00001621";
        public boolean isEntityApplicable(Entity p_82704_1_)
        {
            return !(p_82704_1_ instanceof EntityLivingBase) ? false : (p_i1665_6_ != null && !p_i1665_6_.isEntityApplicable(p_82704_1_) ? false : EntityAINearestAttackableTarget.this.isSuitableTarget((EntityLivingBase)p_82704_1_, false));
        }
    };
}
项目:Cauldron    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.func_145891_a(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.func_145898_a(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:Cauldron    文件:BlockRailDetector.java   
public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, int p_149736_5_)
{
    if ((p_149736_1_.getBlockMetadata(p_149736_2_, p_149736_3_, p_149736_4_) & 8) > 0)
    {
        float f = 0.125F;
        List list = p_149736_1_.getEntitiesWithinAABB(EntityMinecartCommandBlock.class, AxisAlignedBB.getBoundingBox((double)((float)p_149736_2_ + f), (double)p_149736_3_, (double)((float)p_149736_4_ + f), (double)((float)(p_149736_2_ + 1) - f), (double)((float)(p_149736_3_ + 1) - f), (double)((float)(p_149736_4_ + 1) - f)));

        if (list.size() > 0)
        {
            return ((EntityMinecartCommandBlock)list.get(0)).func_145822_e().func_145760_g();
        }

        List list1 = p_149736_1_.selectEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox((double)((float)p_149736_2_ + f), (double)p_149736_3_, (double)((float)p_149736_4_ + f), (double)((float)(p_149736_2_ + 1) - f), (double)((float)(p_149736_3_ + 1) - f), (double)((float)(p_149736_4_ + 1) - f)), IEntitySelector.selectInventories);

        if (list1.size() > 0)
        {
            return Container.calcRedstoneFromInventory((IInventory)list1.get(0));
        }
    }

    return 0;
}
项目:Cauldron    文件:Chunk.java   
public void getEntitiesOfTypeWithinAAAB(Class p_76618_1_, AxisAlignedBB p_76618_2_, List p_76618_3_, IEntitySelector p_76618_4_)
{
    int i = MathHelper.floor_double((p_76618_2_.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((p_76618_2_.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
    i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
    j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);

    for (int k = i; k <= j; ++k)
    {
        List list1 = this.entityLists[k];

        for (int l = 0; l < list1.size(); ++l)
        {
            Entity entity = (Entity)list1.get(l);

            if (p_76618_1_.isAssignableFrom(entity.getClass()) && entity.boundingBox.intersectsWith(p_76618_2_) && (p_76618_4_ == null || p_76618_4_.isEntityApplicable(entity)))
            {
                p_76618_3_.add(entity);
            }
        }
    }
}
项目:Cauldron    文件:World.java   
public List getEntitiesWithinAABBExcludingEntity(Entity p_94576_1_, AxisAlignedBB p_94576_2_, IEntitySelector p_94576_3_)
{
    ArrayList arraylist = new ArrayList();
    int i = MathHelper.floor_double((p_94576_2_.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((p_94576_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((p_94576_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((p_94576_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D);

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(p_94576_1_, p_94576_2_, arraylist, p_94576_3_);
            }
        }
    }

    return arraylist;
}
项目:Cauldron    文件:World.java   
public List selectEntitiesWithinAABB(Class p_82733_1_, AxisAlignedBB p_82733_2_, IEntitySelector p_82733_3_)
{
    int i = MathHelper.floor_double((p_82733_2_.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((p_82733_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((p_82733_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((p_82733_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
    ArrayList arraylist = new ArrayList();

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(p_82733_1_, p_82733_2_, arraylist, p_82733_3_);
            }
        }
    }

    return arraylist;
}
项目:Cauldron    文件:EntityAINearestAttackableTarget.java   
public EntityAINearestAttackableTarget(EntityCreature p_i1665_1_, Class p_i1665_2_, int p_i1665_3_, boolean p_i1665_4_, boolean p_i1665_5_, final IEntitySelector p_i1665_6_)
{
    super(p_i1665_1_, p_i1665_4_, p_i1665_5_);
    this.targetClass = p_i1665_2_;
    this.targetChance = p_i1665_3_;
    this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(p_i1665_1_);
    this.setMutexBits(1);
    this.targetEntitySelector = new IEntitySelector()
    {
        private static final String __OBFID = "CL_00001621";
        public boolean isEntityApplicable(Entity p_82704_1_)
        {
            return !(p_82704_1_ instanceof EntityLivingBase) ? false : (p_i1665_6_ != null && !p_i1665_6_.isEntityApplicable(p_82704_1_) ? false : EntityAINearestAttackableTarget.this.isSuitableTarget((EntityLivingBase)p_82704_1_, false));
        }
    };
}
项目:Cauldron    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.func_145891_a(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.func_145898_a(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:Cauldron    文件:BlockRailDetector.java   
public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, int p_149736_5_)
{
    if ((p_149736_1_.getBlockMetadata(p_149736_2_, p_149736_3_, p_149736_4_) & 8) > 0)
    {
        float f = 0.125F;
        List list = p_149736_1_.getEntitiesWithinAABB(EntityMinecartCommandBlock.class, AxisAlignedBB.getBoundingBox((double)((float)p_149736_2_ + f), (double)p_149736_3_, (double)((float)p_149736_4_ + f), (double)((float)(p_149736_2_ + 1) - f), (double)((float)(p_149736_3_ + 1) - f), (double)((float)(p_149736_4_ + 1) - f)));

        if (list.size() > 0)
        {
            return ((EntityMinecartCommandBlock)list.get(0)).func_145822_e().func_145760_g();
        }

        List list1 = p_149736_1_.selectEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox((double)((float)p_149736_2_ + f), (double)p_149736_3_, (double)((float)p_149736_4_ + f), (double)((float)(p_149736_2_ + 1) - f), (double)((float)(p_149736_3_ + 1) - f), (double)((float)(p_149736_4_ + 1) - f)), IEntitySelector.selectInventories);

        if (list1.size() > 0)
        {
            return Container.calcRedstoneFromInventory((IInventory)list1.get(0));
        }
    }

    return 0;
}
项目:TameHumans    文件:EntityAITamedNearestAttackableTarget.java   
public EntityAITamedNearestAttackableTarget(EntityTameable p_i1665_1_, Class p_i1665_2_, int p_i1665_3_, boolean p_i1665_4_, boolean p_i1665_5_, final IEntitySelector p_i1665_6_) {
    super(p_i1665_1_, p_i1665_4_, p_i1665_5_);
    this.tameable = p_i1665_1_;
    this.targetClass = p_i1665_2_;
    this.targetChance = p_i1665_3_;
    this.theNearestAttackableTargetSorter = new EntityAITamedNearestAttackableTarget.Sorter(p_i1665_1_);
    this.setMutexBits(1);
    this.targetEntitySelector = new IEntitySelector() {
        private static final String __OBFID = "CL_00001621";

        /**
         * Return whether the specified entity is applicable to this filter.
         */
        public boolean isEntityApplicable(Entity p_82704_1_) {
            return p_82704_1_ instanceof EntityLivingBase && (p_i1665_6_ != null && !p_i1665_6_.isEntityApplicable(p_82704_1_) ? false : EntityAITamedNearestAttackableTarget.this.isSuitableTarget((EntityLivingBase) p_82704_1_, false));
        }
    };
}
项目:RuneCraftery    文件:World.java   
public List func_94576_a(Entity p_94576_1_, AxisAlignedBB p_94576_2_, IEntitySelector p_94576_3_) {
   ArrayList var4 = new ArrayList();
   int var5 = MathHelper.func_76128_c((p_94576_2_.field_72340_a - 2.0D) / 16.0D);
   int var6 = MathHelper.func_76128_c((p_94576_2_.field_72336_d + 2.0D) / 16.0D);
   int var7 = MathHelper.func_76128_c((p_94576_2_.field_72339_c - 2.0D) / 16.0D);
   int var8 = MathHelper.func_76128_c((p_94576_2_.field_72334_f + 2.0D) / 16.0D);

   for(int var9 = var5; var9 <= var6; ++var9) {
      for(int var10 = var7; var10 <= var8; ++var10) {
         if(this.func_72916_c(var9, var10)) {
            this.func_72964_e(var9, var10).func_76588_a(p_94576_1_, p_94576_2_, var4, p_94576_3_);
         }
      }
   }

   return var4;
}
项目:RuneCraftery    文件:World.java   
public List func_82733_a(Class p_82733_1_, AxisAlignedBB p_82733_2_, IEntitySelector p_82733_3_) {
   int var4 = MathHelper.func_76128_c((p_82733_2_.field_72340_a - 2.0D) / 16.0D);
   int var5 = MathHelper.func_76128_c((p_82733_2_.field_72336_d + 2.0D) / 16.0D);
   int var6 = MathHelper.func_76128_c((p_82733_2_.field_72339_c - 2.0D) / 16.0D);
   int var7 = MathHelper.func_76128_c((p_82733_2_.field_72334_f + 2.0D) / 16.0D);
   ArrayList var8 = new ArrayList();

   for(int var9 = var4; var9 <= var5; ++var9) {
      for(int var10 = var6; var10 <= var7; ++var10) {
         if(this.func_72916_c(var9, var10)) {
            this.func_72964_e(var9, var10).func_76618_a(p_82733_1_, p_82733_2_, var8, p_82733_3_);
         }
      }
   }

   return var8;
}
项目:RuneCraftery    文件:TileEntityHopper.java   
public static IInventory func_96117_b(World p_96117_0_, double p_96117_1_, double p_96117_3_, double p_96117_5_) {
   IInventory var7 = null;
   int var8 = MathHelper.func_76128_c(p_96117_1_);
   int var9 = MathHelper.func_76128_c(p_96117_3_);
   int var10 = MathHelper.func_76128_c(p_96117_5_);
   TileEntity var11 = p_96117_0_.func_72796_p(var8, var9, var10);
   if(var11 != null && var11 instanceof IInventory) {
      var7 = (IInventory)var11;
      if(var7 instanceof TileEntityChest) {
         int var12 = p_96117_0_.func_72798_a(var8, var9, var10);
         Block var13 = Block.field_71973_m[var12];
         if(var13 instanceof BlockChest) {
            var7 = ((BlockChest)var13).func_94442_h_(p_96117_0_, var8, var9, var10);
         }
      }
   }

   if(var7 == null) {
      List var14 = p_96117_0_.func_94576_a((Entity)null, AxisAlignedBB.func_72332_a().func_72299_a(p_96117_1_, p_96117_3_, p_96117_5_, p_96117_1_ + 1.0D, p_96117_3_ + 1.0D, p_96117_5_ + 1.0D), IEntitySelector.field_96566_b);
      if(var14 != null && var14.size() > 0) {
         var7 = (IInventory)var14.get(p_96117_0_.field_73012_v.nextInt(var14.size()));
      }
   }

   return var7;
}
项目:RuneCraftery    文件:World.java   
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
    ArrayList arraylist = new ArrayList();
    int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(par1Entity, par2AxisAlignedBB, arraylist, par3IEntitySelector);
            }
        }
    }

    return arraylist;
}
项目:RuneCraftery    文件:World.java   
public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
    int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
    ArrayList arraylist = new ArrayList();

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(par1Class, par2AxisAlignedBB, arraylist, par3IEntitySelector);
            }
        }
    }

    return arraylist;
}
项目:RuneCraftery    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.suckItemsIntoHopper(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.insertStackFromEntity(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:RuneCraftery    文件:BlockDetectorRail.java   
/**
 * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal
 * strength when this block inputs to a comparator.
 */
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5)
{
    if ((par1World.getBlockMetadata(par2, par3, par4) & 8) > 0)
    {
        float f = 0.125F;
        List list = par1World.selectEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + f), (double)par3, (double)((float)par4 + f), (double)((float)(par2 + 1) - f), (double)((float)(par3 + 1) - f), (double)((float)(par4 + 1) - f)), IEntitySelector.selectInventories);

        if (list.size() > 0)
        {
            return Container.calcRedstoneFromInventory((IInventory)list.get(0));
        }
    }

    return 0;
}
项目:BetterNutritionMod    文件:World.java   
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
    ArrayList arraylist = new ArrayList();
    int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(par1Entity, par2AxisAlignedBB, arraylist, par3IEntitySelector);
            }
        }
    }

    return arraylist;
}
项目:BetterNutritionMod    文件:World.java   
public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
    int i = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
    int j = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
    int k = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
    int l = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
    ArrayList arraylist = new ArrayList();

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.chunkExists(i1, j1))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(par1Class, par2AxisAlignedBB, arraylist, par3IEntitySelector);
            }
        }
    }

    return arraylist;
}
项目:BetterNutritionMod    文件:EntityMinecartHopper.java   
public boolean func_96112_aD()
{
    if (TileEntityHopper.suckItemsIntoHopper(this))
    {
        return true;
    }
    else
    {
        List list = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything);

        if (list.size() > 0)
        {
            TileEntityHopper.insertStackFromEntity(this, (EntityItem)list.get(0));
        }

        return false;
    }
}
项目:BetterNutritionMod    文件:BlockDetectorRail.java   
/**
 * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal
 * strength when this block inputs to a comparator.
 */
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5)
{
    if ((par1World.getBlockMetadata(par2, par3, par4) & 8) > 0)
    {
        float f = 0.125F;
        List list = par1World.selectEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + f), (double)par3, (double)((float)par4 + f), (double)((float)(par2 + 1) - f), (double)((float)(par3 + 1) - f), (double)((float)(par4 + 1) - f)), IEntitySelector.selectInventories);

        if (list.size() > 0)
        {
            return Container.calcRedstoneFromInventory((IInventory)list.get(0));
        }
    }

    return 0;
}