public abstract class blb extends StructurePiece {

  protected static final IBlockState a = Blocks.PRISMARINE.setData(BlockPrismarine.b);
  protected static final IBlockState b = Blocks.PRISMARINE.setData(BlockPrismarine.M);
  protected static final IBlockState c = Blocks.PRISMARINE.setData(BlockPrismarine.N);
  protected static final IBlockState d = b;
  protected static final IBlockState e = Blocks.SEA_LANTERN.getBlockState();
  protected static final IBlockState f = Blocks.WATER.getBlockState();
  protected static final int g = a(2, 0, 0);
  protected static final int h = a(2, 2, 0);
  protected static final int i = a(0, 1, 0);
  protected static final int j = a(4, 1, 0);
  protected blf k;

  protected static final int a(int var0, int var1, int var2) {
    return var1 * 25 + var2 * 5 + var0;
  }

  public blb() {
    super(0);
  }

  public blb(int var1) {
    super(var1);
  }

  public blb(BlockFace var1, CuboidArea var2) {
    super(1);
    this.m = var1;
    this.l = var2;
  }

  protected blb(int var1, BlockFace var2, blf var3, int var4, int var5, int var6) {
    super(var1);
    this.m = var2;
    this.k = var3;
    int var7 = var3.a;
    int var8 = var7 % 5;
    int var9 = var7 / 5 % 5;
    int var10 = var7 / 25;
    if (var2 != BlockFace.NORTH && var2 != BlockFace.SOUTH) {
      this.l = new CuboidArea(0, 0, 0, var6 * 8 - 1, var5 * 4 - 1, var4 * 8 - 1);
    } else {
      this.l = new CuboidArea(0, 0, 0, var4 * 8 - 1, var5 * 4 - 1, var6 * 8 - 1);
    }

    switch (bkj.a[var2.ordinal()]) {
      case 1:
        this.l.a(var8 * 8, var10 * 4, -(var9 + var6) * 8 + 1);
        break;
      case 2:
        this.l.a(var8 * 8, var10 * 4, var9 * 8);
        break;
      case 3:
        this.l.a(-(var9 + var6) * 8 + 1, var10 * 4, var8 * 8);
        break;
      default:
        this.l.a(var9 * 8, var10 * 4, var8 * 8);
    }
  }

  protected void a(NBTCompoundTag var1) {}

  protected void b(NBTCompoundTag var1) {}

  protected void a(World var1, CuboidArea var2, int var3, int var4, boolean var5) {
    if (var5) {
      this.a(var1, var2, var3 + 0, 0, var4 + 0, var3 + 2, 0, var4 + 8 - 1, a, a, false);
      this.a(var1, var2, var3 + 5, 0, var4 + 0, var3 + 8 - 1, 0, var4 + 8 - 1, a, a, false);
      this.a(var1, var2, var3 + 3, 0, var4 + 0, var3 + 4, 0, var4 + 2, a, a, false);
      this.a(var1, var2, var3 + 3, 0, var4 + 5, var3 + 4, 0, var4 + 8 - 1, a, a, false);
      this.a(var1, var2, var3 + 3, 0, var4 + 2, var3 + 4, 0, var4 + 2, b, b, false);
      this.a(var1, var2, var3 + 3, 0, var4 + 5, var3 + 4, 0, var4 + 5, b, b, false);
      this.a(var1, var2, var3 + 2, 0, var4 + 3, var3 + 2, 0, var4 + 4, b, b, false);
      this.a(var1, var2, var3 + 5, 0, var4 + 3, var3 + 5, 0, var4 + 4, b, b, false);
    } else {
      this.a(var1, var2, var3 + 0, 0, var4 + 0, var3 + 8 - 1, 0, var4 + 8 - 1, a, a, false);
    }
  }

  protected void a(
      World var1,
      CuboidArea var2,
      int var3,
      int var4,
      int var5,
      int var6,
      int var7,
      int var8,
      IBlockState var9) {
    for (int var10 = var4; var10 <= var7; ++var10) {
      for (int var11 = var3; var11 <= var6; ++var11) {
        for (int var12 = var5; var12 <= var8; ++var12) {
          if (this.a(var1, var11, var10, var12, var2) == f) {
            this.a(var1, var9, var11, var10, var12, var2);
          }
        }
      }
    }
  }

