本文整理匯總了Java中net.minecraft.command.IEntitySelector類的典型用法代碼示例。如果您正苦於以下問題:Java IEntitySelector類的具體用法?Java IEntitySelector怎麽用?Java IEntitySelector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IEntitySelector類屬於net.minecraft.command包,在下文中一共展示了IEntitySelector類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getComparatorInputOverride
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
@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;
}
示例2: EntityAINearestAttackableDragon
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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));
}
};
}
示例3: EntityBaron
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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);
}
示例4: EntitySpearGuard
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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);
}
示例5: EntityLongbowGuard
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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);
}
示例6: EntityCrossbowGuard
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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);
}
示例7: update
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
@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);
}
}
}
}
示例8: getEntitiesOfTypeWithinAAAB
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
/**
* 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);
}
}
}
}
示例9: getEntitiesWithinAABBExcludingEntity
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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;
}
示例10: selectEntitiesWithinAABB
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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;
}
示例11: EntityAINearestAttackableTarget
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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));
}
};
}
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:17,代碼來源:EntityAINearestAttackableTarget.java
示例12: func_96112_aD
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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;
}
}
示例13: getComparatorInputOverride
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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;
}
示例14: EntityAICustomNearestAttackableTarget
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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));
}
};
}
示例15: getClosestEntity
import net.minecraft.command.IEntitySelector; //導入依賴的package包/類
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;
}