예제 #1
0
  public EntityWeatherLighting(World world, double d0, double d1, double d2) {
    super(world);
    this.setPositionRotation(d0, d1, d2, 0.0F, 0.0F);
    this.lifeTicks = 2;
    this.a = this.random.nextLong();
    this.c = this.random.nextInt(3) + 1;
    if (world.difficulty >= 2
        && world.areChunksLoaded(
            MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
      int i = MathHelper.floor(d0);
      int j = MathHelper.floor(d1);
      int k = MathHelper.floor(d2);

      if (world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(world, i, j, k)) {
        world.setTypeId(i, j, k, Block.FIRE.id);
      }

      for (i = 0; i < 4; ++i) {
        j = MathHelper.floor(d0) + this.random.nextInt(3) - 1;
        k = MathHelper.floor(d1) + this.random.nextInt(3) - 1;
        int l = MathHelper.floor(d2) + this.random.nextInt(3) - 1;

        if (world.getTypeId(j, k, l) == 0 && Block.FIRE.canPlace(world, j, k, l)) {
          world.setTypeId(j, k, l, Block.FIRE.id);
        }
      }
    }
  }
예제 #2
0
  private void g(World world, int i, int j, int k) {
    if (!world.isStatic) {
      int l = world.getTypeId(i, j, k - 1);
      int i1 = world.getTypeId(i, j, k + 1);
      int j1 = world.getTypeId(i - 1, j, k);
      int k1 = world.getTypeId(i + 1, j, k);
      byte b0 = 3;

      if (Block.n[l] && !Block.n[i1]) {
        b0 = 3;
      }

      if (Block.n[i1] && !Block.n[l]) {
        b0 = 2;
      }

      if (Block.n[j1] && !Block.n[k1]) {
        b0 = 5;
      }

      if (Block.n[k1] && !Block.n[j1]) {
        b0 = 4;
      }

      world.setData(i, j, k, b0);
    }
  }
예제 #3
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;
    }
  }
예제 #4
0
파일: ItemHoe.java 프로젝트: fouram/mc-dev
  public boolean a(
      ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
    if (!entityhuman.c(i, j, k)) {
      return false;
    } else {
      int i1 = world.getTypeId(i, j, k);
      int j1 = world.getTypeId(i, j + 1, k);

      if ((l == 0 || j1 != 0 || i1 != Block.GRASS.id) && i1 != Block.DIRT.id) {
        return false;
      } else {
        Block block = Block.SOIL;

        world.makeSound(
            (double) ((float) i + 0.5F),
            (double) ((float) j + 0.5F),
            (double) ((float) k + 0.5F),
            block.stepSound.getName(),
            (block.stepSound.getVolume1() + 1.0F) / 2.0F,
            block.stepSound.getVolume2() * 0.8F);
        if (world.isStatic) {
          return true;
        } else {
          world.setTypeId(i, j, k, block.id);
          itemstack.damage(1, entityhuman);
          return true;
        }
      }
    }
  }
예제 #5
0
  public boolean canPlace(World world, int i, int j, int k) {
    int l = 0;

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

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

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

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

    return l > 1
        ? false
        : (this.g(world, i - 1, j, k)
            ? false
            : (this.g(world, i + 1, j, k)
                ? false
                : (this.g(world, i, j, k - 1) ? false : !this.g(world, i, j, k + 1))));
  }
예제 #6
0
 private boolean g(World world, int i, int j, int k) {
   return world.getTypeId(i, j, k) != this.id
       ? false
       : (world.getTypeId(i - 1, j, k) == this.id
           ? true
           : (world.getTypeId(i + 1, j, k) == this.id
               ? true
               : (world.getTypeId(i, j, k - 1) == this.id
                   ? true
                   : world.getTypeId(i, j, k + 1) == this.id)));
 }
