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

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

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

World.collidesWithAnyBlock介绍

暂无

代码示例

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

@Override
public boolean collidesWithAnyBlock(@Nonnull AxisAlignedBB bbox) {
 return wrapped.collidesWithAnyBlock(bbox);
}

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

@Override
public boolean collidesWithAnyBlock(AxisAlignedBB bbox) {
  return getActualWorld().collidesWithAnyBlock(bbox);
}

代码示例来源:origin: PrinceOfAmber/Cyclic

public static void moveEntityWallSafe(EntityLivingBase entity, World world) {
 while (world.collidesWithAnyBlock(entity.getEntityBoundingBox())) {
  entity.setPositionAndUpdate(entity.posX, entity.posY + 1.0D, entity.posZ);
 }
}

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

@Unique
private boolean checkForCollision(float width, float height) {
  AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
  axisalignedbb = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ,
      axisalignedbb.minX + (double) width, axisalignedbb.minY + (double) height, axisalignedbb.minZ + (double) width);
  return this.world.collidesWithAnyBlock(axisalignedbb);
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
public boolean getCanSpawnHere() {
  return this.world.checkNoEntityCollision(this.getEntityBoundingBox()) && this.world.collidesWithAnyBlock(this.getEntityBoundingBox()) && !this.world.containsAnyLiquid(this.getEntityBoundingBox());
}

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

@Override
public boolean shouldContinueExecuting() {
  if (this.path == null || (this.world.collidesWithAnyBlock(this.entity.getEntityBoundingBox()) && !this.isBlockLeaves(this.entity.getPosition()))) {
    return false;
  }
  if (!this.reachedTarget) {
    if (!this.path.isFinished() && !this.path.isSamePath(this.entity.getNavigator().getPath())) {
      return false;
    }
  }
  return this.active && !this.gliding;
}

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

@Override
protected void setSize(float width, float height) {
  if (width != this.width || height != this.height) {
    float prevWidth = this.width;
    this.width = width;
    this.height = height;
    if (!this.deserializing) {
      AxisAlignedBB bounds = this.getEntityBoundingBox();
      AxisAlignedBB newBounds = new AxisAlignedBB(bounds.minX, bounds.minY, bounds.minZ, bounds.minX + this.width, bounds.minY + this.height, bounds.minZ + this.width);
      if (!this.world.collidesWithAnyBlock(newBounds)) {
        this.setEntityBoundingBox(newBounds);
        if (this.width > prevWidth && !this.firstUpdate && !this.world.isRemote) {
          this.move(MoverType.SELF, prevWidth - this.width, 0.0F, prevWidth - this.width);
        }
      }
    } else {
      float halfWidth = this.width / 2.0F;
      this.setEntityBoundingBox(new AxisAlignedBB(this.posX - halfWidth, this.posY, this.posZ - halfWidth, this.posX + halfWidth, this.posY + this.height, this.posZ + halfWidth));
    }
  }
}

代码示例来源:origin: TeamLapen/Vampirism

/**
 * Set the player's entity size to the bat size if it isn't already
 *
 * @param player
 */
public static void updatePlayerBatSize(EntityPlayer player) {
  float width = BAT_WIDTH;
  float height = BAT_HEIGHT;
  if (player.isSneaking()) {
    height = BAT_HEIGHT - 0.15F;
  }
  if (player.isPlayerSleeping()) {
    height = 0.2F;
    width = 0.2F;
  }
  if (player.width != width || player.height != height) {
    AxisAlignedBB axisalignedbb = player.getEntityBoundingBox();
    axisalignedbb = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + (double) width, axisalignedbb.minY + (double) height, axisalignedbb.minZ + (double) width);
    if (!player.getEntityWorld().collidesWithAnyBlock(axisalignedbb)) {
      if (!VampirePlayer.get(player).setEntitySize(width, height)) return;
    }
  }
}

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

