Пример #1
0
  private void d(World world, int i, int j, int k, int l) {
    int i1 = 0;

    while (i1 < 2) {
      int j1 = 1;

      while (true) {
        if (j1 < 42) {
          int k1 = i + Direction.a[i1] * j1;
          int l1 = k + Direction.b[i1] * j1;
          int i2 = world.getTypeId(k1, j, l1);

          if (i2 == Block.TRIPWIRE_SOURCE.id) {
            int j2 = world.getData(k1, j, l1) & 3;

            if (j2 == Direction.f[i1]) {
              Block.TRIPWIRE_SOURCE.a(world, k1, j, l1, i2, world.getData(k1, j, l1), true, j1, l);
            }
          } else if (i2 == Block.TRIPWIRE.id) {
            ++j1;
            continue;
          }
        }

        ++i1;
        break;
      }
    }
  }
Пример #2
0
  private boolean g(World world, int i, int j, int k) {
    int l = world.getData(i, j, k);
    int i1 = l;

    if (l > 0) {
      for (int j1 = 0; j1 <= 3; ++j1) {
        int k1 = 1 << j1;

        if ((l & k1) != 0
            && !this.c(world.getTypeId(i + Direction.a[j1], j, k + Direction.b[j1]))
            && (world.getTypeId(i, j + 1, k) != this.id
                || (world.getData(i, j + 1, k) & k1) == 0)) {
          i1 &= ~k1;
        }
      }
    }

    if (i1 == 0 && !this.c(world.getTypeId(i, j + 1, k))) {
      return false;
    } else {
      if (i1 != l) {
        world.setData(i, j, k, i1);
      }

      return true;
    }
  }
Пример #3
0
  private void i(World world, int i, int j, int k) {
    int l = world.getData(i, j, k);

    world.setTypeIdAndData(i, j, k, this.id + 1, l);
    world.b(i, j, k, i, j, k);
    world.g(i, j, k);
  }
Пример #4
0
 public void a(World world, int i, int j, int k, Entity entity) {
   if (!world.isStatic) {
     if ((world.getData(i, j, k) & 1) != 1) {
       this.k(world, i, j, k);
     }
   }
 }
Пример #5
0
 public void a(World world, int i, int j, int k, Random random) {
   if (!world.isStatic) {
     if ((world.getData(i, j, k) & 1) == 1) {
       this.k(world, i, j, k);
     }
   }
 }
Пример #6
0
  public void doMegaImpact(
      EntityHuman ply, ItemStack var2, int var3, int var4, int var5, double var6) {
    World var1 = ply.world;
    cleanDroplist(var2);
    for (int var8 = -1; var8 <= 1; var8++) {
      for (int var9 = -1; var9 <= 1; var9++) {
        int var10 = var3;
        int var11 = var4;
        int var12 = var5;
        if (var8 != 0 || var9 != 0) {
          if (var6 != 0.0D && var6 != 1.0D) {
            if (var6 != 2D && var6 != 4D) {
              if (var6 == 3D || var6 == 5D) {
                var11 = var4 + var8;
                var12 = var5 + var9;
              }
            } else {
              var10 = var3 + var8;
              var11 = var4 + var9;
            }
          } else {
            var10 = var3 + var8;
            var12 = var5 + var9;
          }
          int var13 = var1.getTypeId(var10, var11, var12);
          int var14 = var1.getData(var10, var11, var12);
          if (canBreak(var13, var14) && attemptBreak(ply, var10, var11, var12))
            scanBlockAndBreak(var1, var2, var10, var11, var12);
        }
      }
    }

    ejectDropList(var1, var2, var3, (double) var4 + 0.5D, var5);
  }
Пример #7
0
  public int p() {
    if (g == -1) {
      g = world.getData(x, y, z);
    }

    return g;
  }
Пример #8
0
 public void a(World world, int i, int j, int k, Random random) {
   if (!world.isStatic) {
     if (world.getData(i, j, k) != 0) {
       this.g(world, i, j, k);
     }
   }
 }
