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

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

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

World.getCollisionBoxes介绍

暂无

代码示例

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

  1. @Nonnull
  2. @Override
  3. public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  4. ItemStack stack = player.getHeldItem(hand);
  5. BlockPos coords = world.getSpawnPoint();
  6. if(MathHelper.pointDistanceSpace(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, player.posX, player.posY, player.posZ) > 24) {
  7. player.rotationPitch = 0F;
  8. player.rotationYaw = 0F;
  9. player.setPositionAndUpdate(coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5);
  10. while(!world.getCollisionBoxes(player, player.getEntityBoundingBox()).isEmpty())
  11. player.setPositionAndUpdate(player.posX, player.posY + 1, player.posZ);
  12. world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F);
  13. for(int i = 0; i < 50; i++)
  14. 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);
  15. stack.shrink(1);
  16. return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
  17. }
  18. return ActionResult.newResult(EnumActionResult.PASS, stack);
  19. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. private static boolean isClear(@Nonnull World world, @Nonnull Entity entity, double targetX, double targetY, double targetZ) {
  2. double origX = entity.posX, origY = entity.posY, origZ = entity.posZ;
  3. try {
  4. entity.setPosition(targetX, targetY, targetZ);
  5. boolean result = world.checkNoEntityCollision(entity.getEntityBoundingBox(), entity)
  6. && world.getCollisionBoxes(entity, entity.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(entity.getEntityBoundingBox());
  7. return result;
  8. } finally {
  9. entity.setPosition(origX, origY, origZ);
  10. }
  11. }

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

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

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

  1. public static boolean isOnGround(@Nonnull EntityCreature entity) {
  2. List<AxisAlignedBB> collides = entity.getEntityWorld().getCollisionBoxes(entity, entity.getEntityBoundingBox().offset(0, -0.1, 0));
  3. if (collides.isEmpty()) {
  4. return false;
  5. }
  6. BlockPos groundPos = entity.getPosition().down();
  7. IBlockState bs = entity.getEntityWorld().getBlockState(groundPos);
  8. if (bs.getMaterial().isLiquid()) {
  9. return false;
  10. }
  11. return true;
  12. }

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

  1. public boolean getCanSpawnHere(boolean ignoreEntityCollision, boolean ignoreLight, boolean ignoreDimension) {
  2. if (!ignoreDimension) {
  3. if (EntityRogueAndroid.dimensionWhitelist.size() > 0) {
  4. return EntityRogueAndroid.dimensionWhitelist.contains(world.provider.getDimension()) && inDimensionBlacklist();
  5. }
  6. if (inDimensionBlacklist()) {
  7. return false;
  8. }
  9. }
  10. boolean light = ignoreLight || isValidLightLevel();
  11. boolean entityCollison = ignoreEntityCollision || this.world.checkNoEntityCollision(this.getEntityBoundingBox());
  12. return this.world.getDifficulty() != EnumDifficulty.PEACEFUL && light && entityCollison && this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.world.containsAnyLiquid(this.getEntityBoundingBox());
  13. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章

World类方法