예제 #7
0
  public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
    int l = world.getTypeId(i, j, k - 1);
    int i1 = world.getTypeId(i, j, k + 1);
    int j1 = world.getTypeId(i - 1, j, k);
    int k1 = world.getTypeId(i + 1, j, k);
    byte b0 = 0;
    int l1 = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;

    if (l1 == 0) {
      b0 = 2;
    }

    if (l1 == 1) {
      b0 = 5;
    }

    if (l1 == 2) {
      b0 = 3;
    }

    if (l1 == 3) {
      b0 = 4;
    }

    if (l != this.id && i1 != this.id && j1 != this.id && k1 != this.id) {
      world.setData(i, j, k, b0);
    } else {
      if ((l == this.id || i1 == this.id) && (b0 == 4 || b0 == 5)) {
        if (l == this.id) {
          world.setData(i, j, k - 1, b0);
        } else {
          world.setData(i, j, k + 1, b0);
        }

        world.setData(i, j, k, b0);
      }

      if ((j1 == this.id || k1 == this.id) && (b0 == 2 || b0 == 3)) {
        if (j1 == this.id) {
          world.setData(i - 1, j, k, b0);
        } else {
          world.setData(i + 1, j, k, b0);
        }

        world.setData(i, j, k, b0);
      }
    }
  }
예제 #8
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;
      }
    }
  }