Пример #9
0
  /** Ticks the block if it's been scheduled */
  public void b(World var1, int var2, int var3, int var4, Random var5) {
    super.b(var1, var2, var3, var4, var5);

    if (var1.getLightLevel(var2, var3 + 1, var4) >= 9) {
      float var6 = this.n(var1, var2, var3, var4);

      if (var5.nextInt((int) (25.0F / var6) + 1) == 0) {
        int var7 = var1.getData(var2, var3, var4);

        if (var7 < 7) {
          ++var7;
          var1.setData(var2, var3, var4, var7);
        } else {
          if (var1.getTypeId(var2 - 1, var3, var4) == this.blockFruit.id) {
            return;
          }

          if (var1.getTypeId(var2 + 1, var3, var4) == this.blockFruit.id) {
            return;
          }

          if (var1.getTypeId(var2, var3, var4 - 1) == this.blockFruit.id) {
            return;
          }

          if (var1.getTypeId(var2, var3, var4 + 1) == this.blockFruit.id) {
            return;
          }

          int var8 = var5.nextInt(4);
          int var9 = var2;
          int var10 = var4;

          if (var8 == 0) {
            var9 = var2 - 1;
          }

          if (var8 == 1) {
            ++var9;
          }

          if (var8 == 2) {
            var10 = var4 - 1;
          }

          if (var8 == 3) {
            ++var10;
          }

          int var11 = var1.getTypeId(var9, var3 - 1, var10);

          if (var1.getTypeId(var9, var3, var10) == 0
              && (var11 == Block.SOIL.id || var11 == Block.DIRT.id || var11 == Block.GRASS.id)) {
            var1.setTypeId(var9, var3, var10, this.blockFruit.id);
          }
        }
      }
    }
  }
Пример #10
0
  public void a(World world, int i, int j, int k, Random random) {
    super.a(world, i, j, k, random);
    if (world.getLightLevel(i, j + 1, k) >= 9) {
      float f = this.i(world, i, j, k);

      if (random.nextInt((int) (25.0F / f) + 1) == 0) {
        int l = world.getData(i, j, k);

        if (l < 7) {
          ++l;
          CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, l); // CraftBukkit
        } else {
          if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
            return;
          }

          if (world.getTypeId(i + 1, j, k) == this.blockFruit.id) {
            return;
          }

          if (world.getTypeId(i, j, k - 1) == this.blockFruit.id) {
            return;
          }

          if (world.getTypeId(i, j, k + 1) == this.blockFruit.id) {
            return;
          }

          int i1 = random.nextInt(4);
          int j1 = i;
          int k1 = k;

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

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

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

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

          int l1 = world.getTypeId(j1, j - 1, k1);

          if (world.getTypeId(j1, j, k1) == 0
              && (l1 == Block.SOIL.id || l1 == Block.DIRT.id || l1 == Block.GRASS.id)) {
            CraftEventFactory.handleBlockGrowEvent(
                world, j1, j, k1, this.blockFruit.id, 0); // CraftBukkit
          }
        }
      }
    }
  }
Пример #11
0
  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
  }
Пример #12
0
  public int getPower(World world, int i, int j, int k, int l) {
    if (world.getTypeId(i, j, k) != this.id) {
      return l;
    }
    int i1 = world.getData(i, j, k);

    return i1 > l ? i1 : l;
  }
Пример #13
0
 private boolean m(World world, int i, int j, int k) {
   if (!this.canPlace(world, i, j, k)) {
     this.b(world, i, j, k, world.getData(i, j, k), 0);
     world.setAir(i, j, k);
     return false;
   } else {
     return true;
   }
 }
Пример #14
0
  public void grow(World world, int i, int j, int k, Random random) {
    int l = world.getData(i, j, k);

    if ((l & 8) == 0) {
      world.setData(i, j, k, l | 8, 4);
    } else {
      this.d(world, i, j, k, random);
    }
  }
Пример #15
0
  public void doPhysics(World world, int i, int j, int k, int l) {
    int i1 = world.getData(i, j, k);
    boolean flag = (i1 & 2) == 2;
    boolean flag1 = !world.w(i, j - 1, k);

    if (flag != flag1) {
      this.c(world, i, j, k, i1, 0);
      world.setAir(i, j, k);
    }
  }
Пример #16
0
  public void a(World world, int i, int j, int k, Random random) {
    int l = world.getData(i, j, k);

    if (l < 3 && random.nextInt(10) == 0) {
      org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(
          world, i, j, k, this.id, ++l); // CraftBukkit
    }

    super.a(world, i, j, k, random);
  }
