public static StructureBoundingBox func_35027_a(
      List list, Random random, int i, int j, int k, int l) {
    StructureBoundingBox structureboundingbox = new StructureBoundingBox(i, j - 5, k, i, j + 2, k);
    switch (l) {
      case 2: // '\002'
        structureboundingbox.maxX = i + 2;
        structureboundingbox.minZ = k - 8;
        break;

      case 0: // '\0'
        structureboundingbox.maxX = i + 2;
        structureboundingbox.maxZ = k + 8;
        break;

      case 1: // '\001'
        structureboundingbox.minX = i - 8;
        structureboundingbox.maxZ = k + 2;
        break;

      case 3: // '\003'
        structureboundingbox.maxX = i + 8;
        structureboundingbox.maxZ = k + 2;
        break;
    }
    if (StructureComponent.getIntersectingStructureComponent(list, structureboundingbox) != null) {
      return null;
    } else {
      return structureboundingbox;
    }
  }
 private Vector translate(Vector pos) {
   StructureBoundingBox boundingBox = structure.getBoundingBox();
   switch (structure.getOrientation()) {
     case EAST:
       return new Vector(
           boundingBox.getMax().getBlockX() - pos.getBlockZ(),
           boundingBox.getMin().getBlockY() + pos.getBlockY(),
           boundingBox.getMin().getBlockZ() + pos.getBlockX());
     case SOUTH:
       return new Vector(
           boundingBox.getMin().getBlockX() + pos.getBlockX(),
           boundingBox.getMin().getBlockY() + pos.getBlockY(),
           boundingBox.getMax().getBlockZ() - pos.getBlockZ());
     case WEST:
       return new Vector(
           boundingBox.getMin().getBlockX() + pos.getBlockZ(),
           boundingBox.getMin().getBlockY() + pos.getBlockY(),
           boundingBox.getMin().getBlockZ() + pos.getBlockX());
     default: // NORTH
       return new Vector(
           boundingBox.getMin().getBlockX() + pos.getBlockX(),
           boundingBox.getMin().getBlockY() + pos.getBlockY(),
           boundingBox.getMin().getBlockZ() + pos.getBlockZ());
   }
 }
예제 #3
0
 public WorldGenVillageRoad(
     WorldGenVillageStartPiece worldgenvillagestartpiece,
     int i,
     Random random,
     StructureBoundingBox structureboundingbox,
     int j) {
   super(worldgenvillagestartpiece, i);
   this.g = j;
   this.f = structureboundingbox;
   this.a = Math.max(structureboundingbox.b(), structureboundingbox.d());
 }
  protected void a(NBTTagCompound nbttagcompound) {
    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = this.a.iterator();

    while (iterator.hasNext()) {
      StructureBoundingBox structureboundingbox = (StructureBoundingBox) iterator.next();

      nbttaglist.add(structureboundingbox.h());
    }

    nbttagcompound.set("Entrances", nbttaglist);
  }
 public ComponentMineshaftCorridor(
     int p_i488_1_, Random p_i488_2_, StructureBoundingBox p_i488_3_, int p_i488_4_) {
   super(p_i488_1_);
   field_35025_h = p_i488_4_;
   field_35024_g = p_i488_3_;
   field_35070_a = p_i488_2_.nextInt(3) == 0;
   field_35068_b = !field_35070_a && p_i488_2_.nextInt(23) == 0;
   if (field_35025_h == 2 || field_35025_h == 0) {
     field_35067_d = p_i488_3_.func_35739_d() / 5;
   } else {
     field_35067_d = p_i488_3_.func_35744_b() / 5;
   }
 }
  public ComponentMineshaftCorridor(
      int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) {
    super(par1);
    coordBaseMode = par4;
    boundingBox = par3StructureBoundingBox;
    hasRails = par2Random.nextInt(3) == 0;
    hasSpiders = !hasRails && par2Random.nextInt(23) == 0;

    if (coordBaseMode == 2 || coordBaseMode == 0) {
      sectionCount = par3StructureBoundingBox.getZSize() / 5;
    } else {
      sectionCount = par3StructureBoundingBox.getXSize() / 5;
    }
  }
  public WorldGenMineshaftCorridor(
      int paramInt1,
      Random paramRandom,
      StructureBoundingBox paramStructureBoundingBox,
      int paramInt2) {
    super(paramInt1);
    this.h = paramInt2;
    this.g = paramStructureBoundingBox;
    this.a = (paramRandom.nextInt(3) == 0);
    this.b = ((!this.a) && (paramRandom.nextInt(23) == 0));

    if ((this.h == 2) || (this.h == 0)) this.d = (paramStructureBoundingBox.d() / 5);
    else this.d = (paramStructureBoundingBox.b() / 5);
  }
 public boolean spawnMob(Vector pos, EntityType entityType) {
   Vector vec = translate(pos);
   return boundingBox.isVectorInside(vec)
       && world.spawnEntity(
               new Location(world, vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()), entityType)
           != null;
 }
  /**
   * Spawns a number of villagers in this component. Parameters: world, component bounding box, x
   * offset, y offset, z offset, number of villagers
   */
  protected void spawnVillagers(
      World par1World,
      StructureBoundingBox par2StructureBoundingBox,
      int par3,
      int par4,
      int par5,
      int par6) {
    if (this.villagersSpawned < par6) {
      for (int var7 = this.villagersSpawned; var7 < par6; ++var7) {
        int var8 = this.getXWithOffset(par3 + var7, par5);
        int var9 = this.getYWithOffset(par4);
        int var10 = this.getZWithOffset(par3 + var7, par5);

        if (!par2StructureBoundingBox.isVecInside(var8, var9, var10)) {
          break;
        }

        ++this.villagersSpawned;
        EntityVillager var11 = new EntityVillager(par1World, this.getVillagerType(var7));
        var11.setLocationAndAngles(
            (double) var8 + 0.5D, (double) var9, (double) var10 + 0.5D, 0.0F, 0.0F);
        par1World.spawnEntityInWorld(var11);
      }
    }
  }
 public void setBlock(Vector pos, Material type, int data) {
   Vector vec = translate(pos);
   if (boundingBox.isVectorInside(vec)) {
     delegate.setTypeAndRawData(
         world, vec.getBlockX(), vec.getBlockY(), vec.getBlockZ(), type, data);
   }
 }
