public TickTaskFillSquare(WorldServer world) {
    this.isComplete = false;
    this.world = world;
    this.X =
        this.minX =
            ModuleWorldBorder.borderData.getInteger("minX") - ModuleWorldBorder.overGenerate;
    this.Z =
        this.minZ =
            ModuleWorldBorder.borderData.getInteger("minZ") - ModuleWorldBorder.overGenerate;
    this.maxX = ModuleWorldBorder.borderData.getInteger("maxX") + ModuleWorldBorder.overGenerate;
    this.maxZ = ModuleWorldBorder.borderData.getInteger("maxZ") + ModuleWorldBorder.overGenerate;
    this.centerX = ModuleWorldBorder.borderData.getInteger("centerX");
    this.centerZ = ModuleWorldBorder.borderData.getInteger("centerZ");
    this.rad = ModuleWorldBorder.borderData.getInteger("rad");

    this.eta =
        (int)
            (((MathHelper.abs_int((this.maxX - this.minX) / 16)
                * MathHelper.abs_int((this.minZ - this.maxZ) / 16))));

    warnEveryone(Localization.get(Localization.WB_FILL_START));
    warnEveryone(FEChatFormatCodes.AQUA + "minX:" + this.minX + "  maxX:" + this.maxX);
    warnEveryone(FEChatFormatCodes.AQUA + "minZ:" + this.minZ + "  maxZ:" + this.maxZ);

    warnEveryone(Localization.get(Localization.WB_FILL_ETA).replaceAll("%eta", getETA()));
  }
  public TickTaskFillRound(boolean canNotSaveBefore, WorldServer world) {
    super(canNotSaveBefore, world);
    this.isComplete = false;
    this.canNotSaveBefore = canNotSaveBefore;
    this.world = world;
    this.X =
        this.minX =
            ModuleWorldBorder.borderData.getInteger("minX") - ModuleWorldBorder.overGenerate;
    this.Z =
        this.minZ =
            ModuleWorldBorder.borderData.getInteger("minZ") - ModuleWorldBorder.overGenerate;
    this.maxX = ModuleWorldBorder.borderData.getInteger("maxX") + ModuleWorldBorder.overGenerate;
    this.maxZ = ModuleWorldBorder.borderData.getInteger("maxZ") + ModuleWorldBorder.overGenerate;
    this.centerX = ModuleWorldBorder.borderData.getInteger("centerX");
    this.centerZ = ModuleWorldBorder.borderData.getInteger("centerZ");
    this.rad = ModuleWorldBorder.borderData.getInteger("rad");

    this.eta =
        (int)
            ((MathHelper.abs_int((this.maxX - this.minX) / 16)
                * MathHelper.abs_int((this.minZ - this.maxZ) / 16)));

    warnEveryone(Localization.get(Localization.WB_FILL_START));
    warnEveryone(Localization.get(Localization.WB_FILL_ETA).replaceAll("%eta", getETA()));
  }
Example #3
0
  @Override
  public boolean generate(World world, Random rand, int xStart, int yStart, int zStart) {

    while (world.isAirBlock(xStart, yStart, zStart) && yStart > 2) {
      --yStart;
    }

    if (!canGenerateInBlock(world, xStart, yStart, zStart, genBlock)) {
      return false;
    }

    yStart += rand.nextInt(4);
    int height = rand.nextInt(4) + 7, originalHeight = height;
    int size = height / 4 + rand.nextInt(2);

    if (largeSpikes && size > 1 && rand.nextInt(60) == 0) {
      height += 10 + rand.nextInt(30);
    }

    int offsetHeight = height - originalHeight;

    for (int y = 0; y < height; ++y) {
      float layerSize;
      if (y > offsetHeight)
        layerSize = (1.0F - (float) (y - offsetHeight) / (float) originalHeight) * size;
      else layerSize = 1;
      int width = MathHelper.ceiling_float_int(layerSize);

      for (int x = -width; x <= width; ++x) {
        float xDist = MathHelper.abs_int(x) - 0.25F;

        for (int z = -width; z <= width; ++z) {
          float zDist = MathHelper.abs_int(z) - 0.25F;

          if ((x == 0 && z == 0 || xDist * xDist + zDist * zDist <= layerSize * layerSize)
              && (x != -width && x != width && z != -width && z != width
                  || rand.nextFloat() <= 0.75F)) {

            generateBlock(world, xStart + x, yStart + y, zStart + z, genBlock, cluster);

            if (y != 0 && width > 1)
              generateBlock(
                  world, xStart + x, yStart - y + offsetHeight, zStart + z, genBlock, cluster);
          }
        }
      }
    }

    return true;
  }
  @Override
  public void generateFloor(World world, Random random, int x, int y, int z) {
    int height =
        2 * MathHelper.abs_int((MathHelper.abs_int(x / 2 + z) % 10) - 5) + (random.nextInt(3) - 6);

    if (height < -1) {
      if (gen.IsBlockSurrounded(world, x, y, z)) {
        gen.setFluid(world, x, y, z, Blocks.water);
      }
    } else {
      if (shouldGenFloorAddon(random)) {
        gen.genStalagmite(world, x, y, z, depth);
      } else if (random.nextInt(5) > 3) {
        gen.replaceBlock(world, x, y, z, Blocks.dirt, 0);
      }
    }
  }
