net.minecraft.world.World.getCollisionBoxes()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(109)

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

World.getCollisionBoxes介绍

暂无

代码示例

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  BlockPos coords = world.getSpawnPoint();
  if(MathHelper.pointDistanceSpace(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, player.posX, player.posY, player.posZ) > 24) {
    player.rotationPitch = 0F;
    player.rotationYaw = 0F;
    player.setPositionAndUpdate(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5);
    while(!world.getCollisionBoxes(player, player.getEntityBoundingBox()).isEmpty())
      player.setPositionAndUpdate(player.posX, player.posY + 1, player.posZ);
    world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F);
    for(int i = 0; i < 50; i++)
      Botania.proxy.sparkleFX(player.posX + Math.random() * player.width, player.posY - 1.6 + Math.random() * player.height, player.posZ + Math.random() * player.width, 0.25F, 1F, 0.25F, 1F, 10);
    stack.shrink(1);
    return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
  }
  return ActionResult.newResult(EnumActionResult.PASS, stack);
}

代码示例来源:origin: Tommsy64/SmartMovingReloaded

@Override
  public List<AxisAlignedBB> getIntersectingCollisionBoxes(AxisAlignedBB aabb) {
    return this.world.getCollisionBoxes((Entity) ((Object) this), aabb);
  }
}

代码示例来源:origin: Glitchfiend/FamiliarFauna

public boolean isBoxBlocked(AxisAlignedBB box)
{
  return !this.pixie.world.getCollisionBoxes(this.pixie, box).isEmpty();
}

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

if (world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(this.getEntityBoundingBox()))

代码示例来源:origin: Glitchfiend/FamiliarFauna

public boolean isBoxBlocked(AxisAlignedBB box)
{
  return !this.butterfly.world.getCollisionBoxes(this.butterfly, box).isEmpty();
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public @Nonnull List<AxisAlignedBB> getCollisionBoxes(@Nullable Entity entityIn, @Nonnull AxisAlignedBB aabb) {
 return wrapped.getCollisionBoxes(entityIn, aabb);
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public List<AxisAlignedBB> getCollisionBoxes(Entity entityIn, AxisAlignedBB aabb) {
  return getActualWorld().getCollisionBoxes(entityIn, aabb);
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

private boolean canFit(BlockPos pos) {
  double x = pos.getX() + 0.5;
  double y = pos.getY();
  double z = pos.getZ() + 0.5;
  AxisAlignedBB boundingBox = new AxisAlignedBB(x, y, z, x + this.dinosaur.width, y + this.dinosaur.height, z + this.dinosaur.width);
  return this.dinosaur.world.getCollisionBoxes(this.dinosaur, boundingBox).isEmpty() && this.dinosaur.world.getEntitiesWithinAABBExcludingEntity(this.dinosaur, boundingBox).isEmpty();
}

代码示例来源:origin: SleepyTrousers/EnderIO

private static boolean isClear(@Nonnull World world, @Nonnull Entity entity, double targetX, double targetY, double targetZ) {
 double origX = entity.posX, origY = entity.posY, origZ = entity.posZ;
 try {
  entity.setPosition(targetX, targetY, targetZ);
  boolean result = world.checkNoEntityCollision(entity.getEntityBoundingBox(), entity)
    && world.getCollisionBoxes(entity, entity.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(entity.getEntityBoundingBox());
  return result;
 } finally {
  entity.setPosition(origX, origY, origZ);
 }
}

代码示例来源:origin: CoFH/ThermalFoundation

@Override
public boolean isNotColliding() {
  return this.world.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.world.containsAnyLiquid(this.getEntityBoundingBox());
}

代码示例来源:origin: SleepyTrousers/EnderIO

public static boolean isOnGround(@Nonnull EntityCreature entity) {
 List<AxisAlignedBB> collides = entity.getEntityWorld().getCollisionBoxes(entity, entity.getEntityBoundingBox().offset(0, -0.1, 0));
 if (collides.isEmpty()) {
  return false;
 }
 BlockPos groundPos = entity.getPosition().down();
 IBlockState bs = entity.getEntityWorld().getBlockState(groundPos);
 if (bs.getMaterial().isLiquid()) {
  return false;
 }
 return true;
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public boolean getCanSpawnHere(boolean ignoreEntityCollision, boolean ignoreLight, boolean ignoreDimension) {
  if (!ignoreDimension) {
    if (EntityRogueAndroid.dimensionWhitelist.size() > 0) {
      return EntityRogueAndroid.dimensionWhitelist.contains(world.provider.getDimension()) && inDimensionBlacklist();
    }
    if (inDimensionBlacklist()) {
      return false;
    }
  }
  boolean light = ignoreLight || isValidLightLevel();
  boolean entityCollison = ignoreEntityCollision || this.world.checkNoEntityCollision(this.getEntityBoundingBox());
  return this.world.getDifficulty() != EnumDifficulty.PEACEFUL && light && entityCollison && this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.world.containsAnyLiquid(this.getEntityBoundingBox());
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && getEntityWorld().isMaterialInBB(getEntityBoundingBox(), Material.LAVA);
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  float light = getBrightness();
  if (light >= 0F)
    return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !getEntityWorld().containsAnyLiquid(getEntityBoundingBox());
  return super.getCanSpawnHere();
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  float light = getBrightness();
  if (light >= 0F)
    return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !getEntityWorld().containsAnyLiquid(getEntityBoundingBox());
  return super.getCanSpawnHere();
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  int y = MathHelper.floor(getEntityBoundingBox().minY);
  if(y <= ChunkProviderErebus.swampWaterHeight)
    return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && getEntityWorld().isMaterialInBB(getEntityBoundingBox(), Material.WATER);
  return false;
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  float light = getBrightness();
  if (light >= 0F)
    return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !getEntityWorld().containsAnyLiquid(getEntityBoundingBox()) && getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL;
  return super.getCanSpawnHere();
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  float light = getBrightness();
  if (light >= 0F)
    return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !getEntityWorld().containsAnyLiquid(getEntityBoundingBox()) && getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL;
  return super.getCanSpawnHere();
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  float light = getBrightness();
  if (light >= 0F)
    return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !getEntityWorld().containsAnyLiquid(getEntityBoundingBox()) && getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL;
  return super.getCanSpawnHere();
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  return getEntityWorld().checkNoEntityCollision(getEntityBoundingBox()) && getEntityWorld().getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !getEntityWorld().containsAnyLiquid(getEntityBoundingBox()) && getEntityWorld().isAirBlock(getPosition()) && getEntityWorld().getBlockState(getPosition().up()).getBlock() == ModBlocks.GNEISS;
}

相关文章

微信公众号

最新文章

更多

World类方法