예제 #11
0
 public WorldGenMineshaftCross(
     int i, Random random, StructureBoundingBox structureboundingbox, int j) {
   super(i);
   this.a = j;
   this.g = structureboundingbox;
   this.b = structureboundingbox.c() > 3;
 }
 public ComponentStrongholdLibrary(
     int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) {
   super(par1);
   this.coordBaseMode = par4;
   this.doorType = this.getRandomDoor(par2Random);
   this.boundingBox = par3StructureBoundingBox;
   this.isLargeRoom = par3StructureBoundingBox.getYSize() > 6;
 }
  public static WorldGenStrongholdRoomCrossing a(
      List list, Random random, int i, int j, int k, int l, int i1) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.a(i, j, k, -4, -1, 0, 11, 7, 11, l);

    return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null
        ? new WorldGenStrongholdRoomCrossing(i1, random, structureboundingbox, l)
        : null;
  }
예제 #14
0
  public static WorldGenNetherPiece5 a(
      List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.a(i, j, k, -3, 0, 0, 9, 7, 9, enumdirection);

    return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null
        ? new WorldGenNetherPiece5(l, random, structureboundingbox, enumdirection)
        : null;
  }
예제 #15
0
  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));
  }
예제 #16
0
  public static WorldGenNetherPiece11 a(
      List list, Random random, int i, int j, int k, int l, int i1) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.a(i, j, k, -2, 0, 0, 7, 9, 7, l);

    return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null
        ? new WorldGenNetherPiece11(i1, random, structureboundingbox, l)
        : null;
  }
  public static WorldGenStrongholdStairs2 a(
      List list, Random random, int i, int j, int k, int l, int i1) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.a(i, j, k, -1, -7, 0, 5, 11, 5, l);

    return a(structureboundingbox) && StructurePiece.a(list, structureboundingbox) == null
        ? new WorldGenStrongholdStairs2(i1, random, structureboundingbox, l)
        : null;
  }
  public static StructureBoundingBox func_35066_a(
      List p_35066_0_,
      Random p_35066_1_,
      int p_35066_2_,
      int p_35066_3_,
      int p_35066_4_,
      int p_35066_5_) {
    StructureBoundingBox structureboundingbox =
        new StructureBoundingBox(
            p_35066_2_, p_35066_3_, p_35066_4_, p_35066_2_, p_35066_3_ + 2, p_35066_4_);
    int i = p_35066_1_.nextInt(3) + 2;
    do {
      if (i <= 0) {
        break;
      }
      int j = i * 5;
      switch (p_35066_5_) {
        case 2: // '\002'
          structureboundingbox.field_35749_d = p_35066_2_ + 2;
          structureboundingbox.field_35752_c = p_35066_4_ - (j - 1);
          break;

        case 0: // '\0'
          structureboundingbox.field_35749_d = p_35066_2_ + 2;
          structureboundingbox.field_35748_f = p_35066_4_ + (j - 1);
          break;

        case 1: // '\001'
          structureboundingbox.field_35753_a = p_35066_2_ - (j - 1);
          structureboundingbox.field_35748_f = p_35066_4_ + 2;
          break;

        case 3: // '\003'
          structureboundingbox.field_35749_d = p_35066_2_ + (j - 1);
          structureboundingbox.field_35748_f = p_35066_4_ + 2;
          break;
      }
      if (StructureComponent.func_35020_a(p_35066_0_, structureboundingbox) == null) {
        break;
      }
      i--;
    } while (true);
    if (i > 0) {
      return structureboundingbox;
    } else {
      return null;
    }
  }
 public static ComponentStrongholdPortalRoom findValidPlacement(
     List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
   StructureBoundingBox var7 =
       StructureBoundingBox.getComponentToAddBoundingBox(
           par2, par3, par4, -4, -1, 0, 11, 8, 16, par5);
   return canStrongholdGoDeeper(var7)
           && StructureComponent.findIntersecting(par0List, var7) == null
       ? new ComponentStrongholdPortalRoom(par6, par1Random, var7, par5)
       : null;
 }
 public void setBlockDownward(Vector pos, Material type, MaterialData data) {
   Vector vec = translate(pos);
   if (boundingBox.isVectorInside(vec)) {
     int y = vec.getBlockY();
     while (!world.getBlockAt(vec.getBlockX(), y, vec.getBlockZ()).getType().isSolid() && y > 1) {
       delegate.setTypeAndData(world, vec.getBlockX(), y, vec.getBlockZ(), type, data);
       y--;
     }
   }
 }
  public static StructureBoundingBox findValidPlacement(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5) {
    StructureBoundingBox structureboundingbox =
        new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4);
    int i = par1Random.nextInt(3) + 2;

    do {
      if (i <= 0) {
        break;
      }

      int j = i * 5;

      switch (par5) {
        case 2:
          structureboundingbox.maxX = par2 + 2;
          structureboundingbox.minZ = par4 - (j - 1);
          break;

        case 0:
          structureboundingbox.maxX = par2 + 2;
          structureboundingbox.maxZ = par4 + (j - 1);
          break;

        case 1:
          structureboundingbox.minX = par2 - (j - 1);
          structureboundingbox.maxZ = par4 + 2;
          break;

        case 3:
          structureboundingbox.maxX = par2 + (j - 1);
          structureboundingbox.maxZ = par4 + 2;
          break;
      }

      if (StructureComponent.findIntersecting(par0List, structureboundingbox) == null) {
        break;
      }

      i--;
    } while (true);

    if (i > 0) {
      return structureboundingbox;
    } else {
      return null;
    }
  }
  public static ComponentStrongholdLibrary findValidPlacement(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
    StructureBoundingBox var7 =
        StructureBoundingBox.getComponentToAddBoundingBox(
            par2, par3, par4, -4, -1, 0, 14, 11, 15, par5);

    if (!canStrongholdGoDeeper(var7)
        || StructureComponent.findIntersecting(par0List, var7) != null) {
      var7 =
          StructureBoundingBox.getComponentToAddBoundingBox(
              par2, par3, par4, -4, -1, 0, 14, 6, 15, par5);

      if (!canStrongholdGoDeeper(var7)
          || StructureComponent.findIntersecting(par0List, var7) != null) {
        return null;
      }
    }

    return new ComponentStrongholdLibrary(par6, par1Random, var7, par5);
  }
 public static ComponentStrongholdStairs func_35034_a(
     List list, Random random, int i, int j, int k, int l, int i1) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.func_35747_a(i, j, k, -1, -7, 0, 5, 11, 5, l);
   if (!func_35030_a(structureboundingbox)
       || StructureComponent.func_35020_a(list, structureboundingbox) != null) {
     return null;
   } else {
     return new ComponentStrongholdStairs(i1, random, structureboundingbox, l);
   }
 }
 public static ComponentNetherBridgeCorridor func_40038_a(
     List list, Random random, int i, int j, int k, int l, int i1) {
   StructureBoundingBox structureboundingbox =
       StructureBoundingBox.getComponentToAddBoundingBox(i, j, k, -1, 0, 0, 5, 7, 5, l);
   if (!func_40021_a(structureboundingbox)
       || StructureComponent.getIntersectingStructureComponent(list, structureboundingbox)
           != null) {
     return null;
   } else {
     return new ComponentNetherBridgeCorridor(i1, random, structureboundingbox, l);
   }
 }
  public static ComponentStrongholdChestCorridor findValidPlacement(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.getComponentToAddBoundingBox(
            par2, par3, par4, -1, -1, 0, 5, 5, 7, par5);

    if (!canStrongholdGoDeeper(structureboundingbox)
        || StructureComponent.findIntersecting(par0List, structureboundingbox) != null) {
      return null;
    } else {
      return new ComponentStrongholdChestCorridor(par6, par1Random, structureboundingbox, par5);
    }
  }
  /**
   * Creates and returns a new component piece. Or null if it could not find enough room to place
   * it.
   */
  public static ComponentNetherBridgeCorridor2 createValidComponent(
      List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) {
    StructureBoundingBox structureboundingbox =
        StructureBoundingBox.getComponentToAddBoundingBox(
            par2, par3, par4, -1, 0, 0, 5, 7, 5, par5);

    if (!isAboveGround(structureboundingbox)
        || StructureComponent.findIntersecting(par0List, structureboundingbox) != null) {
      return null;
    } else {
      return new ComponentNetherBridgeCorridor2(par6, par1Random, structureboundingbox, par5);
    }
  }
  public static StructureBoundingBox a(
      List paramList,
      Random paramRandom,
      int paramInt1,
      int paramInt2,
      int paramInt3,
      int paramInt4) {
    StructureBoundingBox localStructureBoundingBox =
        new StructureBoundingBox(
            paramInt1, paramInt2, paramInt3, paramInt1, paramInt2 + 2, paramInt3);

    int i = paramRandom.nextInt(3) + 2;
    while (i > 0) {
      int j = i * 5;

      switch (paramInt4) {
        case 2:
          localStructureBoundingBox.d = (paramInt1 + 2);
          localStructureBoundingBox.c = (paramInt3 - (j - 1));
          break;
        case 0:
          localStructureBoundingBox.d = (paramInt1 + 2);
          localStructureBoundingBox.f = (paramInt3 + (j - 1));
          break;
        case 1:
          localStructureBoundingBox.a = (paramInt1 - (j - 1));
          localStructureBoundingBox.f = (paramInt3 + 2);
          break;
        case 3:
          localStructureBoundingBox.d = (paramInt1 + (j - 1));
          localStructureBoundingBox.f = (paramInt3 + 2);
      }

      if (StructurePiece.a(paramList, localStructureBoundingBox) == null) break;
      i--;
    }

    if (i > 0) {
      return localStructureBoundingBox;
    }

    return null;
  }