Пример #17
0
  public void remove(World world, int i, int j, int k) {
    int l = world.getData(i, j, k);

    if (l > 0) {
      world.applyPhysics(i, j, k, this.id);
      world.applyPhysics(i, j - 1, k, this.id);
    }

    super.remove(world, i, j, k);
  }
Пример #18
0
  public boolean canPlace(World world, int i, int j, int k) {
    Block block = world.getType(i, j - 1, k);

    return block != Blocks.ICE && block != Blocks.PACKED_ICE
        ? (block.getMaterial() == Material.LEAVES
            ? true
            : (block == this && (world.getData(i, j - 1, k) & 7) == 7
                ? true
                : block.c() && block.material.isSolid()))
        : false;
  }
Пример #19
0
  public void scanBlockAndBreak(World var1, ItemStack var2, int var3, int var4, int var5) {
    int var6 = var1.getTypeId(var3, var4, var5);
    int var7 = var1.getData(var3, var4, var5);
    ArrayList var8 = Block.byId[var6].getBlockDropped(var1, var3, var4, var5, var7, 0);
    ItemStack var10;
    for (Iterator var9 = var8.iterator(); var9.hasNext(); addToDroplist(var2, var10))
      var10 = (ItemStack) var9.next();

    var1.setTypeId(var3, var4, var5, 0);
    if (var1.random.nextInt(8) == 0) var1.a("largesmoke", var3, var4, var5, 0.0D, 0.0D, 0.0D);
    if (var1.random.nextInt(8) == 0) var1.a("explode", var3, var4, var5, 0.0D, 0.0D, 0.0D);
  }
Пример #20
0
  public void doPhysics(World world, int i, int j, int k, int l) {
    boolean flag = false;

    if (!world.e(i, j - 1, k) && world.getTypeId(i, j - 1, k) != Block.FENCE.id) {
      flag = true;
    }

    if (flag) {
      this.b(world, i, j, k, world.getData(i, j, k), 0);
      world.setTypeId(i, j, k, 0);
    }
  }
Пример #21
0
 public void update() {
   if (world != null) {
     g = world.getData(x, y, z);
     world.b(x, y, z, this);
     if (q() != Blocks.AIR) {
       world.updateAdjacentComparators(x, y, z, q());
     }
     // Spigot start - Called when the contents have changed, so hoppers around this
     // tile need updating.
     scheduleTicks();
     // Spigot end
   }
 }
Пример #22
0
  private void l(World world, int i, int j, int k) {
    // CraftBukkit start
    LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
    world.getServer().getPluginManager().callEvent(event);

    if (event.isCancelled()) {
      return;
    }
    // CraftBukkit end

    this.c(world, i, j, k, world.getData(i, j, k), 0);
    world.setTypeId(i, j, k, 0);
  }
Пример #23
0
  public AxisAlignedBB a(World world, int i, int j, int k) {
    int l = world.getData(i, j, k) & 7;
    float f = 0.125F;

    return AxisAlignedBB.a()
        .a(
            (double) i + this.minX,
            (double) j + this.minY,
            (double) k + this.minZ,
            (double) i + this.maxX,
            (double) ((float) j + (float) l * f),
            (double) k + this.maxZ);
  }
Пример #24
0
  public AxisAlignedBB e(World world, int i, int j, int k) {
    int l = world.getData(i, j, k) & 7;

    return l >= 3
        ? AxisAlignedBB.a()
            .a(
                (double) i + this.minX,
                (double) j + this.minY,
                (double) k + this.minZ,
                (double) i + this.maxX,
                (double) ((float) j + 0.5F),
                (double) k + this.maxZ)
        : null;
  }
Пример #25
0
  public void a(World world, int i, int j, int k, Random random) {
    if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) {
      // CraftBukkit start
      if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(
              world.getWorld().getBlockAt(i, j, k), Blocks.AIR)
          .isCancelled()) {
        return;
      }
      // CraftBukkit end

      this.b(world, i, j, k, world.getData(i, j, k), 0);
      world.setAir(i, j, k);
    }
  }