예제 #9
0
 /**
  * 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;
 }
예제 #10
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);
  }
예제 #11
0
  public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
    Object object = (TileEntityChest) world.getTileEntity(i, j, k);

    if (object == null) {
      return true;
    } else if (world.e(i, j + 1, k)) {
      return true;
    } else if (world.getTypeId(i - 1, j, k) == this.id && world.e(i - 1, j + 1, k)) {
      return true;
    } else if (world.getTypeId(i + 1, j, k) == this.id && world.e(i + 1, j + 1, k)) {
      return true;
    } else if (world.getTypeId(i, j, k - 1) == this.id && world.e(i, j + 1, k - 1)) {
      return true;
    } else if (world.getTypeId(i, j, k + 1) == this.id && world.e(i, j + 1, k + 1)) {
      return true;
    } else {
      if (world.getTypeId(i - 1, j, k) == this.id) {
        object =
            new InventoryLargeChest(
                "Large chest",
                (TileEntityChest) world.getTileEntity(i - 1, j, k),
                (IInventory) object);
      }

      if (world.getTypeId(i + 1, j, k) == this.id) {
        object =
            new InventoryLargeChest(
                "Large chest",
                (IInventory) object,
                (TileEntityChest) world.getTileEntity(i + 1, j, k));
      }

      if (world.getTypeId(i, j, k - 1) == this.id) {
        object =
            new InventoryLargeChest(
                "Large chest",
                (TileEntityChest) world.getTileEntity(i, j, k - 1),
                (IInventory) object);
      }

      if (world.getTypeId(i, j, k + 1) == this.id) {
        object =
            new InventoryLargeChest(
                "Large chest",
                (IInventory) object,
                (TileEntityChest) world.getTileEntity(i, j, k + 1));
      }

      if (world.isStatic) {
        return true;
      } else {
        entityhuman.a((IInventory) object);
        return true;
      }
    }
  }
예제 #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
  public boolean f(World world, int i, int j, int k) {
    if (j >= 0 && j < world.height) {
      int l = world.getTypeId(i, j - 1, k);

      return l == Block.MYCEL.id || world.k(i, j, k) < 13 && this.d(l);
    } else {
      return false;
    }
  }
예제 #14
0
  public void a(World world, int i, int j, int k, Random random) {
    if (random.nextInt(25) == 0) {
      byte b0 = 4;
      int l = 5;

      int i1;
      int j1;
      int k1;

      for (i1 = i - b0; i1 <= i + b0; ++i1) {
        for (j1 = k - b0; j1 <= k + b0; ++j1) {
          for (k1 = j - 1; k1 <= j + 1; ++k1) {
            if (world.getTypeId(i1, k1, j1) == this.id) {
              --l;
              if (l <= 0) {
                return;
              }
            }
          }
        }
      }

      i1 = i + random.nextInt(3) - 1;
      j1 = j + random.nextInt(2) - random.nextInt(2);
      k1 = k + random.nextInt(3) - 1;

      for (int l1 = 0; l1 < 4; ++l1) {
        if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
          i = i1;
          j = j1;
          k = k1;
        }

        i1 = i + random.nextInt(3) - 1;
        j1 = j + random.nextInt(2) - random.nextInt(2);
        k1 = k + random.nextInt(3) - 1;
      }

      if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
        // lightstone start
        org.bukkit.World bworld = world.getWorld();
        org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
        blockState.setTypeId(this.id);

        BlockSpreadEvent event =
            new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
        world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
          blockState.update(true);
        }
        // lightstone end
      }
    }
  }
예제 #15
0
  private static boolean ObjectCanSpawn(World world, int x, int y, int z, CustomObject obj) {
    if ((world.getTypeId(x, y - 5, z) == 0) && (obj.needsFoundation)) return false;

    boolean abort = false;
    int checkBlock = world.getTypeId(x, y + 2, z);
    if (!obj.spawnWater)
      abort = ((checkBlock == Block.WATER.id) || (checkBlock == Block.STATIONARY_WATER.id));
    if (!obj.spawnLava)
      abort = ((checkBlock == Block.LAVA.id) || (checkBlock == Block.STATIONARY_LAVA.id));

    checkBlock = world.getLightLevel(x, y + 2, z);
    if (!obj.spawnSunlight) abort = (checkBlock > 8);
    if (!obj.spawnDarkness) abort = (checkBlock < 9);

    if ((y < obj.spawnElevationMin) || (y > obj.spawnElevationMax)) abort = true;

    if (!obj.spawnOnBlockType.contains(world.getTypeId(x, y - 1, z))) abort = true;

    return !abort;
  }
예제 #16
0
 private void n(World world, int i, int j, int k) {
   if (world.getTypeId(i, j, k) == this.id) {
     world.applyPhysics(i, j, k, this.id);
     world.applyPhysics(i - 1, j, k, this.id);
     world.applyPhysics(i + 1, j, k, this.id);
     world.applyPhysics(i, j, k - 1, this.id);
     world.applyPhysics(i, j, k + 1, this.id);
     world.applyPhysics(i, j - 1, k, this.id);
     world.applyPhysics(i, j + 1, k, this.id);
   }
 }
예제 #17
0
  public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
    if (this.material == Material.ORE) {
      return true;
    } else {
      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, entityhuman);
        }

        return true;
      } else {
        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);
        }

        return true;
      }
    }
  }
예제 #18
0
  private float n(World var1, int var2, int var3, int var4) {
    float var5 = 1.0F;
    int var6 = var1.getTypeId(var2, var3, var4 - 1);
    int var7 = var1.getTypeId(var2, var3, var4 + 1);
    int var8 = var1.getTypeId(var2 - 1, var3, var4);
    int var9 = var1.getTypeId(var2 + 1, var3, var4);
    int var10 = var1.getTypeId(var2 - 1, var3, var4 - 1);
    int var11 = var1.getTypeId(var2 + 1, var3, var4 - 1);
    int var12 = var1.getTypeId(var2 + 1, var3, var4 + 1);
    int var13 = var1.getTypeId(var2 - 1, var3, var4 + 1);
    boolean var14 = var8 == this.id || var9 == this.id;
    boolean var15 = var6 == this.id || var7 == this.id;
    boolean var16 = var10 == this.id || var11 == this.id || var12 == this.id || var13 == this.id;

    for (int var17 = var2 - 1; var17 <= var2 + 1; ++var17) {
      for (int var18 = var4 - 1; var18 <= var4 + 1; ++var18) {
        int var19 = var1.getTypeId(var17, var3 - 1, var18);
        float var20 = 0.0F;

        if (var19 == Block.SOIL.id) {
          var20 = 1.0F;

          if (var1.getData(var17, var3 - 1, var18) > 0) {
            var20 = 3.0F;
          }
        }

        if (var17 != var2 || var18 != var4) {
          var20 /= 4.0F;
        }

        var5 += var20;
      }
    }

    if (var16 || var14 && var15) {
      var5 /= 2.0F;
    }

    return var5;
  }
예제 #19
0
  public boolean canPlace(World world, int i, int j, int k, int l) {
    switch (l) {
      case 1:
        return this.c(world.getTypeId(i, j + 1, k));

      case 2:
        return this.c(world.getTypeId(i, j, k + 1));

      case 3:
        return this.c(world.getTypeId(i, j, k - 1));

      case 4:
        return this.c(world.getTypeId(i + 1, j, k));

      case 5:
        return this.c(world.getTypeId(i - 1, j, k));

      default:
        return false;
    }
  }
예제 #20
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);
  }
예제 #21
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);
    }
  }
예제 #22
0
  public boolean interactWith(
      ItemStack itemstack,
      EntityHuman entityhuman,
      World world,
      int i,
      int j,
      int k,
      int l,
      float f,
      float f1,
      float f2) {
    if (world.getTypeId(i, j, k) != Block.SNOW.id) {
      if (l == 0) {
        --j;
      }

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

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

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

      if (l == 4) {
        --i;
      }

      if (l == 5) {
        ++i;
      }

      if (!world.isEmpty(i, j, k)) {
        return false;
      }
    }

    if (!entityhuman.a(i, j, k, l, itemstack)) {
      return false;
    } else {
      if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
        --itemstack.count;
        world.setTypeIdUpdate(i, j, k, Block.REDSTONE_WIRE.id);
      }

      return true;
    }
  }
예제 #23
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);
          }
        }
      }
    }
  }
예제 #24
0
  public void a(World world, int i, int j, int k, Random random) {
    if (!world.isStatic) {
      if (world.getLightLevel(i, j + 1, k) < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) {
        if (random.nextInt(4) != 0) {
          return;
        }

        world.setTypeId(i, j, k, Block.DIRT.id);
      } else if (world.getLightLevel(i, j + 1, k) >= 9) {
        int l = i + random.nextInt(3) - 1;
        int i1 = j + random.nextInt(5) - 3;
        int j1 = k + random.nextInt(3) - 1;
        int k1 = world.getTypeId(l, i1 + 1, j1);

        if (world.getTypeId(l, i1, j1) == Block.DIRT.id
            && world.getLightLevel(l, i1 + 1, j1) >= 4
            && Block.q[k1] <= 2) {
          world.setTypeId(l, i1, j1, Block.GRASS.id);
        }
      }
    }
  }
예제 #25
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
          }
        }
      }
    }
  }
예제 #26
0
  public void a(World world, int i, int j, int k, int l) {
    int i1 = world.getData(i, j, k);

    if ((i1 & 8) != 0) {
      if (world.getTypeId(i, j - 1, k) != this.id) {
        world.e(i, j, k, 0);
      }

      if (l > 0 && Block.byId[l].c()) {
        this.a(world, i, j - 1, k, l);
      }
    } else {
      boolean flag = false;

      if (world.getTypeId(i, j + 1, k) != this.id) {
        world.e(i, j, k, 0);
        flag = true;
      }

      if (!world.d(i, j - 1, k)) {
        world.e(i, j, k, 0);
        flag = true;
        if (world.getTypeId(i, j + 1, k) == this.id) {
          world.e(i, j + 1, k, 0);
        }
      }

      if (flag) {
        if (!world.isStatic) {
          this.a_(world, i, j, k, i1);
        }
      } else if (l > 0 && Block.byId[l].c()) {
        boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k);

        this.a(world, i, j, k, flag1);
      }
    }
  }
예제 #27
0
  private void b(World world, int i, int j, int k, int l) {
    this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
    int i1 = 4;

    while (true) {
      --j;
      if (world.getTypeId(i, j, k) != 0 || i1 <= 0) {
        return;
      }

      this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
      --i1;
    }
  }
예제 #28
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;
  }
예제 #29
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);
        }
      }
    }
  }
예제 #30
0
  public void a(World world, int i, int j, int k) {
    super.a(world, i, j, k);
    this.b(world, i, j, k);
    int l = world.getTypeId(i, j, k - 1);
    int i1 = world.getTypeId(i, j, k + 1);
    int j1 = world.getTypeId(i - 1, j, k);
    int k1 = world.getTypeId(i + 1, j, k);

    if (l == this.id) {
      this.b(world, i, j, k - 1);
    }

    if (i1 == this.id) {
      this.b(world, i, j, k + 1);
    }

    if (j1 == this.id) {
      this.b(world, i - 1, j, k);
    }

    if (k1 == this.id) {
      this.b(world, i + 1, j, k);
    }
  }