コード例 #1
0
  private void revertDummies() {
    int n = 0;
    boolean axis = (facing.equals(ForgeDirection.EAST) || facing.equals(ForgeDirection.WEST));
    int dir = (facing.equals(ForgeDirection.WEST) || facing.equals(ForgeDirection.NORTH)) ? -1 : 1;
    boolean derp = false;
    for (int k = -1; k < 3; k++)
      for (int i = 0; i < 7; i++)
        for (int j = -3; j < 4; j++) {
          int r = Vector3.Int((Math.sqrt(j * j + (i - 3) * (i - 3) + (k + 1) * (k + 1))));

          if (r != 3 && !(k == -1 && r <= 3)) continue;
          if (j == 0 && k == 0 && (i == 0 || i == 1)) continue;
          if (k == 2 && i == 3 && j == 0) continue;

          int x = xCoord + (axis ? i * dir : j);
          int z = zCoord + (axis ? j : i * dir);
          int y = yCoord + k;

          if (x == xCoord && y == yCoord && z == zCoord) continue;

          Block id = worldObj.getBlock(x, y, z);
          if (id != limekiln) // BlockLimekilnDummy.instance.blockID)
          continue;

          worldObj.setBlock(x, y, z, derp ? brick_block : partBlocks);
          worldObj.markBlockForUpdate(x, y, z);
        }

    isValidMultiblock = false;
  }
コード例 #2
0
  boolean checkInside() {

    boolean axis = (facing.equals(ForgeDirection.EAST) || facing.equals(ForgeDirection.WEST));
    int dir = (facing.equals(ForgeDirection.WEST) || facing.equals(ForgeDirection.NORTH)) ? -1 : 1;

    for (int k = 0; k < 4; k++)
      for (int i = 0; i < 7; i++)
        for (int j = -3; j < 4; j++) {
          int r = Vector3.Int((Math.sqrt(j * j + (i - 3) * (i - 3) + (k + 1) * (k + 1))));
          if (r >= 3 && !(k == 2 && i == 3 && j == 0)) continue;
          if (j == 0 && k == 0 && i == 0) continue;

          int x = xCoord + (axis ? i * dir : j);
          int z = zCoord + (axis ? j : i * dir);
          int y = yCoord + k;

          if (x == xCoord && y == yCoord && z == zCoord) continue;

          Vector3 loc = new Vector3(x, y, z);
          Block id = loc.getBlock(worldObj);
          if (!(loc.isAir(worldObj) || id == fire)) return false;
        }

    return true;
  }
コード例 #3
0
  public void convertDummies() {

    int n = 0;
    boolean axis = (facing.equals(ForgeDirection.EAST) || facing.equals(ForgeDirection.WEST));
    int dir = (facing.equals(ForgeDirection.WEST) || facing.equals(ForgeDirection.NORTH)) ? -1 : 1;

    for (int k = -1; k < 3; k++)
      for (int i = 0; i < 7; i++)
        for (int j = -3; j < 4; j++) {
          int r = Vector3.Int((Math.sqrt(j * j + (i - 3) * (i - 3) + (k + 1) * (k + 1))));

          if (r != 3 && !(k == -1 && r <= 3)) continue;
          if (j == 0 && k == 0 && (i == 0 || i == 1)) continue;
          if (k == 2 && i == 3 && j == 0) continue;

          int x = xCoord + (axis ? i * dir : j);
          int z = zCoord + (axis ? j : i * dir);
          int y = yCoord + k;

          if (x == xCoord && y == yCoord && z == zCoord) continue;

          worldObj.setBlock(x, y, z, limekiln, 2 + type, 3);
          TileEntityMultiBlockPart dummyTE;
          TileEntity te = worldObj.getTileEntity(x, y, z);
          if (te instanceof TileEntityMultiBlockPart) dummyTE = (TileEntityMultiBlockPart) te;
          else {
            if (te != null) {
              te.invalidate();
              worldObj.removeTileEntity(x, y, z);
            }
            dummyTE = new TileEntityMultiBlockPart();
            worldObj.setTileEntity(x, y, z, dummyTE);
          }

          dummyTE.type = type;
          dummyTE.revertID = partBlocks;
          dummyTE.setCore(this);
          worldObj.markBlockForUpdate(x, y, z);
        }
    isValidMultiblock = true;
  }
