コード例 #1
0
ファイル: BlockFlowing.java プロジェクト: ymsquall/mc-dev
  private boolean l(World world, int i, int j, int k) {
    Material material = world.getMaterial(i, j, k);

    return material == this.material
        ? false
        : (material == Material.LAVA ? false : !this.k(world, i, j, k));
  }
コード例 #2
0
ファイル: BlockSnow.java プロジェクト: agaricusb/MCPC-1.4.5
 /**
  * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
  */
 public boolean canPlace(World var1, int var2, int var3, int var4) {
   int var5 = var1.getTypeId(var2, var3 - 1, var4);
   Block var6 = Block.byId[var5];
   return var6 != null && (var6.isLeaves(var1, var2, var3 - 1, var4) || Block.byId[var5].c())
       ? var1.getMaterial(var2, var3 - 1, var4).isSolid()
       : false;
 }
コード例 #3
0
ファイル: BlockSign.java プロジェクト: Meaglin/Buck---It
  public void a(World world, int i, int j, int k, int l) {
    boolean flag = false;

    if (this.b) {
      if (!world.getMaterial(i, j - 1, k).isBuildable()) {
        flag = true;
      }
    } else {
      int i1 = world.getData(i, j, k);

      flag = true;
      if (i1 == 2 && world.getMaterial(i, j, k + 1).isBuildable()) {
        flag = false;
      }

      if (i1 == 3 && world.getMaterial(i, j, k - 1).isBuildable()) {
        flag = false;
      }

      if (i1 == 4 && world.getMaterial(i + 1, j, k).isBuildable()) {
        flag = false;
      }

      if (i1 == 5 && world.getMaterial(i - 1, j, k).isBuildable()) {
        flag = false;
      }
    }

    if (flag) {
      this.a_(world, i, j, k, world.getData(i, j, k));
      world.e(i, j, k, 0);
    }

    super.a(world, i, j, k, l);

    // CraftBukkit start
    if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].c()) {
      CraftWorld craftWorld = ((WorldServer) world).getWorld();
      CraftServer server = ((WorldServer) world).getServer();
      Block block = craftWorld.getBlockAt(i, j, k);
      int power = block.getBlockPower();
      BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
      server.getPluginManager().callEvent(eventRedstone);
    }
    // CraftBukkit end
  }
コード例 #4
0
ファイル: BlockFlowing.java プロジェクト: ymsquall/mc-dev
  private boolean[] j(World world, int i, int j, int k) {
    int l;
    int i1;

    for (l = 0; l < 4; ++l) {
      this.c[l] = 1000;
      i1 = i;
      int j1 = k;

      if (l == 0) {
        i1 = i - 1;
      }

      if (l == 1) {
        ++i1;
      }

      if (l == 2) {
        j1 = k - 1;
      }

      if (l == 3) {
        ++j1;
      }

      if (!this.k(world, i1, j, j1)
          && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
        if (!this.k(world, i1, j - 1, j1)) {
          this.c[l] = 0;
        } else {
          this.c[l] = this.b(world, i1, j, j1, 1, l);
        }
      }
    }

    l = this.c[0];

    for (i1 = 1; i1 < 4; ++i1) {
      if (this.c[i1] < l) {
        l = this.c[i1];
      }
    }

    for (i1 = 0; i1 < 4; ++i1) {
      this.b[i1] = this.c[i1] == l;
    }

    return this.b;
  }
コード例 #5
0
ファイル: BlockFlowing.java プロジェクト: ymsquall/mc-dev
  private int b(World world, int i, int j, int k, int l, int i1) {
    int j1 = 1000;

    for (int k1 = 0; k1 < 4; ++k1) {
      if ((k1 != 0 || i1 != 1)
          && (k1 != 1 || i1 != 0)
          && (k1 != 2 || i1 != 3)
          && (k1 != 3 || i1 != 2)) {
        int l1 = i;
        int i2 = k;

        if (k1 == 0) {
          l1 = i - 1;
        }

        if (k1 == 1) {
          ++l1;
        }

        if (k1 == 2) {
          i2 = k - 1;
        }

        if (k1 == 3) {
          ++i2;
        }

        if (!this.k(world, l1, j, i2)
            && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
          if (!this.k(world, l1, j - 1, i2)) {
            return l;
          }

          if (l < 4) {
            int j2 = this.b(world, l1, j, i2, l + 1, k1);

            if (j2 < j1) {
              j1 = j2;
            }
          }
        }
      }
    }

    return j1;
  }