AxisAlignedBB boundsAtGroundPoint = boundsAtPoint.expand(0.0, pointBlockBounds.maxY - 0.002, 0.0);
  if (this.entity.world.collidesWithAnyBlock(boundsAtGroundPoint)) {
    point = null;
AxisAlignedBB boundsAtPoint = new AxisAlignedBB(x - halfWidth + 0.5, y + 0.001, z - halfWidth + 0.5, x + halfWidth + 0.5, (y + this.entity.height), z + halfWidth + 0.5);
if (this.entity.world.collidesWithAnyBlock(boundsAtPoint)) {
  return null;

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

AxisAlignedBB axisalignedbb2 = axisalignedbb.expand(0.0D, axisalignedbb1.maxY - 0.002D, 0.0D);
  if (this.entity.world.collidesWithAnyBlock(axisalignedbb2)) {
    pathpoint = null;
AxisAlignedBB axisalignedbb3 = new AxisAlignedBB((double) x - d1 + 0.5D, (double) y + 0.001D, (double) z - d1 + 0.5D, (double) x + d1 + 0.5D, (double) ((float) y + this.entity.height), (double) z + d1 + 0.5D);
if (this.entity.world.collidesWithAnyBlock(axisalignedbb3)) {
  return null;

代码示例来源:origin: Alex-the-666/Ice_and_Fire

AxisAlignedBB axisalignedbb2 = axisalignedbb.expand(0.0D, axisalignedbb1.maxY - 0.002D, 0.0D);
  if (this.entity.world.collidesWithAnyBlock(axisalignedbb2)) {
    pathpoint = null;
AxisAlignedBB axisalignedbb3 = new AxisAlignedBB((double) x - d1 + 0.5D, (double) y + 0.001D, (double) z - d1 + 0.5D, (double) x + d1 + 0.5D, (double) ((float) y + this.entity.height), (double) z + d1 + 0.5D);
if (this.entity.world.collidesWithAnyBlock(axisalignedbb3)) {
  return null;

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

@Overwrite
protected void updateSize() {
  float width, height;
  if (this.isElytraFlying()) {
    width = 0.6F;
    height = 0.6F;
  } else if (this.isPlayerSleeping()) {
    width = 0.2F;
    height = 0.2F;
  } else if (playerState.isCrouching) {
    width = 0.6F;
    height = 1.65F;
  } else if (playerState.isCrawling) {
    width = 0.6F;
    height = 0.65F;
  } else {
    width = 0.6F;
    height = 1.8F;
  }
  if (width != this.width || height != this.height) {
    AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
    axisalignedbb = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ,
        axisalignedbb.minX + (double) width, axisalignedbb.minY + (double) height, axisalignedbb.minZ + (double) width);
    if (width <= this.width && height <= this.height)
      this.setSize(width, height);
    else if (!this.world.collidesWithAnyBlock(axisalignedbb))
      this.setSize(width, height);
  }
  net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick((EntityPlayer) ((Object) this));
}

代码示例来源:origin: TeamLapen/Vampirism

entity.setPosition(entity.posX, entity.posY, entity.posZ);
if (entity.getEntityWorld().collidesWithAnyBlock(entity.getEntityBoundingBox()) && !entity.getEntityWorld().containsAnyLiquid(entity.getEntityBoundingBox()))
  flag = true;

代码示例来源:origin: Alex-the-666/Ice_and_Fire

double d2 = z - (double) blockpos.getZ();
if (!this.world.collidesWithAnyBlock(this.getEntityBoundingBox())) {
  return false;
} else {

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

if (path != null) {
  AxisAlignedBB detectionBox = this.getEntityBoundingBox().expand(0.5, 0.5, 0.5);
  if (this.world.collidesWithAnyBlock(detectionBox)) {
    List<AxisAlignedBB> colliding = this.world.getCollisionBoxes(this.getAttackingEntity(), detectionBox);
    boolean swimUp = false;

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

this.approachSide = direction;
AxisAlignedBB bounds = this.getBoundsAtPos(this.targetX, this.targetY, this.targetZ);
if (!this.entity.world.collidesWithAnyBlock(bounds)) {
  this.path = this.entity.getNavigator().getPathToXYZ(this.targetX, this.targetY, this.targetZ);
  if (this.path != null) {

相关文章

微信公众号

最新文章

更多

World类方法