Пример #26
0
  public boolean interactWith(
      ItemStack var1, EntityHuman var2, World var3, int var4, int var5, int var6, int var7) {
    if (EEProxy.isClient(var3)) return false;
    boolean var8 = true;
    if (chargeLevel(var1) > 0) {
      cleanDroplist(var1);
      var2.C_();
      var3.makeSound(var2, "flash", 0.8F, 1.5F);
      for (int var9 = -(chargeLevel(var1) * (var7 != 5 ? (byte) (var7 != 4 ? 1 : 0) : 2));
          var9 <= chargeLevel(var1) * (var7 != 5 ? var7 != 4 ? 1 : 2 : 0);
          var9++) {
        for (int var10 = -(chargeLevel(var1) * (var7 != 1 ? (byte) (var7 != 0 ? 1 : 0) : 2));
            var10 <= chargeLevel(var1) * (var7 != 1 ? var7 != 0 ? 1 : 2 : 0);
            var10++) {
          for (int var11 = -(chargeLevel(var1) * (var7 != 3 ? (byte) (var7 != 2 ? 1 : 0) : 2));
              var11 <= chargeLevel(var1) * (var7 != 3 ? var7 != 2 ? 1 : 2 : 0);
              var11++) {
            int var12 = var4 + var9;
            int var13 = var5 + var10;
            int var14 = var6 + var11;
            int var15 = var3.getTypeId(var12, var13, var14);
            int var16 = var3.getData(var12, var13, var14);
            if (canBreak(var15, var16) && attemptBreak(var2, var12, var13, var14)) {
              if (getFuelRemaining(var1) < 1) {
                ConsumeReagent(var1, var2, var8);
                var8 = false;
              }
              if (getFuelRemaining(var1) > 0) {
                ArrayList var17 =
                    Block.byId[var15].getBlockDropped(var3, var12, var13, var14, var16, 0);
                ItemStack var19;
                for (Iterator var18 = var17.iterator(); var18.hasNext(); addToDroplist(var1, var19))
                  var19 = (ItemStack) var18.next();

                var3.setTypeId(var12, var13, var14, 0);
                if (var3.random.nextInt(8) == 0)
                  var3.a("largesmoke", var12, var13, var14, 0.0D, 0.0D, 0.0D);
                if (var3.random.nextInt(8) == 0)
                  var3.a("explode", var12, var13, var14, 0.0D, 0.0D, 0.0D);
                setShort(var1, "fuelRemaining", getFuelRemaining(var1) - 1);
              }
            }
          }
        }
      }

      ejectDropList(var3, var1, var4, var5, var6);
    }
    return false;
  }
Пример #27
0
  public void a(World world, int i, int j, int k, boolean flag) {
    int l = world.getData(i, j, k);

    if ((l & 8) != 0) {
      if (world.getTypeId(i, j - 1, k) == this.id) {
        this.a(world, i, j - 1, k, flag);
      }
    } else {
      boolean flag1 = (world.getData(i, j, k) & 4) > 0;

      if (flag1 != flag) {
        if (world.getTypeId(i, j + 1, k) == this.id) {
          world.c(i, j + 1, k, (l ^ 4) + 8);
        }

        world.c(i, j, k, l ^ 4);
        world.b(i, j - 1, k, i, j, k);
        if (Math.random() < 0.5D) {
          world.a(
              (double) i + 0.5D,
              (double) j + 0.5D,
              (double) k + 0.5D,
              "random.door_open",
              1.0F,
              world.k.nextFloat() * 0.1F + 0.9F);
        } else {
          world.a(
              (double) i + 0.5D,
              (double) j + 0.5D,
              (double) k + 0.5D,
              "random.door_close",
              1.0F,
              world.k.nextFloat() * 0.1F + 0.9F);
        }
      }
    }
  }
Пример #28
0
  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;
  }
Пример #29
0
  public void doPhysics(World world, int i, int j, int k, int l) {
    if (!world.isStatic) {
      int i1 = world.getData(i, j, k);
      boolean flag = canPlace(world, i, j, k);

      if (flag) {
        l(world, i, j, k);
      } else {
        c(world, i, j, k, i1, 0);
        world.setTypeId(i, j, k, 0);
      }

      super.doPhysics(world, i, j, k, l);
    }
  }
Пример #30
0
  private void f(World world, int i, int j, int k, int l) {
    if (this.l(world, i, j, k)) {
      int i1 = world.getTypeId(i, j, k);

      if (i1 > 0) {
        if (this.material == Material.LAVA) {
          this.h(world, i, j, k);
        } else {
          Block.byId[i1].a_(world, i, j, k, world.getData(i, j, k));
        }
      }

      world.b(i, j, k, this.id, l);
    }
  }