コード例 #6
0
ファイル: WorldGenSwampTree.java プロジェクト: plleg/mc-dev
  public boolean a(World world, Random random, int i, int j, int k) {
    int l;

    for (l = random.nextInt(4) + 5; world.getMaterial(i, j - 1, k) == Material.WATER; --j) {;
    }

    boolean flag = true;

    if (j >= 1 && j + l + 1 <= 128) {
      int i1;
      int j1;
      int k1;
      int l1;

      for (i1 = j; i1 <= j + 1 + l; ++i1) {
        byte b0 = 1;

        if (i1 == j) {
          b0 = 0;
        }

        if (i1 >= j + 1 + l - 2) {
          b0 = 3;
        }

        for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
          for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
            if (i1 >= 0 && i1 < 128) {
              l1 = world.getTypeId(j1, i1, k1);
              if (l1 != 0 && l1 != Block.LEAVES.id) {
                if (l1 != Block.STATIONARY_WATER.id && l1 != Block.WATER.id) {
                  flag = false;
                } else if (i1 > j) {
                  flag = false;
                }
              }
            } else {
              flag = false;
            }
          }
        }
      }

      if (!flag) {
        return false;
      } else {
        i1 = world.getTypeId(i, j - 1, k);
        if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
          this.setType(world, i, j - 1, k, Block.DIRT.id);

          int i2;
          int j2;

          for (j2 = j - 3 + l; j2 <= j + l; ++j2) {
            j1 = j2 - (j + l);
            k1 = 2 - j1 / 2;

            for (l1 = i - k1; l1 <= i + k1; ++l1) {
              i2 = l1 - i;

              for (int k2 = k - k1; k2 <= k + k1; ++k2) {
                int l2 = k2 - k;

                if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0)
                    && !Block.q[world.getTypeId(l1, j2, k2)]) {
                  this.setType(world, l1, j2, k2, Block.LEAVES.id);
                }
              }
            }
          }

          for (j2 = 0; j2 < l; ++j2) {
            j1 = world.getTypeId(i, j + j2, k);
            if (j1 == 0
                || j1 == Block.LEAVES.id
                || j1 == Block.WATER.id
                || j1 == Block.STATIONARY_WATER.id) {
              this.setType(world, i, j + j2, k, Block.LOG.id);
            }
          }

          for (j2 = j - 3 + l; j2 <= j + l; ++j2) {
            j1 = j2 - (j + l);
            k1 = 2 - j1 / 2;

            for (l1 = i - k1; l1 <= i + k1; ++l1) {
              for (i2 = k - k1; i2 <= k + k1; ++i2) {
                if (world.getTypeId(l1, j2, i2) == Block.LEAVES.id) {
                  if (random.nextInt(4) == 0 && world.getTypeId(l1 - 1, j2, i2) == 0) {
                    this.b(world, l1 - 1, j2, i2, 8);
                  }

                  if (random.nextInt(4) == 0 && world.getTypeId(l1 + 1, j2, i2) == 0) {
                    this.b(world, l1 + 1, j2, i2, 2);
                  }

                  if (random.nextInt(4) == 0 && world.getTypeId(l1, j2, i2 - 1) == 0) {
                    this.b(world, l1, j2, i2 - 1, 1);
                  }

                  if (random.nextInt(4) == 0 && world.getTypeId(l1, j2, i2 + 1) == 0) {
                    this.b(world, l1, j2, i2 + 1, 4);
                  }
                }
              }
            }
          }

          return true;
        } else {
          return false;
        }
      }
    } else {
      return false;
    }
  }
コード例 #7
0
ファイル: BlockFlowing.java プロジェクト: ymsquall/mc-dev
  public void a(World world, int i, int j, int k, Random random) {
    int l = this.g(world, i, j, k);
    byte b0 = 1;

    if (this.material == Material.LAVA && !world.m.d) {
      b0 = 2;
    }

    boolean flag = true;
    int i1;

    if (l > 0) {
      byte b1 = -100;

      this.a = 0;
      int j1 = this.e(world, i - 1, j, k, b1);

      j1 = this.e(world, i + 1, j, k, j1);
      j1 = this.e(world, i, j, k - 1, j1);
      j1 = this.e(world, i, j, k + 1, j1);
      i1 = j1 + b0;
      if (i1 >= 8 || j1 < 0) {
        i1 = -1;
      }

      if (this.g(world, i, j + 1, k) >= 0) {
        int k1 = this.g(world, i, j + 1, k);

        if (k1 >= 8) {
          i1 = k1;
        } else {
          i1 = k1 + 8;
        }
      }

      if (this.a >= 2 && this.material == Material.WATER) {
        if (world.d(i, j - 1, k)) {
          i1 = 0;
        } else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j, k) == 0) {
          i1 = 0;
        }
      }

      if (this.material == Material.LAVA && l < 8 && i1 < 8 && i1 > l && random.nextInt(4) != 0) {
        i1 = l;
        flag = false;
      }

      if (i1 != l) {
        l = i1;
        if (i1 < 0) {
          world.e(i, j, k, 0);
        } else {
          world.c(i, j, k, i1);
          world.c(i, j, k, this.id, this.b());
          world.h(i, j, k, this.id);
        }
      } else if (flag) {
        this.i(world, i, j, k);
      }
    } else {
      this.i(world, i, j, k);
    }

    if (this.l(world, i, j - 1, k)) {
      if (l >= 8) {
        world.b(i, j - 1, k, this.id, l);
      } else {
        world.b(i, j - 1, k, this.id, l + 8);
      }
    } else if (l >= 0 && (l == 0 || this.k(world, i, j - 1, k))) {
      boolean[] aboolean = this.j(world, i, j, k);

      i1 = l + b0;
      if (l >= 8) {
        i1 = 1;
      }

      if (i1 >= 8) {
        return;
      }

      if (aboolean[0]) {
        this.f(world, i - 1, j, k, i1);
      }

      if (aboolean[1]) {
        this.f(world, i + 1, j, k, i1);
      }

      if (aboolean[2]) {
        this.f(world, i, j, k - 1, i1);
      }

      if (aboolean[3]) {
        this.f(world, i, j, k + 1, i1);
      }
    }
  }