net.minecraft.util.math.AxisAlignedBB.grow()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(36)

本文整理了Java中net.minecraft.util.math.AxisAlignedBB.grow()方法的一些代码示例,展示了AxisAlignedBB.grow()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AxisAlignedBB.grow()方法的具体详情如下:
包路径:net.minecraft.util.math.AxisAlignedBB
类名称:AxisAlignedBB
方法名:grow

AxisAlignedBB.grow介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

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();
  }
}

代码示例来源:origin: Vazkii/Botania

AxisAlignedBB boundingBox = new AxisAlignedBB(posX, posY, posZ, posX, posY, posZ).grow(radius, radius, radius);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox);

代码示例来源:origin: Vazkii/Botania

@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);
    }
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

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 );
    }
  }
}

代码示例来源:origin: Vazkii/Botania

@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();
}

代码示例来源:origin: Vazkii/Botania

@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));
    }
}

代码示例来源:origin: Vazkii/Botania

@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;
      }
    }
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

vec31.z ), Math.max( vec3.x, vec31.x ), Math.max( vec3.y, vec31.y ), Math.max( vec3.z, vec31.z ) ).grow(
    16, 16, 16 );
    final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
    final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( vec3, vec31 );

代码示例来源:origin: Vazkii/Botania

@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;
    }
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

for( AxisAlignedBB bb : boxes )
  bb = bb.grow( 0.002, 0.002, 0.002 );
  if( bb.contains( pos ) )
  for( AxisAlignedBB bb : boxes )
    bb = bb.grow( 0.01, 0.01, 0.01 );
    if( bb.contains( pos ) )

代码示例来源:origin: Vazkii/Botania

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();

代码示例来源:origin: Vazkii/Botania

RayTraceResult rtr = player.getEntityBoundingBox().grow(0.25).calculateIntercept(origPos, newPos);
if(rtr != null)
  player.attackEntityFrom(DamageSource.causeMobDamage(this), 6);

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

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 );

代码示例来源:origin: Vazkii/Botania

@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;
        }
      }
    }
  }
}

代码示例来源:origin: Vazkii/Botania

if(e instanceof EntityMagicLandmine) {
  BlockPos bpos = e.getPosition();
  AxisAlignedBB aabb = new AxisAlignedBB(bpos).offset(0, offY, 0).grow(2.5, 0, 2.5);

代码示例来源:origin: Vazkii/Botania

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;

代码示例来源:origin: Vazkii/Botania

List<EntityShulker> shulkers = world.getEntitiesWithinAABB(EntityShulker.class, new AxisAlignedBB(pos).grow(RADIUS));
if(!world.isRemote)
  for(EntityShulker shulker : shulkers) {

代码示例来源:origin: Vazkii/Botania

AxisAlignedBB axis = new AxisAlignedBB(posX, posY, posZ, lastTickPosX, lastTickPosY, lastTickPosZ).grow(2);
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, axis);
for(EntityLivingBase living : entities) {

代码示例来源:origin: Vazkii/Botania

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(

代码示例来源:origin: Vazkii/Botania

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);

相关文章