  protected boolean a(CuboidArea var1, int var2, int var3, int var4, int var5) {
    int var6 = this.a(var2, var3);
    int var7 = this.b(var2, var3);
    int var8 = this.a(var4, var5);
    int var9 = this.b(var4, var5);
    return var1.a(
        Math.min(var6, var8), Math.min(var7, var9), Math.max(var6, var8), Math.max(var7, var9));
  }

  protected boolean a(World var1, CuboidArea var2, int var3, int var4, int var5) {
    int var6 = this.a(var3, var5);
    int var7 = this.d(var4);
    int var8 = this.b(var3, var5);
    if (var2.b((fd) (new Position(var6, var7, var8)))) {
      EntityGuardian var9 = new EntityGuardian(var1);
      var9.a(true);
      var9.g(var9.bt());
      var9.setPositionRotation(
          (double) var6 + 0.5D, (double) var7, (double) var8 + 0.5D, 0.0F, 0.0F);
      var9.a(var1.E(new Position(var9)), (xq) null);
      var1.addEntity((Entity) var9);
      return true;
    } else {
      return false;
    }
  }
}
public abstract class WorldGenMonumentPiece extends StructurePiece {

  protected static final IBlockData a = Blocks.PRISMARINE.fromLegacyData(BlockPrismarine.b);
  protected static final IBlockData b = Blocks.PRISMARINE.fromLegacyData(BlockPrismarine.M);
  protected static final IBlockData c = Blocks.PRISMARINE.fromLegacyData(BlockPrismarine.N);
  protected static final IBlockData d = WorldGenMonumentPiece.b;
  protected static final IBlockData e = Blocks.SEA_LANTERN.getBlockData();
  protected static final IBlockData f = Blocks.WATER.getBlockData();
  protected static final int g = a(2, 0, 0);
  protected static final int h = a(2, 2, 0);
  protected static final int i = a(0, 1, 0);
  protected static final int j = a(4, 1, 0);
  protected WorldGenMonumentStateTracker k;

  protected static final int a(int i, int j, int k) {
    return j * 25 + k * 5 + i;
  }

  public WorldGenMonumentPiece() {
    super(0);
  }

  public WorldGenMonumentPiece(int i) {
    super(i);
  }

  public WorldGenMonumentPiece(
      EnumDirection enumdirection, StructureBoundingBox structureboundingbox) {
    super(1);
    this.m = enumdirection;
    this.l = structureboundingbox;
  }

  protected WorldGenMonumentPiece(
      int i,
      EnumDirection enumdirection,
      WorldGenMonumentStateTracker worldgenmonumentstatetracker,
      int j,
      int k,
      int l) {
    super(i);
    this.m = enumdirection;
    this.k = worldgenmonumentstatetracker;
    int i1 = worldgenmonumentstatetracker.a;
    int j1 = i1 % 5;
    int k1 = i1 / 5 % 5;
    int l1 = i1 / 25;

    if (enumdirection != EnumDirection.NORTH && enumdirection != EnumDirection.SOUTH) {
      this.l = new StructureBoundingBox(0, 0, 0, l * 8 - 1, k * 4 - 1, j * 8 - 1);
    } else {
      this.l = new StructureBoundingBox(0, 0, 0, j * 8 - 1, k * 4 - 1, l * 8 - 1);
    }

    switch (SwitchHelperDirection5.a[enumdirection.ordinal()]) {
      case 1:
        this.l.a(j1 * 8, l1 * 4, -(k1 + l) * 8 + 1);
        break;

      case 2:
        this.l.a(j1 * 8, l1 * 4, k1 * 8);
        break;

      case 3:
        this.l.a(-(k1 + l) * 8 + 1, l1 * 4, j1 * 8);
        break;

      default:
        this.l.a(k1 * 8, l1 * 4, j1 * 8);
    }
  }

  protected void a(NBTTagCompound nbttagcompound) {}

  protected void b(NBTTagCompound nbttagcompound) {}

