@Override
  public IEntityLivingData onInitialSpawn(DifficultyInstance ins, IEntityLivingData data) {
    if (!this.worldObj.isRemote) {
      if (TragicConfig.getBoolean("overlordClearSpace")) {
        List<BlockPos> lst =
            WorldHelper.getBlocksInSphericalRange(
                this.worldObj, 10.5, this.posX, this.posY + 1, this.posZ);

        for (BlockPos coord : lst) {
          if (this.posY > coord.getY() + 1
              && this.worldObj
                      .getBlockState(coord)
                      .getBlock()
                      .getBlockHardness(this.worldObj, coord)
                  > 0F) this.worldObj.setBlockToAir(coord);
        }

        lst =
            WorldHelper.getBlocksInSphericalRange(
                this.worldObj, 10.0, this.posX, this.posY - 1, this.posZ);

        for (BlockPos coords : lst) {
          if (this.posY >= coords.getY() + 1
              && (!EntityOverlordCore.ignoredBlocks.contains(
                          this.worldObj.getBlockState(coords).getBlock())
                      && this.worldObj
                              .getBlockState(coords)
                              .getBlock()
                              .getBlockHardness(this.worldObj, coords)
                          > 0F
                  || this.worldObj.getBlockState(coords).getBlock() == Blocks.air))
            this.worldObj.setBlockState(
                coords,
                !TragicConfig.getBoolean("allowNonMobBlocks")
                    ? Blocks.obsidian.getDefaultState()
                    : TragicBlocks.CelledBlock.getDefaultState());
        }
      }
      this.spawnSeekers();
      List<EntitySeeker> list =
          this.worldObj.getEntitiesWithinAABB(
              EntitySeeker.class, this.getEntityBoundingBox().expand(32.0, 32.0, 32.0));

      for (EntitySeeker sk : list) {
        if (sk.getOwner() == null) {
          sk.setOwner(this);
          this.seekers.add(sk);
        } else if (sk.getOwner() == this && !this.seekers.contains(sk)) {
          this.seekers.add(sk);
        }
      }
    }
    return super.onInitialSpawn(ins, data);
  }
  @Override
  public void useDoomsday(
      DoomsdayEffect effect, PropertyDoom doom, EntityPlayer player, boolean crucMoment) {

    double radius = crucMoment ? 8.0D : 4.0D;
    List list =
        WorldHelper.getBlocksInSphericalRange(
            player.worldObj, radius, player.posX, player.posY, player.posZ);
    List list2 =
        player.worldObj.getEntitiesWithinAABBExcludingEntity(
            player, player.boundingBox.expand(radius, radius, radius));

    Block block;
    int[] coords;

    for (int i = 0; i < list2.size(); i++) {
      if (list2.get(i) instanceof EntityMob)
        ((EntityLivingBase) list2.get(i))
            .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 120, 1));
    }

    for (int i = 0; i < list.size(); i++) {
      coords = (int[]) list.get(i);
      block = player.worldObj.getBlock(coords[0], coords[1], coords[2]);

      if (block == Blocks.lava) {
        player.worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.obsidian);
      } else if (block == Blocks.water) {
        player.worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.ice);
      } else if (block == Blocks.ice) {
        player.worldObj.setBlock(coords[0], coords[1], coords[2], Blocks.packed_ice);
      } else if (block instanceof BlockBush || block instanceof BlockLeaves) {
        player.worldObj.setBlockToAir(coords[0], coords[1], coords[2]);
      } else if (block == Blocks.air
          && World.doesBlockHaveSolidTopSurface(
              player.worldObj, coords[0], coords[1] - 1, coords[2])
          && rand.nextBoolean()) {
        player.worldObj.setBlock(
            coords[0], coords[1], coords[2], Blocks.snow_layer, rand.nextInt(8), 2);
      }
    }

    if (crucMoment) addCrucialMessage(player);
  }
  @Override
  public ItemStack onItemRightClick(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    PropertyDoom doom = PropertyDoom.get(par3EntityPlayer);

    Vec3 vec = WorldHelper.getVecFromEntity(par3EntityPlayer);
    if (vec == null) return par1ItemStack;

    if (doom != null && !par2World.isRemote && getStackCooldown(par1ItemStack) == 0) {
      double d4 = vec.xCoord - par3EntityPlayer.posX;
      double d5 = vec.yCoord - (par3EntityPlayer.posY + par3EntityPlayer.height / 2.0F);
      double d6 = vec.zCoord - par3EntityPlayer.posZ;

      if (!par3EntityPlayer.isSneaking()) {
        if (canUseAbility(doom, TragicConfig.doomAbilityCost[35]) && TragicConfig.doomAbility[35]) {
          if (!par3EntityPlayer.capabilities.isCreativeMode)
            doom.increaseDoom(-TragicConfig.doomAbilityCost[35]);
          setStackCooldown(par1ItemStack, 5);

          EntityWitherSkull skull = new EntityWitherSkull(par2World, par3EntityPlayer, d4, d5, d6);
          skull.posY += par3EntityPlayer.getEyeHeight();
          par2World.spawnEntityInWorld(skull);
          return par1ItemStack;
        }
      } else {
        if (canUseAbility(doom, TragicConfig.doomAbilityCost[36]) && TragicConfig.doomAbility[36]) {
          if (!par3EntityPlayer.capabilities.isCreativeMode)
            doom.increaseDoom(-TragicConfig.doomAbilityCost[36]);
          setStackCooldown(par1ItemStack, 5);

          EntityWitherSkull skull = new EntityWitherSkull(par2World, par3EntityPlayer, d4, d5, d6);
          skull.posY += par3EntityPlayer.getEyeHeight();
          skull.setInvulnerable(true);
          par2World.spawnEntityInWorld(skull);
          return par1ItemStack;
        }
      }
    }

    return par1ItemStack;
  }
  @Override
  public void onLivingUpdate() {
    this.rotationYaw = this.rotationPitch = this.prevRotationPitch = this.prevRotationYaw = 0;
    this.motionX = this.motionZ = 0D;
    this.motionY = -1D;
    super.onLivingUpdate();

    if (this.worldObj.isRemote) return;

    EntitySeeker seek;
    for (int i = 0; i < this.seekers.size(); i++) {
      seek = this.seekers.get(i);
      if (seek.isDead || seek.getHealth() <= 0 || this.getDistanceToEntity(seek) >= 32.0)
        this.seekers.remove(seek);
    }

    List<EntitySeeker> lst =
        this.worldObj.getEntitiesWithinAABB(
            EntitySeeker.class, this.getEntityBoundingBox().expand(32.0, 32.0, 32.0));

    for (EntitySeeker sk : lst) {
      if (sk.getOwner() == null) {
        sk.setOwner(this);
        this.seekers.add(sk);
      } else if (sk.getOwner() == this && !this.seekers.contains(sk)) {
        this.seekers.add(sk);
      }
    }

    if (this.seekers.isEmpty()
        && this.ticksExisted % 100 == 0
        && !TragicConfig.getBoolean("overlordPhases")) this.spawnSeekers();

    if (this.seekers.isEmpty()
        && this.getPhaseTicks() == 0
        && this.deathTime == 0
        && TragicConfig.getBoolean("overlordPhases")) this.setPhaseTicks(200);

    if (this.getPhaseTicks() > 0 && TragicConfig.getBoolean("overlordPhases")) {
      this.setPhaseTicks(this.getPhaseTicks() - 1);

      if (TragicConfig.getBoolean("overlordGas")) {
        List<BlockPos> lst2 =
            WorldHelper.getBlocksInSphericalRange(
                this.worldObj,
                3.5,
                this.posX + rand.nextInt(4) - rand.nextInt(4),
                this.posY,
                this.posZ + rand.nextInt(4) - rand.nextInt(4));
        for (BlockPos coords : lst2) {
          if (World.doesBlockHaveSolidTopSurface(this.worldObj, coords.down())
              && EntityOverlordCore.replaceableBlocks.contains(
                  this.worldObj.getBlockState(coords).getBlock())) {
            this.worldObj.setBlockState(coords, TragicBlocks.CorruptedGas.getDefaultState());
          }
        }
      }

      if (this.phaseChange) {
        this.phaseChange = false;
        this.setPhaseTicks(0);
        for (EntitySeeker sk : this.seekers) sk.setDead();
        this.spawnSeekers();
        this.phaseDamage = 0F;

        if (this.getHealth() > 0F) {
          float f = this.getMaxHealth() / 5;
          switch (this.getCurrentPhase()) {
            case 0:
              f *= 4;
              break;
            case 1:
              f *= 3;
              break;
            case 2:
              f *= 2;
              break;
            case 3:
              break;
            case 4:
              f = 0;
              break;
            default:
              break;
          }
          this.setHealth(f);
        }

        if (TragicConfig.getBoolean("allowDivinity")) {
          List<Entity> list =
              this.worldObj.getEntitiesWithinAABBExcludingEntity(
                  this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
          for (Entity e : list) {
            if (e instanceof EntityLivingBase
                && ((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
              ((EntityLivingBase) e).removePotionEffect(TragicPotion.Divinity.id);
          }
        }
        if (TragicConfig.getBoolean("allowMobSounds"))
          this.worldObj.playSoundAtEntity(
              this, "tragicmc:boss.overlordcocoon.phasecomplete", 1.8F, 1.0F);
      } else {
        if (this.getPhaseTicks() == 199) {
          if (TragicConfig.getBoolean("allowDivinity")) {
            List<Entity> list =
                this.worldObj.getEntitiesWithinAABBExcludingEntity(
                    this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
            for (Entity e : list) {
              if (e instanceof EntityLivingBase
                  && !((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
                ((EntityLivingBase) e)
                    .addPotionEffect(new PotionEffect(TragicPotion.Divinity.id, 200));
            }
          }
        }

        if (this.getPhaseTicks() == 0) {
          if (this.getHealth() > 0F) {
            float f = this.getMaxHealth() / 5;
            switch (this.getCurrentPhase()) {
              case 0:
                f *= 5;
                break;
              case 1:
                f *= 4;
                break;
              case 2:
                f *= 3;
                break;
              case 3:
                f *= 2;
                break;
              case 4:
              default:
                break;
            }
            this.setHealth(f);
          }
          this.phaseDamage = 0F;

          for (EntitySeeker sk : this.seekers) sk.setDead();
          this.spawnSeekers();

          if (TragicConfig.getBoolean("allowDivinity")) {
            List<Entity> list =
                this.worldObj.getEntitiesWithinAABBExcludingEntity(
                    this, this.getEntityBoundingBox().expand(64.0, 64.0, 64.0));
            for (Entity e : list) {
              if (e instanceof EntityLivingBase
                  && ((EntityLivingBase) e).isPotionActive(TragicPotion.Divinity))
                ((EntityLivingBase) e).removePotionEffect(TragicPotion.Divinity.id);
            }
          }

          if (TragicConfig.getBoolean("allowMobSounds"))
            this.worldObj.playSoundAtEntity(
                this, "tragicmc:boss.overlordcocoon.phasefail", 1.8F, 1.0F);
        }

        if (TragicConfig.getBoolean("allowMobSounds") && this.getPhaseTicks() % 10 == 0)
          this.worldObj.playSoundAtEntity(this, "tragicmc:boss.overlordcocoon.wah", 1.4F, 1.0F);
      }
    }
  }
  @Override
  public boolean generateStructure(int variant, World world, Random rand, int x, int y, int z) {
    ArrayList<int[]> list;
    byte relays = (byte) (6 + (rand.nextInt(variant + 1) + 1) * (rand.nextInt(variant + 1) + 1));
    Block block;
    double regression = 0.88977745D;
    double cutoff = 0.48943755D;
    double size;
    ArrayList<int[]> cands = new ArrayList<int[]>();
    int yMax;
    int Xcoord;
    int Zcoord;
    int Ycoord;

    for (byte buzza = 0; buzza < relays; buzza++) {
      if (buzza == 0) {
        size = 15.0D;
        Xcoord = x + 4;
        Zcoord = z + 4;
        Ycoord = y;
        cutoff = 0.6278D;
        regression = 0.8876D;
      } else {
        size = rand.nextDouble() * 5.5D + 4.5D;
        Xcoord = x + 4 + rand.nextInt(10) - rand.nextInt(10);
        Zcoord = z + 4 + rand.nextInt(10) - rand.nextInt(10);
        Ycoord = y - rand.nextInt(2);
        regression = 0.88977745D;
        cutoff = 0.68943755D;
      }
      yMax = Ycoord;

      for (byte y1 = 0; y1 > -32; y1--) {
        if (size < cutoff) break;
        size *= regression;

        if (rand.nextInt(12) == 0) {
          Xcoord += rand.nextInt(2) - rand.nextInt(2);
          Zcoord += rand.nextInt(2) - rand.nextInt(2);
        }

        list = WorldHelper.getBlocksInCircularRange(world, size, Xcoord, Ycoord + y1, Zcoord);

        for (int[] coords2 : list) {
          block = world.getBlock(coords2[0], coords2[1], coords2[2]);
          if (Structure.validBlocks.contains(block) && !cands.contains(coords2)) {
            if (yMax < coords2[1]) yMax = coords2[1];
            cands.add(coords2);
          }
        }
      }

      byte rnd = (byte) (rand.nextInt(3) + 1);

      for (int[] coords2 : cands) {
        if (coords2[1] >= yMax) {
          world.setBlock(coords2[0], coords2[1], coords2[2], TragicBlocks.AshenGrass, 0, 2);
        } else if (coords2[1] >= yMax - rnd - rand.nextInt(2)) {
          world.setBlock(coords2[0], coords2[1], coords2[2], TragicBlocks.DeadDirt, 0, 2);
        } else {
          world.setBlock(coords2[0], coords2[1], coords2[2], TragicBlocks.DarkStone, 0, 2);
        }
      }
    }

    for (byte y1 = 0; y1 < 10; y1++) {
      for (byte x1 = -8; x1 < 17; x1++) {
        for (byte z1 = -6; z1 < 15; z1++) {
          world.setBlockToAir(x + x1, y + y1 + 1, z + z1);
        }
      }
    }
    // First layer

    // Top row

    for (int i = 2; i < 8; i++) {
      world.setBlock(x - 7, y, z + i, quartz, 0, 2);
    }

    // Second row
    for (int i = 1; i < 9; i++) {
      world.setBlock(x - 6, y, z + i, quartz, 0, 2);
    }

    // Third row
    for (int i = -1; i < 11; i++) {
      world.setBlock(x - 5, y, z + i, quartz, 0, 2);
    }

    // Fourth row
    for (int i = -2; i < 12; i++) {
      world.setBlock(x - 4, y, z + i, quartz, 0, 2);
    }

    // Fifth row
    for (int i = -2; i < 12; i++) {
      world.setBlock(x - 3, y, z + i, quartz, 0, 2);
    }

    // Sixth row
    for (int i = -3; i < 13; i++) {
      world.setBlock(x - 2, y, z + i, quartz, 0, 2);
    }

    // Seventh row
    for (int i = -4; i < 14; i++) {
      world.setBlock(x - 1, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x - 1, y, z, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 9, quartz, 1, 2);

    // Eighth row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x, y, z + 4, obs, 0, 2);
    world.setBlock(x, y, z + 5, obs, 0, 2);

    // Ninth row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 1, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 1, y, z, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 3, obs, 0, 2);
    world.setBlock(x + 1, y, z + 4, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 5, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 6, obs, 0, 2);
    world.setBlock(x + 1, y, z + 9, quartz, 1, 2);

    // Tenth row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 2, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 2, y, z, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 2, obs, 0, 2);
    world.setBlock(x + 2, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 4, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 5, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 7, obs, 0, 2);
    world.setBlock(x + 2, y, z + 9, quartz, 1, 2);

    // Eleventh row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 3, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 3, y, z, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 2, obs, 0, 2);
    world.setBlock(x + 3, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 4, obs, 0, 2);
    world.setBlock(x + 3, y, z + 5, obs, 0, 2);
    world.setBlock(x + 3, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 7, obs, 0, 2);
    world.setBlock(x + 3, y, z + 9, quartz, 1, 2);

    // Twelfth row - This is the middle row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 4, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 4, y, z + 1, obs, 0, 2);
    world.setBlock(x + 4, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 4, y, z + 3, glow, 0, 2);
    world.setBlock(x + 4, y, z + 4, chest, 0, 2);
    world.setBlock(x + 4, y, z + 5, chest, 0, 2);
    world.setBlock(x + 4, y, z + 6, glow, 0, 2);
    world.setBlock(x + 4, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 4, y, z + 8, obs, 0, 2);

    // Thirteenth row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 5, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 5, y, z, quartz, 1, 2);
    world.setBlock(x + 5, y, z + 2, obs, 0, 2);
    world.setBlock(x + 5, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 5, y, z + 4, obs, 0, 2);
    world.setBlock(x + 5, y, z + 5, obs, 0, 2);
    world.setBlock(x + 5, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 5, y, z + 7, obs, 0, 2);
    world.setBlock(x + 5, y, z + 9, quartz, 1, 2);

    // Fourteenth row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 6, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 6, y, z, quartz, 1, 2);
    world.setBlock(x + 6, y, z + 2, obs, 0, 2);
    world.setBlock(x + 6, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 6, y, z + 4, quartz, 1, 2);
    world.setBlock(x + 6, y, z + 5, quartz, 1, 2);
    world.setBlock(x + 6, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 6, y, z + 7, obs, 0, 2);
    world.setBlock(x + 6, y, z + 9, quartz, 1, 2);

    // Fifteenth row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 7, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 7, y, z, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 3, obs, 0, 2);
    world.setBlock(x + 7, y, z + 4, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 5, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 6, obs, 0, 2);
    world.setBlock(x + 7, y, z + 9, quartz, 1, 2);

    // Sixteenth row
    for (int i = -5; i < 15; i++) {
      world.setBlock(x + 8, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 8, y, z + 4, obs, 0, 2);
    world.setBlock(x + 8, y, z + 5, obs, 0, 2);

    // Seventeenth row
    for (int i = -4; i < 14; i++) {
      world.setBlock(x + 9, y, z + i, quartz, 0, 2);
    }

    world.setBlock(x + 9, y, z, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 9, quartz, 1, 2);

    // Eighteenth row
    for (int i = -3; i < 13; i++) {
      world.setBlock(x + 10, y, z + i, quartz, 0, 2);
    }

    // Nineteenth row
    for (int i = -2; i < 12; i++) {
      world.setBlock(x + 11, y, z + i, quartz, 0, 2);
    }

    // Twentieth row
    for (int i = -2; i < 12; i++) {
      world.setBlock(x + 12, y, z + i, quartz, 0, 2);
    }

    // Twenty-first row
    for (int i = -1; i < 11; i++) {
      world.setBlock(x + 13, y, z + i, quartz, 0, 2);
    }

    // Twenty-second row
    for (int i = 1; i < 9; i++) {
      world.setBlock(x + 14, y, z + i, quartz, 0, 2);
    }

    // Twenty-third row
    for (int i = 2; i < 8; i++) {
      world.setBlock(x + 15, y, z + i, quartz, 0, 2);
    }

    if (!world.isRemote) {
      // First layer chest gen
      this.applyChestContents(world, rand, x + 4, y, z + 4, TragicItems.BossStructureHook);
      this.applyChestContents(world, rand, x + 4, y, z + 5, TragicItems.BossStructureHook);
    }
    y++;
    // Second layer
    x -= 1;

    // First row
    world.setBlock(x - 6, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 6, y, z + 7, quartz, 1, 2);

    // Second row
    world.setBlock(x - 5, y, z + 1, quartz, 1, 2);
    world.setBlock(x - 5, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 5, y, z + 3, quartz, 1, 2);
    world.setBlock(x - 5, y, z + 6, quartz, 1, 2);
    world.setBlock(x - 5, y, z + 7, quartz, 1, 2);
    world.setBlock(x - 5, y, z + 8, quartz, 1, 2);

    // Third row
    world.setBlock(x - 4, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 3, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 6, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 7, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 8, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 9, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 10, quartz, 1, 2);

    // Fourth row
    world.setBlock(x - 3, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 3, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 11, quartz, 1, 2);

    // Fifth row
    world.setBlock(x - 2, y, z - 3, quartz, 1, 2);
    world.setBlock(x - 2, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 2, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 11, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 12, quartz, 1, 2);

    // Sixth row
    world.setBlock(x - 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x - 1, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 1, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 11, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 12, quartz, 1, 2);

    // Seventh row
    world.setBlock(x, y, z - 3, quartz, 1, 2);
    world.setBlock(x, y, z - 2, quartz, 1, 2);
    world.setBlock(x, y, z, quartz, 1, 2);
    world.setBlock(x, y, z + 9, quartz, 1, 2);
    world.setBlock(x, y, z + 11, quartz, 1, 2);
    world.setBlock(x, y, z + 12, quartz, 1, 2);

    // Eighth row
    world.setBlock(x + 1, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 13, quartz, 1, 2);

    // Ninth row
    world.setBlock(x + 2, y, z - 5, quartz, 1, 2);
    world.setBlock(x + 2, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 2, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 13, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 14, quartz, 1, 2);

    // Tenth row
    world.setBlock(x + 3, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 3, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 13, quartz, 1, 2);

    // Eleventh row

    // Twelfth row - middle row
    world.setBlock(x + 5, y, z + 4, obs, 0, 2);
    world.setBlock(x + 5, y, z + 5, obs, 0, 2);

    // Thirteenth row

    // Fourteenth row
    world.setBlock(x + 7, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 7, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 13, quartz, 1, 2);

    // Fifteenth row - 9
    world.setBlock(x + 8, y, z - 5, quartz, 1, 2);
    world.setBlock(x + 8, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 8, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 13, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 14, quartz, 1, 2);

    // Sixteenth row
    world.setBlock(x + 9, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 9, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 13, quartz, 1, 2);

    // Seventeenth row
    world.setBlock(x + 10, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 10, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 10, y, z, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 12, quartz, 1, 2);

    // Eighteenth row - 6
    world.setBlock(x + 11, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 11, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 11, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 12, quartz, 1, 2);

    // Nineteenth row
    world.setBlock(x + 12, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 12, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 12, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 12, quartz, 1, 2);

    // Twentieth row - 4
    world.setBlock(x + 13, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 13, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 11, quartz, 1, 2);

    // Twenty-first row
    world.setBlock(x + 14, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 8, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 10, quartz, 1, 2);

    // Twenty-second row
    world.setBlock(x + 15, y, z + 1, quartz, 1, 2);
    world.setBlock(x + 15, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 15, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 15, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 15, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 15, y, z + 8, quartz, 1, 2);

    // Twenty-third row
    world.setBlock(x + 16, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 16, y, z + 7, quartz, 1, 2);

    y++;

    // Third layer

    // First row

    // Second row
    world.setBlock(x - 5, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 5, y, z + 3, stone, 0, 2);
    world.setBlock(x - 5, y, z + 6, stone, 0, 2);
    world.setBlock(x - 5, y, z + 7, quartz, 1, 2);

    // Third row
    world.setBlock(x - 4, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 3, stone, 0, 2);
    world.setBlock(x - 4, y, z + 6, stone, 0, 2);
    world.setBlock(x - 4, y, z + 7, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 8, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 9, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 10, quartz, 1, 2);

    // Fourth row
    world.setBlock(x - 3, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 3, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 11, quartz, 1, 2);

    // Fifth row
    world.setBlock(x - 2, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 2, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 11, quartz, 1, 2);

    // Sixth row
    world.setBlock(x - 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x - 1, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 1, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 11, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 12, quartz, 1, 2);

    // Seventh row
    world.setBlock(x, y, z - 3, quartz, 1, 2);
    world.setBlock(x, y, z - 2, quartz, 1, 2);
    world.setBlock(x, y, z, quartz, 1, 2);
    world.setBlock(x, y, z + 9, quartz, 1, 2);
    world.setBlock(x, y, z + 11, quartz, 1, 2);
    world.setBlock(x, y, z + 12, quartz, 1, 2);

    // Eighth row
    world.setBlock(x + 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 12, quartz, 1, 2);

    // Ninth row
    world.setBlock(x + 2, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 2, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 13, quartz, 1, 2);

    // Tenth row
    world.setBlock(x + 3, y, z - 4, stone, 0, 2);
    world.setBlock(x + 3, y, z - 3, stone, 0, 2);
    world.setBlock(x + 3, y, z + 12, stone, 0, 2);
    world.setBlock(x + 3, y, z + 13, stone, 0, 2);

    // Eleventh row

    // Twelfth row - middle row

    if (variant == 1) {
      world.setBlock(x + 5, y, z + 4, summon, 5, 2);
      world.setBlockToAir(x + 5, y, z + 5);
    } else if (variant == 2) {
      world.setBlock(x + 5, y, z + 4, summon, 5, 2);
      world.setBlock(x + 5, y, z + 5, summon, 5, 2);
    } else {
      world.setBlockToAir(x + 5, y, z + 4);
      world.setBlock(x + 5, y, z + 5, summon, 5, 2);
    }

    // Thirteenth row

    // Fourteenth row
    world.setBlock(x + 7, y, z - 4, stone, 0, 2);
    world.setBlock(x + 7, y, z - 3, stone, 0, 2);
    world.setBlock(x + 7, y, z + 12, stone, 0, 2);
    world.setBlock(x + 7, y, z + 13, stone, 0, 2);

    // Fifteenth row - 9
    world.setBlock(x + 8, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 8, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 13, quartz, 1, 2);

    // Sixteenth row
    world.setBlock(x + 9, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 12, quartz, 1, 2);

    // Seventeenth row
    world.setBlock(x + 10, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 10, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 10, y, z, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 12, quartz, 1, 2);

    // Eighteenth row - 6
    world.setBlock(x + 11, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 11, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 11, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 12, quartz, 1, 2);

    // Nineteenth row
    world.setBlock(x + 12, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 12, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 11, quartz, 1, 2);

    // Twentieth row - 4
    world.setBlock(x + 13, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 13, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 11, quartz, 1, 2);

    // Twenty-first row
    world.setBlock(x + 14, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 3, stone, 0, 2);
    world.setBlock(x + 14, y, z + 6, stone, 0, 2);
    world.setBlock(x + 14, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 8, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 10, quartz, 1, 2);

    // Twenty-second row
    world.setBlock(x + 15, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 15, y, z + 3, stone, 0, 2);
    world.setBlock(x + 15, y, z + 6, stone, 0, 2);
    world.setBlock(x + 15, y, z + 7, quartz, 1, 2);

    // Twenty-third row

    y++;

    // Fourth layer

    // First row

    // Second row
    world.setBlock(x - 5, y, z + 3, stone, 0, 2);
    world.setBlock(x - 5, y, z + 6, stone, 0, 2);

    // Third row
    world.setBlock(x - 4, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 3, stone, 0, 2);
    world.setBlock(x - 4, y, z + 6, stone, 0, 2);
    world.setBlock(x - 4, y, z + 7, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 8, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 9, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 10, quartz, 1, 2);

    // Fourth row
    world.setBlock(x - 3, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 10, quartz, 1, 2);

    // Fifth row
    world.setBlock(x - 2, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 10, quartz, 1, 2);

    // Sixth row
    world.setBlock(x - 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x - 1, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 1, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 11, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 12, quartz, 1, 2);

    // Seventh row
    world.setBlock(x, y, z - 3, quartz, 1, 2);
    world.setBlock(x, y, z - 2, quartz, 1, 2);
    world.setBlock(x, y, z, quartz, 1, 2);
    world.setBlock(x, y, z + 9, quartz, 1, 2);
    world.setBlock(x, y, z + 11, quartz, 1, 2);
    world.setBlock(x, y, z + 12, quartz, 1, 2);

    // Eighth row
    world.setBlock(x + 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 12, quartz, 1, 2);

    // Ninth row
    world.setBlock(x + 2, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 12, quartz, 1, 2);

    // Tenth row
    world.setBlock(x + 3, y, z - 4, stone, 0, 2);
    world.setBlock(x + 3, y, z - 3, stone, 0, 2);
    world.setBlock(x + 3, y, z + 12, stone, 0, 2);
    world.setBlock(x + 3, y, z + 13, stone, 0, 2);

    // Eleventh row

    // Twelfth row - middle row

    // Thirteenth row

    // Fourteenth row
    world.setBlock(x + 7, y, z - 4, stone, 0, 2);
    world.setBlock(x + 7, y, z - 3, stone, 0, 2);
    world.setBlock(x + 7, y, z + 12, stone, 0, 2);
    world.setBlock(x + 7, y, z + 13, stone, 0, 2);

    // Fifteenth row - 9
    world.setBlock(x + 8, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 12, quartz, 1, 2);

    // Sixteenth row
    world.setBlock(x + 9, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 12, quartz, 1, 2);

    // Seventeenth row
    world.setBlock(x + 10, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 10, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 10, y, z, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 12, quartz, 1, 2);

    // Eighteenth row - 6
    world.setBlock(x + 11, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 11, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 11, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 12, quartz, 1, 2);

    // Nineteenth row
    world.setBlock(x + 12, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 10, quartz, 1, 2);

    // Twentieth row - 4
    world.setBlock(x + 13, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 10, quartz, 1, 2);

    // Twenty-first row
    world.setBlock(x + 14, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 3, stone, 0, 2);
    world.setBlock(x + 14, y, z + 6, stone, 0, 2);
    world.setBlock(x + 14, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 8, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 10, quartz, 1, 2);

    // Twenty-second row
    world.setBlock(x + 15, y, z + 3, stone, 0, 2);
    world.setBlock(x + 15, y, z + 6, stone, 0, 2);

    // Twenty-third row

    y++;

    // Fifth layer

    // First row

    // Second row
    world.setBlock(x - 5, y, z + 3, quartz, 1, 2);
    world.setBlock(x - 5, y, z + 4, stone, 0, 2);
    world.setBlock(x - 5, y, z + 5, stone, 0, 2);
    world.setBlock(x - 5, y, z + 6, quartz, 1, 2);

    // Third row
    world.setBlock(x - 4, y, z, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 3, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 4, stone, 0, 2);
    world.setBlock(x - 4, y, z + 5, stone, 0, 2);
    world.setBlock(x - 4, y, z + 6, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 7, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 8, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 9, quartz, 1, 2);

    // Fourth row
    world.setBlock(x - 3, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 3, y, z, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 9, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 10, quartz, 1, 2);

    // Fifth row
    world.setBlock(x - 2, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 10, quartz, 1, 2);

    // Sixth row
    world.setBlock(x - 1, y, z - 2, quartz, 1, 2);
    world.setBlock(x - 1, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 10, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 11, quartz, 1, 2);

    // Seventh row
    world.setBlock(x, y, z - 3, quartz, 1, 2);
    world.setBlock(x, y, z - 2, quartz, 1, 2);
    world.setBlock(x, y, z, quartz, 1, 2);
    world.setBlock(x, y, z + 9, quartz, 1, 2);
    world.setBlock(x, y, z + 11, quartz, 1, 2);
    world.setBlock(x, y, z + 12, quartz, 1, 2);

    // Eighth row
    world.setBlock(x + 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 12, quartz, 1, 2);

    // Ninth row
    world.setBlock(x + 2, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 12, quartz, 1, 2);

    // Tenth row
    world.setBlock(x + 3, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 3, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 13, quartz, 1, 2);

    // Eleventh row
    world.setBlock(x + 4, y, z - 4, stone, 0, 2);
    world.setBlock(x + 4, y, z - 3, stone, 0, 2);
    world.setBlock(x + 4, y, z + 12, stone, 0, 2);
    world.setBlock(x + 4, y, z + 13, stone, 0, 2);

    // Twelfth row - middle row
    world.setBlock(x + 5, y, z - 4, stone, 0, 2);
    world.setBlock(x + 5, y, z - 3, stone, 0, 2);
    world.setBlock(x + 5, y, z + 12, stone, 0, 2);
    world.setBlock(x + 5, y, z + 13, stone, 0, 2);

    // Thirteenth row
    world.setBlock(x + 6, y, z - 4, stone, 0, 2);
    world.setBlock(x + 6, y, z - 3, stone, 0, 2);
    world.setBlock(x + 6, y, z + 12, stone, 0, 2);
    world.setBlock(x + 6, y, z + 13, stone, 0, 2);

    // Fourteenth row
    world.setBlock(x + 7, y, z - 4, quartz, 1, 2);
    world.setBlock(x + 7, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 12, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 13, quartz, 1, 2);

    // Fifteenth row - 9
    world.setBlock(x + 8, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 12, quartz, 1, 2);

    // Sixteenth row
    world.setBlock(x + 9, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 12, quartz, 1, 2);

    // Seventeenth row
    world.setBlock(x + 10, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 10, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 10, y, z, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 11, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 12, quartz, 1, 2);

    // Eighteenth row - 6
    world.setBlock(x + 11, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 11, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 10, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 11, quartz, 1, 2);

    // Nineteenth row
    world.setBlock(x + 12, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 10, quartz, 1, 2);

    // Twentieth row - 4
    world.setBlock(x + 13, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 13, y, z, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 10, quartz, 1, 2);

    // Twenty-first row
    world.setBlock(x + 14, y, z, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 3, stone, 0, 2);
    world.setBlock(x + 14, y, z + 6, stone, 0, 2);
    world.setBlock(x + 14, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 8, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 9, quartz, 1, 2);

    // Twenty-second row
    world.setBlock(x + 15, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 15, y, z + 4, stone, 0, 2);
    world.setBlock(x + 15, y, z + 5, stone, 0, 2);
    world.setBlock(x + 15, y, z + 6, quartz, 1, 2);

    // Twenty-third row

    y++;

    // Sixth layer

    // Third row
    world.setBlock(x - 4, y, z + 1, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 2, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 3, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 4, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 5, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 6, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 7, quartz, 1, 2);
    world.setBlock(x - 4, y, z + 8, quartz, 1, 2);

    // Fourth row
    world.setBlock(x - 3, y, z, quartz, 1, 2);
    world.setBlock(x - 3, y, z + 9, quartz, 1, 2);

    // Fifth row
    world.setBlock(x - 2, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 2, y, z + 10, quartz, 1, 2);

    // Sixth row
    world.setBlock(x - 1, y, z - 1, quartz, 1, 2);
    world.setBlock(x - 1, y, z + 10, quartz, 1, 2);

    // Seventh row
    world.setBlock(x, y, z - 2, quartz, 1, 2);
    world.setBlock(x, y, z, quartz, 1, 2);
    world.setBlock(x, y, z + 9, quartz, 1, 2);
    world.setBlock(x, y, z + 11, quartz, 1, 2);

    // Eighth row
    world.setBlock(x + 1, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 12, quartz, 1, 2);

    // Ninth row
    world.setBlock(x + 2, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 12, quartz, 1, 2);

    // Tenth row
    world.setBlock(x + 3, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 12, quartz, 1, 2);

    // Eleventh row
    world.setBlock(x + 4, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 4, y, z + 12, quartz, 1, 2);

    // Twelfth row - middle row
    world.setBlock(x + 5, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 5, y, z + 12, quartz, 1, 2);

    // Thirteenth row
    world.setBlock(x + 6, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 6, y, z + 12, quartz, 1, 2);

    // Fourteenth row
    world.setBlock(x + 7, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 12, quartz, 1, 2);

    // Fifteenth row - 9
    world.setBlock(x + 8, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 12, quartz, 1, 2);

    // Sixteenth row
    world.setBlock(x + 9, y, z - 3, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 12, quartz, 1, 2);

    // Seventeenth row
    world.setBlock(x + 10, y, z - 2, quartz, 1, 2);
    world.setBlock(x + 10, y, z, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 9, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 11, quartz, 1, 2);

    // Eighteenth row - 6
    world.setBlock(x + 11, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 11, y, z + 10, quartz, 1, 2);

    // Nineteenth row
    world.setBlock(x + 12, y, z - 1, quartz, 1, 2);
    world.setBlock(x + 12, y, z + 10, quartz, 1, 2);

    // Twentieth row - 4
    world.setBlock(x + 13, y, z, quartz, 1, 2);
    world.setBlock(x + 13, y, z + 9, quartz, 1, 2);

    // Twenty-first row
    world.setBlock(x + 14, y, z, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 1, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 4, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 5, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 8, quartz, 1, 2);
    world.setBlock(x + 14, y, z + 9, quartz, 1, 2);

    y++;
    // Seventh layer

    // Seventh row
    world.setBlock(x, y, z, quartz, 1, 2);
    world.setBlock(x, y, z + 1, quartz, 1, 2);
    world.setBlock(x, y, z + 2, quartz, 1, 2);
    world.setBlock(x, y, z + 3, quartz, 1, 2);
    world.setBlock(x, y, z + 4, quartz, 1, 2);
    world.setBlock(x, y, z + 5, quartz, 1, 2);
    world.setBlock(x, y, z + 6, quartz, 1, 2);
    world.setBlock(x, y, z + 7, quartz, 1, 2);
    world.setBlock(x, y, z + 8, quartz, 1, 2);
    world.setBlock(x, y, z + 9, quartz, 1, 2);

    // Eighth row
    world.setBlock(x + 1, y, z, quartz, 1, 2);
    world.setBlock(x + 1, y, z + 9, quartz, 1, 2);

    // Ninth row
    world.setBlock(x + 2, y, z, quartz, 1, 2);
    world.setBlock(x + 2, y, z + 9, quartz, 1, 2);

    // Tenth row
    world.setBlock(x + 3, y, z, quartz, 1, 2);
    world.setBlock(x + 3, y, z + 9, quartz, 1, 2);

    // Eleventh row
    world.setBlock(x + 4, y, z, quartz, 1, 2);
    world.setBlock(x + 4, y, z + 9, quartz, 1, 2);

    // Twelfth row - middle row
    world.setBlock(x + 5, y, z, quartz, 1, 2);
    world.setBlock(x + 5, y, z + 9, quartz, 1, 2);

    // Thirteenth row
    world.setBlock(x + 6, y, z, quartz, 1, 2);
    world.setBlock(x + 6, y, z + 9, quartz, 1, 2);

    // Fourteenth row
    world.setBlock(x + 7, y, z, quartz, 1, 2);
    world.setBlock(x + 7, y, z + 9, quartz, 1, 2);

    // Fifteenth row - 9
    world.setBlock(x + 8, y, z, quartz, 1, 2);
    world.setBlock(x + 8, y, z + 9, quartz, 1, 2);

    // Sixteenth row
    world.setBlock(x + 9, y, z, quartz, 1, 2);
    world.setBlock(x + 9, y, z + 9, quartz, 1, 2);

    // Seventeenth row
    world.setBlock(x + 10, y, z, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 1, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 2, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 3, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 4, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 5, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 6, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 7, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 8, quartz, 1, 2);
    world.setBlock(x + 10, y, z + 9, quartz, 1, 2);

    return true;
  }
  @Override
  public ItemStack onItemRightClick(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    PropertyDoom doom = PropertyDoom.get(par3EntityPlayer);

    if (!par3EntityPlayer.isSneaking()
        || !TragicWeapon.canUseAbility(doom, TragicConfig.doomAbilityCost[5])) {
      ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
      MinecraftForge.EVENT_BUS.post(event);
      if (event.isCanceled()) return event.result;

      if (par3EntityPlayer.capabilities.isCreativeMode
          || par3EntityPlayer.inventory.hasItem(Items.arrow)) {
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
      }
    } else {
      if (TragicWeapon.getStackCooldown(par1ItemStack) == 0 && TragicConfig.doomAbility[8]) {
        float f = 1.0F;
        float f1 =
            par3EntityPlayer.prevRotationPitch
                + (par3EntityPlayer.rotationPitch - par3EntityPlayer.prevRotationPitch) * f;
        float f2 =
            par3EntityPlayer.prevRotationYaw
                + (par3EntityPlayer.rotationYaw - par3EntityPlayer.prevRotationYaw) * f;
        double d0 =
            par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * f;
        double d1 =
            par3EntityPlayer.prevPosY
                + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * f
                + (par3EntityPlayer.worldObj.isRemote
                    ? par3EntityPlayer.getEyeHeight() - par3EntityPlayer.getDefaultEyeHeight()
                    : par3EntityPlayer
                        .getEyeHeight()); // isRemote check to revert changes to ray trace position
        // due to adding the eye height clientside and player
        // yOffset differences
        double d2 =
            par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * f;
        Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
        float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
        float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI);
        float f5 = -MathHelper.cos(-f1 * 0.017453292F);
        float f6 = MathHelper.sin(-f1 * 0.017453292F);
        float f7 = f4 * f5;
        float f8 = f3 * f5;
        double d3 = 50.0D;

        if (par3EntityPlayer instanceof EntityPlayerMP) {
          d3 =
              ((EntityPlayerMP) par3EntityPlayer).theItemInWorldManager.getBlockReachDistance()
                  + 46.0;
        }

        Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
        MovingObjectPosition mop =
            par3EntityPlayer.worldObj.func_147447_a(vec3, vec31, true, false, true);

        if (mop == null) {
          if (!par2World.isRemote)
            par3EntityPlayer.addChatMessage(new ChatComponentText("Out of range to teleport to!"));
          return par1ItemStack;
        }

        if (mop.typeOfHit == MovingObjectType.BLOCK
            && par3EntityPlayer instanceof EntityPlayerMP
            && ((EntityPlayerMP) par3EntityPlayer)
                .playerNetServerHandler
                .func_147362_b()
                .isChannelOpen()) {
          if (par3EntityPlayer.isRiding()) par3EntityPlayer.mountEntity((Entity) null);

          double d4 = WorldHelper.getXPositionFromSide(mop.sideHit, mop.hitVec.xCoord);
          double d5 = WorldHelper.getYPositionFromSide(mop.sideHit, mop.hitVec.yCoord);
          double d6 = WorldHelper.getZPositionFromSide(mop.sideHit, mop.hitVec.zCoord);

          par3EntityPlayer.setPositionAndUpdate(d4, d5, d6);
          par3EntityPlayer.fallDistance = 0.0F;
          if (!par3EntityPlayer.capabilities.isCreativeMode)
            doom.increaseDoom(-TragicConfig.doomAbilityCost[8]);
          TragicWeapon.setStackCooldown(par1ItemStack, 5);
        }
      }
    }
    return par1ItemStack;
  }