Example #5
0
  private RenderOverlay getNeighborRenderOverlay(
      final BlockPos posEye, final BlockPos posChunk, final EnumFacing side) {
    final BlockPos offset = posChunk.offset(side, 16);
    if (MathHelper.abs_int(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) {
      return null;
    }

    if (offset.getY() < 0 || offset.getY() >= 256) {
      return null;
    }

    if (MathHelper.abs_int(posEye.getZ() - offset.getZ()) > this.renderDistanceChunks * 16) {
      return null;
    }

    return this.viewFrustum.getRenderOverlay(offset);
  }
Example #6
0
 private ModelRotation(int p_i46087_3_, int p_i46087_4_) {
   this.combinedXY = combineXY(p_i46087_3_, p_i46087_4_);
   this.matrix4d = new Matrix4f();
   Matrix4f matrix4f = new Matrix4f();
   matrix4f.setIdentity();
   Matrix4f.rotate(
       (float) (-p_i46087_3_) * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f);
   this.quartersX = MathHelper.abs_int(p_i46087_3_ / 90);
   Matrix4f matrix4f1 = new Matrix4f();
   matrix4f1.setIdentity();
   Matrix4f.rotate(
       (float) (-p_i46087_4_) * 0.017453292F,
       new Vector3f(0.0F, 1.0F, 0.0F),
       matrix4f1,
       matrix4f1);
   this.quartersY = MathHelper.abs_int(p_i46087_4_ / 90);
   Matrix4f.mul(matrix4f1, matrix4f, this.matrix4d);
 }
  /** Find all players in a specified range and narrowing down by other parameters */
  public List findPlayers(
      ChunkCoordinates par1ChunkCoordinates,
      int par2,
      int par3,
      int par4,
      int par5,
      int par6,
      int par7) {
    if (this.playerEntityList.isEmpty()) {
      return null;
    } else {
      Object var8 = new ArrayList();
      boolean var9 = par4 < 0;
      int var10 = par2 * par2;
      int var11 = par3 * par3;
      par4 = MathHelper.abs_int(par4);

      for (int var12 = 0; var12 < this.playerEntityList.size(); ++var12) {
        EntityPlayerMP var13 = (EntityPlayerMP) this.playerEntityList.get(var12);

        if (par1ChunkCoordinates != null && (par2 > 0 || par3 > 0)) {
          float var14 =
              par1ChunkCoordinates.getDistanceSquaredToChunkCoordinates(
                  var13.getPlayerCoordinates());

          if (par2 > 0 && var14 < (float) var10 || par3 > 0 && var14 > (float) var11) {
            continue;
          }
        }

        if ((par5 == EnumGameType.NOT_SET.getID()
                || par5 == var13.theItemInWorldManager.getGameType().getID())
            && (par6 <= 0 || var13.experienceLevel >= par6)
            && var13.experienceLevel <= par7) {
          ((List) var8).add(var13);
        }
      }

      if (par1ChunkCoordinates != null) {
        Collections.sort((List) var8, new PlayerPositionComparator(par1ChunkCoordinates));
      }

      if (var9) {
        Collections.reverse((List) var8);
      }

      if (par4 > 0) {
        var8 = ((List) var8).subList(0, Math.min(par4, ((List) var8).size()));
      }

      return (List) var8;
    }
  }