コード例 #4
0
  public void setInside() {
    if (worldObj.isRemote) return;

    boolean axis = (facing.equals(ForgeDirection.EAST) || facing.equals(ForgeDirection.WEST));
    int dir = (facing.equals(ForgeDirection.WEST) || facing.equals(ForgeDirection.NORTH)) ? -1 : 1;
    //	hole.setBlock(worldObj, Blocks.warmCO2.blockID, 7);
    for (int k = 0; k < 4; k++)
      for (int i = 0; i < 7; i++)
        for (int j = -3; j < 4; j++) {
          int r = Vector3.Int((Math.sqrt(j * j + (i - 3) * (i - 3) + (k + 1) * (k + 1))));
          if (r >= 3) continue;
          if (j == 0 && k == 0 && i == 0) continue;

          int x = xCoord + (axis ? i * dir : j);
          int z = zCoord + (axis ? j : i * dir);
          int y = yCoord + k;

          if (x == xCoord && y == yCoord && z == zCoord) continue;

          Vector3 loc = new Vector3(x, y, z);
          Block id = loc.getBlock(worldObj);
          if (!(id == fire) && loc.isAir(worldObj)) if (k == 0) loc.setBlock(worldObj, fire);
        }
  }
コード例 #5
0
  public boolean checkIfProperlyFormed() {
    boolean beak = false;
    {
      int n = 0;
      boolean axis = (facing.equals(ForgeDirection.EAST) || facing.equals(ForgeDirection.WEST));
      int dir =
          (facing.equals(ForgeDirection.WEST) || facing.equals(ForgeDirection.NORTH)) ? -1 : 1;

      for (int k = -1; k < 5; k++) {
        for (int i = 0; i < 7; i++) {
          for (int j = -3; j < 4; j++) {
            int r = Vector3.Int((Math.sqrt(j * j + (i - 3) * (i - 3) + (k + 1) * (k + 1))));

            if (r != 3 && !(k == -1 && r <= 3)) continue;
            if (j == 0 && k == 0 && (i == 0 || i == 1)) continue;
            if (k == 2 && i == 3 && j == 0) {
              hole =
                  new Vector3(
                      xCoord + (axis ? i * dir : j), zCoord + (axis ? j : i * dir), yCoord + k);
              continue;
            }

            int x = xCoord + (axis ? i * dir : j);
            int z = zCoord + (axis ? j : i * dir);
            int y = yCoord + k;

            if (x == xCoord && y == yCoord && z == zCoord) continue;
            Block id = worldObj.getBlock(x, y, z);
            if (!(id == partBlocks || id == limekiln)) {
              type = 1;
              partBlocks = stonebrick;
              beak = true;
              break;
            }
            n++;
          }
          if (beak) break;
        }
        if (beak) break;
      }
    }

    if (beak) {
      int n = 0;
      boolean axis = (facing.equals(ForgeDirection.EAST) || facing.equals(ForgeDirection.WEST));
      int dir =
          (facing.equals(ForgeDirection.WEST) || facing.equals(ForgeDirection.NORTH)) ? -1 : 1;

      for (int k = -1; k < 3; k++)
        for (int i = 0; i < 7; i++)
          for (int j = -3; j < 4; j++) {
            int r = Vector3.Int((Math.sqrt(j * j + (i - 3) * (i - 3) + (k + 1) * (k + 1))));

            if (r != 3 && !(k == -1 && r <= 3)) continue;
            if (j == 0 && k == 0 && (i == 0 || i == 1)) continue;
            if (k == 2 && i == 3 && j == 0) {
              hole =
                  new Vector3(
                      xCoord + (axis ? i * dir : j), zCoord + (axis ? j : i * dir), yCoord + k);
              continue;
            }

            int x = xCoord + (axis ? i * dir : j);
            int z = zCoord + (axis ? j : i * dir);
            int y = yCoord + k;

            if (x == xCoord && y == yCoord && z == zCoord) continue;
            Block id = worldObj.getBlock(x, y, z);
            if (!(id == partBlocks || id == limekiln)) {
              type = 1;
              partBlocks = stonebrick;
              return false;
            }
            n++;
          }
    }

    return checkInside();
  }