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

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

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

World.collidesWithAnyBlock介绍

暂无

代码示例

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

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

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

  1. @Override
  2. public boolean collidesWithAnyBlock(AxisAlignedBB bbox) {
  3. return getActualWorld().collidesWithAnyBlock(bbox);
  4. }

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

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

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

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

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

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

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

  1. @Override
  2. public boolean shouldContinueExecuting() {
  3. if (this.path == null || (this.world.collidesWithAnyBlock(this.entity.getEntityBoundingBox()) && !this.isBlockLeaves(this.entity.getPosition()))) {
  4. return false;
  5. }
  6. if (!this.reachedTarget) {
  7. if (!this.path.isFinished() && !this.path.isSamePath(this.entity.getNavigator().getPath())) {
  8. return false;
  9. }
  10. }
  11. return this.active && !this.gliding;
  12. }

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

  1. @Override
  2. protected void setSize(float width, float height) {
  3. if (width != this.width || height != this.height) {
  4. float prevWidth = this.width;
  5. this.width = width;
  6. this.height = height;
  7. if (!this.deserializing) {
  8. AxisAlignedBB bounds = this.getEntityBoundingBox();
  9. AxisAlignedBB newBounds = new AxisAlignedBB(bounds.minX, bounds.minY, bounds.minZ, bounds.minX + this.width, bounds.minY + this.height, bounds.minZ + this.width);
  10. if (!this.world.collidesWithAnyBlock(newBounds)) {
  11. this.setEntityBoundingBox(newBounds);
  12. if (this.width > prevWidth && !this.firstUpdate && !this.world.isRemote) {
  13. this.move(MoverType.SELF, prevWidth - this.width, 0.0F, prevWidth - this.width);
  14. }
  15. }
  16. } else {
  17. float halfWidth = this.width / 2.0F;
  18. this.setEntityBoundingBox(new AxisAlignedBB(this.posX - halfWidth, this.posY, this.posZ - halfWidth, this.posX + halfWidth, this.posY + this.height, this.posZ + halfWidth));
  19. }
  20. }
  21. }

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

  1. /**
  2. * Set the player's entity size to the bat size if it isn't already
  3. *
  4. * @param player
  5. */
  6. public static void updatePlayerBatSize(EntityPlayer player) {
  7. float width = BAT_WIDTH;
  8. float height = BAT_HEIGHT;
  9. if (player.isSneaking()) {
  10. height = BAT_HEIGHT - 0.15F;
  11. }
  12. if (player.isPlayerSleeping()) {
  13. height = 0.2F;
  14. width = 0.2F;
  15. }
  16. if (player.width != width || player.height != height) {
  17. AxisAlignedBB axisalignedbb = player.getEntityBoundingBox();
  18. axisalignedbb = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + (double) width, axisalignedbb.minY + (double) height, axisalignedbb.minZ + (double) width);
  19. if (!player.getEntityWorld().collidesWithAnyBlock(axisalignedbb)) {
  20. if (!VampirePlayer.get(player).setEntitySize(width, height)) return;
  21. }
  22. }
  23. }

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

  1. AxisAlignedBB boundsAtGroundPoint = boundsAtPoint.expand(0.0, pointBlockBounds.maxY - 0.002, 0.0);
  2. if (this.entity.world.collidesWithAnyBlock(boundsAtGroundPoint)) {
  3. point = null;
  4. 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);
  5. if (this.entity.world.collidesWithAnyBlock(boundsAtPoint)) {
  6. return null;

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

  1. AxisAlignedBB axisalignedbb2 = axisalignedbb.expand(0.0D, axisalignedbb1.maxY - 0.002D, 0.0D);
  2. if (this.entity.world.collidesWithAnyBlock(axisalignedbb2)) {
  3. pathpoint = null;
  4. 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);
  5. if (this.entity.world.collidesWithAnyBlock(axisalignedbb3)) {
  6. return null;

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

  1. AxisAlignedBB axisalignedbb2 = axisalignedbb.expand(0.0D, axisalignedbb1.maxY - 0.002D, 0.0D);
  2. if (this.entity.world.collidesWithAnyBlock(axisalignedbb2)) {
  3. pathpoint = null;
  4. 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);
  5. if (this.entity.world.collidesWithAnyBlock(axisalignedbb3)) {
  6. return null;

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

  1. @Overwrite
  2. protected void updateSize() {
  3. float width, height;
  4. if (this.isElytraFlying()) {
  5. width = 0.6F;
  6. height = 0.6F;
  7. } else if (this.isPlayerSleeping()) {
  8. width = 0.2F;
  9. height = 0.2F;
  10. } else if (playerState.isCrouching) {
  11. width = 0.6F;
  12. height = 1.65F;
  13. } else if (playerState.isCrawling) {
  14. width = 0.6F;
  15. height = 0.65F;
  16. } else {
  17. width = 0.6F;
  18. height = 1.8F;
  19. }
  20. if (width != this.width || height != this.height) {
  21. AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
  22. axisalignedbb = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ,
  23. axisalignedbb.minX + (double) width, axisalignedbb.minY + (double) height, axisalignedbb.minZ + (double) width);
  24. if (width <= this.width && height <= this.height)
  25. this.setSize(width, height);
  26. else if (!this.world.collidesWithAnyBlock(axisalignedbb))
  27. this.setSize(width, height);
  28. }
  29. net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick((EntityPlayer) ((Object) this));
  30. }

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

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

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

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

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

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

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

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

相关文章

World类方法