예제 #28
0
  public boolean a(World world, Random random, StructureBoundingBox structureboundingbox) {
    Block block = this.b(Blocks.GRAVEL, 0);

    for (int i = this.f.a; i <= this.f.d; ++i) {
      for (int j = this.f.c; j <= this.f.f; ++j) {
        if (structureboundingbox.b(i, 64, j)) {
          int k = world.i(i, j) - 1;

          world.setTypeAndData(i, k, j, block, 0, 2);
        }
      }
    }

    return true;
  }
  public void createMobSpawner(Vector pos, EntityType entityType) {
    Vector vec = translate(pos);
    if (boundingBox.isVectorInside(vec)) {
      BlockState state =
          world.getBlockAt(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()).getState();
      delegate.backupBlockState(state.getBlock());

      state.setType(Material.MOB_SPAWNER);
      state.update(true);

      state = world.getBlockAt(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()).getState();
      if (state instanceof CreatureSpawner) {
        ((CreatureSpawner) state).setSpawnedType(entityType);
      }
    }
  }
  public static StructureBoundingBox func_35027_a(
      List p_35027_0_,
      Random p_35027_1_,
      int p_35027_2_,
      int p_35027_3_,
      int p_35027_4_,
      int p_35027_5_) {
    StructureBoundingBox structureboundingbox =
        new StructureBoundingBox(
            p_35027_2_, p_35027_3_ - 5, p_35027_4_, p_35027_2_, p_35027_3_ + 2, p_35027_4_);
    switch (p_35027_5_) {
      case 2: // '\002'
        structureboundingbox.field_35749_d = p_35027_2_ + 2;
        structureboundingbox.field_35752_c = p_35027_4_ - 8;
        break;

      case 0: // '\0'
        structureboundingbox.field_35749_d = p_35027_2_ + 2;
        structureboundingbox.field_35748_f = p_35027_4_ + 8;
        break;

      case 1: // '\001'
        structureboundingbox.field_35753_a = p_35027_2_ - 8;
        structureboundingbox.field_35748_f = p_35027_4_ + 2;
        break;

      case 3: // '\003'
        structureboundingbox.field_35749_d = p_35027_2_ + 8;
        structureboundingbox.field_35748_f = p_35027_4_ + 2;
        break;
    }
    if (StructureComponent.func_35020_a(p_35027_0_, structureboundingbox) != null) {
      return null;
    } else {
      return structureboundingbox;
    }
  }