  protected void a(
      World world, StructureBoundingBox structureboundingbox, int i, int j, boolean flag) {
    if (flag) {
      this.a(
          world,
          structureboundingbox,
          i + 0,
          0,
          j + 0,
          i + 2,
          0,
          j + 8 - 1,
          WorldGenMonumentPiece.a,
          WorldGenMonumentPiece.a,
          false);
      this.a(
          world,
          structureboundingbox,
          i + 5,
          0,
          j + 0,
          i + 8 - 1,
          0,
          j + 8 - 1,
          WorldGenMonumentPiece.a,
          WorldGenMonumentPiece.a,
          false);
      this.a(
          world,
          structureboundingbox,
          i + 3,
          0,
          j + 0,
          i + 4,
          0,
          j + 2,
          WorldGenMonumentPiece.a,
          WorldGenMonumentPiece.a,
          false);
      this.a(
          world,
          structureboundingbox,
          i + 3,
          0,
          j + 5,
          i + 4,
          0,
          j + 8 - 1,
          WorldGenMonumentPiece.a,
          WorldGenMonumentPiece.a,
          false);
      this.a(
          world,
          structureboundingbox,
          i + 3,
          0,
          j + 2,
          i + 4,
          0,
          j + 2,
          WorldGenMonumentPiece.b,
          WorldGenMonumentPiece.b,
          false);
      this.a(
          world,
          structureboundingbox,
          i + 3,
          0,
          j + 5,
          i + 4,
          0,
          j + 5,
          WorldGenMonumentPiece.b,
          WorldGenMonumentPiece.b,
          false);
      this.a(
          world,
          structureboundingbox,
          i + 2,
          0,
          j + 3,
          i + 2,
          0,
          j + 4,
          WorldGenMonumentPiece.b,
          WorldGenMonumentPiece.b,
          false);
      this.a(
          world,
          structureboundingbox,
          i + 5,
          0,
          j + 3,
          i + 5,
          0,
          j + 4,
          WorldGenMonumentPiece.b,
          WorldGenMonumentPiece.b,
          false);
    } else {
      this.a(
          world,
          structureboundingbox,
          i + 0,
          0,
          j + 0,
          i + 8 - 1,
          0,
          j + 8 - 1,
          WorldGenMonumentPiece.a,
          WorldGenMonumentPiece.a,
          false);
    }
  }

  protected void a(
      World world,
      StructureBoundingBox structureboundingbox,
      int i,
      int j,
      int k,
      int l,
      int i1,
      int j1,
      IBlockData iblockdata) {
    for (int k1 = j; k1 <= i1; ++k1) {
      for (int l1 = i; l1 <= l; ++l1) {
        for (int i2 = k; i2 <= j1; ++i2) {
          if (this.a(world, l1, k1, i2, structureboundingbox) == WorldGenMonumentPiece.f) {
            this.a(world, iblockdata, l1, k1, i2, structureboundingbox);
          }
        }
      }
    }
  }

  protected boolean a(StructureBoundingBox structureboundingbox, int i, int j, int k, int l) {
    int i1 = this.a(i, j);
    int j1 = this.b(i, j);
    int k1 = this.a(k, l);
    int l1 = this.b(k, l);

    return structureboundingbox.a(
        Math.min(i1, k1), Math.min(j1, l1), Math.max(i1, k1), Math.max(j1, l1));
  }

  protected boolean a(World world, StructureBoundingBox structureboundingbox, int i, int j, int k) {
    int l = this.a(i, k);
    int i1 = this.d(j);
    int j1 = this.b(i, k);

    if (structureboundingbox.b((BaseBlockPosition) (new BlockPosition(l, i1, j1)))) {
      EntityGuardian entityguardian = new EntityGuardian(world);

      entityguardian.a(true);
      entityguardian.heal(entityguardian.getMaxHealth());
      entityguardian.setPositionRotation(
          (double) l + 0.5D, (double) i1, (double) j1 + 0.5D, 0.0F, 0.0F);
      entityguardian.prepare(world.E(new BlockPosition(entityguardian)), (GroupDataEntity) null);
      world.addEntity(entityguardian);
      return true;
    } else {
      return false;
    }
  }
}