Пример #1
0
  protected void a(double d0, boolean flag) {
    if (!this.M()) {
      this.N();
    }

    if (flag && this.fallDistance > 0.0F) {
      int i = MathHelper.floor(this.locX);
      int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
      int k = MathHelper.floor(this.locZ);
      Block block = this.world.getType(i, j, k);

      if (block.getMaterial() == Material.AIR) {
        int l = this.world.getType(i, j - 1, k).b();

        if (l == 11 || l == 32 || l == 21) {
          block = this.world.getType(i, j - 1, k);
        }
      } else if (!this.world.isStatic && this.fallDistance > 3.0F) {
        this.world.triggerEffect(2006, i, j, k, MathHelper.f(this.fallDistance - 3.0F));
      }

      block.a(this.world, i, j, k, this, this.fallDistance);
    }

    super.a(d0, flag);
  }
  protected void a(NBTTagCompound var1) {
    if (var1.getBoolean("CustomDisplayTile")) {
      int var2 = var1.getInt("DisplayData");
      Block var3;
      if (var1.hasKeyOfType("DisplayTile", 8)) {
        var3 = Block.getByName(var1.getString("DisplayTile"));
        if (var3 == null) {
          this.setDisplayBlock(Blocks.AIR.getBlockData());
        } else {
          this.setDisplayBlock(var3.fromLegacyData(var2));
        }
      } else {
        var3 = Block.getById(var1.getInt("DisplayTile"));
        if (var3 == null) {
          this.setDisplayBlock(Blocks.AIR.getBlockData());
        } else {
          this.setDisplayBlock(var3.fromLegacyData(var2));
        }
      }

      this.SetDisplayBlockOffset(var1.getInt("DisplayOffset"));
    }

    if (var1.hasKeyOfType("CustomName", 8) && var1.getString("CustomName").length() > 0) {
      this.b = var1.getString("CustomName");
    }
  }
Пример #3
0
 @Override
 public boolean a(IBlockAccess iblockaccess, int x, int y, int z, int face) {
   int index = CustomBlock.getIndex(x, y, z);
   Chunk chunk = ((World) iblockaccess).getChunkAt(x >> 4, z >> 4).bukkitChunk;
   if (chunk.getClass().equals(SpoutCraftChunk.class)) {
     TIntIntHashMap powerOverrides = ((SpoutCraftChunk) chunk).powerOverrides;
     if (powerOverrides.containsKey(index)) {
       int powerbits = powerOverrides.get(index);
       switch (face) {
         case 0:
           return (powerbits & (1 << 0)) != 0;
         case 1:
           return (powerbits & (1 << 1)) != 0;
         case 2:
           return (powerbits & (1 << 2)) != 0;
         case 3:
           return (powerbits & (1 << 3)) != 0;
         case 4:
           return (powerbits & (1 << 4)) != 0;
         case 5:
           return (powerbits & (1 << 5)) != 0;
         default:
           return parent.a(iblockaccess, x, y, z, face);
       }
     }
   }
   return parent.a(iblockaccess, x, y, z, face);
 }
Пример #4
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;
 }
  public void m() {
    super.m();
    if (this.bs > 0) {
      --this.bs;
    }

    if (this.bt > 0) {
      --this.bt;
    }

    if (this.v * this.v + this.x * this.x > 2.500000277905201E-7D && this.random.nextInt(5) == 0) {
      int var1 = MathHelper.floor(this.s);
      int var2 = MathHelper.floor(this.t - 0.20000000298023224D);
      int var3 = MathHelper.floor(this.u);
      IBlockData var4 = this.o.getType(new BlockPosition(var1, var2, var3));
      Block var5 = var4.getBlock();
      if (var5.getMaterial() != Material.AIR) {
        this.o.a(
            class_cy.L,
            this.s + ((double) this.random.nextFloat() - 0.5D) * (double) this.J,
            this.aT().yMin + 0.1D,
            this.u + ((double) this.random.nextFloat() - 0.5D) * (double) this.J,
            4.0D * ((double) this.random.nextFloat() - 0.5D),
            0.5D,
            ((double) this.random.nextFloat() - 0.5D) * 4.0D,
            new int[] {Block.getCombinedId(var4)});
      }
    }
  }
Пример #6
0
 @Override
 public void a(float f, float f1, float f2, float f3, float f4, float f5) {
   if (parent != null) {
     parent.a(f, f1, f2, f3, f4, f5);
   } else {
     super.a(f, f1, f2, f3, f4, f5);
   }
 }
Пример #7
0
  private boolean c(int i) {
    if (i == 0) {
      return false;
    } else {
      Block block = Block.byId[i];

      return block.b() && block.material.isSolid();
    }
  }
Пример #8
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;
  }
Пример #9
0
  public boolean interactWith(
      ItemStack var1,
      EntityHuman var2,
      World var3,
      BlockPosition var4,
      EnumDirection var5,
      float var6,
      float var7,
      float var8) {
    if (var3.isClientSide) {
      return true;
    } else if (var5 != EnumDirection.UP) {
      return false;
    } else {
      IBlockData var9 = var3.getType(var4);
      Block var10 = var9.getBlock();
      boolean var11 = var10.a(var3, var4);
      if (!var11) {
        var4 = var4.up();
      }

      int var12 = MathHelper.floor((double) (var2.yaw * 4.0F / 360.0F) + 0.5D) & 3;
      EnumDirection var13 = EnumDirection.fromType2(var12);
      BlockPosition var14 = var4.shift(var13);
      if (var2.a(var4, var5, var1) && var2.a(var14, var5, var1)) {
        boolean var15 = var3.getType(var14).getBlock().a(var3, var14);
        boolean var16 = var11 || var3.isEmpty(var4);
        boolean var17 = var15 || var3.isEmpty(var14);
        if (var16
            && var17
            && World.a((IBlockAccess) var3, (BlockPosition) var4.down())
            && World.a((IBlockAccess) var3, (BlockPosition) var14.down())) {
          IBlockData var18 =
              Blocks.BED
                  .getBlockData()
                  .set(BlockBed.OCCUPIED, Boolean.valueOf(false))
                  .set(BlockBed.FACING, var13)
                  .set(BlockBed.PART, BlockBed.EnumBedPart.FOOT);
          if (var3.setTypeAndData(var4, var18, 3)) {
            IBlockData var19 = var18.set(BlockBed.PART, BlockBed.EnumBedPart.HEAD);
            var3.setTypeAndData(var14, var19, 3);
          }

          --var1.count;
          return true;
        } else {
          return false;
        }
      } else {
        return false;
      }
    }
  }
Пример #10
0
  protected void b(float f) {
    if (f > 1.0F) {
      this.makeSound("mob.horse.land", 0.4F, 1.0F);
    }

    int i = MathHelper.f(f * 0.5F - 3.0F);

    if (i > 0) {
      // CraftBukkit start - fire EntityDamageEvent
      EntityDamageEvent event =
          CraftEventFactory.callEntityDamageEvent(
              null, this, EntityDamageEvent.DamageCause.FALL, i);
      if (!event.isCancelled()) {
        float damage = (float) event.getDamage();
        if (damage > 0) {
          this.getBukkitEntity().setLastDamageCause(event);
          this.damageEntity(DamageSource.FALL, damage);
        }
      }

      if (this.passenger != null) {
        EntityDamageEvent passengerEvent =
            CraftEventFactory.callEntityDamageEvent(
                null, this.passenger, EntityDamageEvent.DamageCause.FALL, i);
        if (!passengerEvent.isCancelled()
            && this.passenger != null) { // Check again in case of plugin
          float damage = (float) passengerEvent.getDamage();
          if (damage > 0) {
            this.passenger.getBukkitEntity().setLastDamageCause(passengerEvent);
            this.passenger.damageEntity(DamageSource.FALL, damage);
          }
        }
        // CraftBukkit end
      }

      Block block =
          this.world.getType(
              MathHelper.floor(this.locX),
              MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw),
              MathHelper.floor(this.locZ));

      if (block.getMaterial() != Material.AIR) {
        StepSound stepsound = block.stepSound;

        this.world.makeSound(
            this,
            stepsound.getStepSound(),
            stepsound.getVolume1() * 0.5F,
            stepsound.getVolume2() * 0.75F);
      }
    }
  }
Пример #11
0
  public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
    int i1 = l & 7;

    this.a(world, i, j, k, new ItemStack(Items.SNOW_BALL, i1 + 1, 0));
    world.setAir(i, j, k);
    entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
  }
Пример #12
0
  @Override
  public boolean b(class_ago var1, Random var2, class_cj var3) {
    if (var1.p(var3).c().v() != class_avq.h) {
      return false;
    } else {
      int var4 = var2.nextInt(b - 2) + 2;
      byte var5 = 1;

      for (int var6 = var3.n() - var4; var6 <= (var3.n() + var4); ++var6) {
        for (int var7 = var3.p() - var4; var7 <= (var3.p() + var4); ++var7) {
          int var8 = var6 - var3.n();
          int var9 = var7 - var3.p();
          if (((var8 * var8) + (var9 * var9)) <= (var4 * var4)) {
            for (int var10 = var3.o() - var5; var10 <= (var3.o() + var5); ++var10) {
              class_cj var11 = new class_cj(var6, var10, var7);
              Block var12 = var1.p(var11).c();
              if ((var12 == Blocks.DIRT) || (var12 == Blocks.CLAY)) {
                var1.a(var11, a.getBlockData(), 2);
              }
            }
          }
        }
      }

      return true;
    }
  }
Пример #13
0
 public static boolean isBlockTransparent(short id) {
   if (id < 0) id += 256;
   if (!net.minecraft.server.Block.i(id)) {
     return true;
   }
   return false;
 }
Пример #14
0
 @Override
 public boolean a() {
   if (parent != null) {
     return parent.a();
   }
   return super.a();
 }
Пример #15
0
  public void onPlace(World world, int i, int j, int k) {
    if (world.suppressPhysics) return;
    super.onPlace(world, i, j, k);
    if (!world.isStatic) {
      l(world, i, j, k);
      world.applyPhysics(i, j + 1, k, this.id);
      world.applyPhysics(i, j - 1, k, this.id);
      n(world, i - 1, j, k);
      n(world, i + 1, j, k);
      n(world, i, j, k - 1);
      n(world, i, j, k + 1);
      if (world.s(i - 1, j, k)) n(world, i - 1, j + 1, k);
      else {
        n(world, i - 1, j - 1, k);
      }

      if (world.s(i + 1, j, k)) n(world, i + 1, j + 1, k);
      else {
        n(world, i + 1, j - 1, k);
      }

      if (world.s(i, j, k - 1)) n(world, i, j + 1, k - 1);
      else {
        n(world, i, j - 1, k - 1);
      }

      if (world.s(i, j, k + 1)) n(world, i, j + 1, k + 1);
      else n(world, i, j - 1, k + 1);
    }
  }
Пример #16
0
  public boolean a(Material material) {
    double d0 = this.locY + (double) this.getHeadHeight();
    BlockPosition blockposition = new BlockPosition(this.locX, d0, this.locZ);
    IBlockData iblockdata = this.world.getType(blockposition);
    Block block = iblockdata.getBlock();

    if (block.getMaterial() == material) {
      float f = BlockFluids.b(iblockdata.getBlock().toLegacyData(iblockdata)) - 0.11111111F;
      float f1 = (float) (blockposition.getY() + 1) - f;
      boolean flag = d0 < (double) f1;

      return !flag && this instanceof EntityHuman ? false : flag;
    } else {
      return false;
    }
  }
Пример #17
0
  public void remove(World world, int i, int j, int k, int l, int i1) {
    super.remove(world, i, j, k, l, i1);
    if (!world.isStatic) {
      world.applyPhysics(i, j + 1, k, this.id);
      world.applyPhysics(i, j - 1, 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);
      l(world, i, j, k);
      n(world, i - 1, j, k);
      n(world, i + 1, j, k);
      n(world, i, j, k - 1);
      n(world, i, j, k + 1);
      if (world.s(i - 1, j, k)) n(world, i - 1, j + 1, k);
      else {
        n(world, i - 1, j - 1, k);
      }

      if (world.s(i + 1, j, k)) n(world, i + 1, j + 1, k);
      else {
        n(world, i + 1, j - 1, k);
      }

      if (world.s(i, j, k - 1)) n(world, i, j + 1, k - 1);
      else {
        n(world, i, j - 1, k - 1);
      }

      if (world.s(i, j, k + 1)) n(world, i, j + 1, k + 1);
      else n(world, i, j - 1, k + 1);
    }
  }
Пример #18
0
  protected void a(int i, int j, int k, Block block) {
    StepSound stepsound = block.stepSound;

    if (this.world.getType(i, j + 1, k) == Blocks.SNOW) {
      stepsound = Blocks.SNOW.stepSound;
    }

    if (!block.getMaterial().isLiquid()) {
      int l = this.getType();

      if (this.passenger != null && l != 1 && l != 2) {
        ++this.bP;
        if (this.bP > 5 && this.bP % 3 == 0) {
          this.makeSound(
              "mob.horse.gallop", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
          if (l == 0 && this.random.nextInt(10) == 0) {
            this.makeSound(
                "mob.horse.breathe", stepsound.getVolume1() * 0.6F, stepsound.getVolume2());
          }
        } else if (this.bP <= 5) {
          this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
        }
      } else if (stepsound == Block.f) {
        this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
      } else {
        this.makeSound("mob.horse.soft", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
      }
    }
  }
Пример #19
0
 public void b(NBTTagCompound nbttagcompound) {
   super.b(nbttagcompound);
   nbttagcompound.setInt("blockId", Block.getId(this.a));
   nbttagcompound.setInt("blockData", this.i);
   nbttagcompound.setInt("facing", this.j);
   nbttagcompound.setFloat("progress", this.n);
   nbttagcompound.setBoolean("extending", this.k);
 }
Пример #20
0
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.a = Block.getById(nbttagcompound.getInt("blockId"));
   this.i = nbttagcompound.getInt("blockData");
   this.j = nbttagcompound.getInt("facing");
   this.n = this.m = nbttagcompound.getFloat("progress");
   this.k = nbttagcompound.getBoolean("extending");
 }
Пример #21
0
 @Override
 public void onPlace(World world, int i, int j, int k) {
   super.onPlace(world, i, j, k);
   if (world.isBlockIndirectlyPowered(i, j, k)) {
     postBreak(world, i, j, k, 1);
     world.setAir(i, j, k);
   }
 }
Пример #22
0
 public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
   if (!world.isStatic && entityhuman.K() != null && entityhuman.K().id == Item.SHEARS.id) {
     entityhuman.a(StatisticList.C[this.id], 1);
     this.a(world, i, j, k, new ItemStack(Block.VINE, 1, l));
   } else {
     super.a(world, entityhuman, i, j, k, l);
   }
 }
Пример #23
0
 public void b(NBTTagCompound nbttagcompound) {
   nbttagcompound.setShort("xTile", (short) this.e);
   nbttagcompound.setShort("yTile", (short) this.f);
   nbttagcompound.setShort("zTile", (short) this.g);
   nbttagcompound.setByte("inTile", (byte) Block.b(this.h));
   nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
   nbttagcompound.set("direction", this.a(new double[] {this.motX, this.motY, this.motZ}));
 }
Пример #24
0
 @Override
 public boolean Block_i(final int id) {
   try {
     return Block.i(id);
   } catch (Throwable t) {
     // Minecraft default value.
     return true;
   }
 }
Пример #25
0
 public void a(
     World var1, EntityHuman var2, BlockPosition var3, IBlockData var4, TileEntity var5) {
   if (!var1.isClientSide && var2.bZ() != null && var2.bZ().getItem() == Items.SHEARS) {
     var2.b(StatisticList.MINE_BLOCK_COUNT[Block.getId(this)]);
     a(var1, var3, new ItemStack(Blocks.DEADBUSH, 1, 0));
   } else {
     super.a(var1, var2, var3, var4, var5);
   }
 }
Пример #26
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);
  }
Пример #27
0
 @Override
 public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
   if (entityhuman instanceof EntityPlayer) {
     SpoutCraftPlayer player =
         (SpoutCraftPlayer)
             SpoutManager.getPlayer((Player) ((EntityPlayer) entityhuman).getBukkitEntity());
     player.setLastClickedLocation(new Location(player.getWorld(), i, j, k));
   }
   parent.b(world, i, j, k, entityhuman);
 }
Пример #28
0
  protected void Z() {
    int i = MathHelper.floor(this.locX);
    int j = MathHelper.floor(this.locY - 0.20000000298023224D);
    int k = MathHelper.floor(this.locZ);
    BlockPosition blockposition = new BlockPosition(i, j, k);
    IBlockData iblockdata = this.world.getType(blockposition);
    Block block = iblockdata.getBlock();

    if (block.b() != -1) {
      this.world.addParticle(
          EnumParticle.BLOCK_CRACK,
          this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width,
          this.getBoundingBox().b + 0.1D,
          this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width,
          -this.motX * 4.0D,
          1.5D,
          -this.motZ * 4.0D,
          new int[] {Block.getCombinedId(iblockdata)});
    }
  }
Пример #29
0
  public boolean generate(World world, Random random, int i, int j, int k) {
    Block block;

    while (((block = world.getType(i, j, k)).getMaterial() == Material.AIR
            || block.getMaterial() == Material.LEAVES)
        && j > 0) {
      --j;
    }

    for (int l = 0; l < 128; ++l) {
      int i1 = i + random.nextInt(8) - random.nextInt(8);
      int j1 = j + random.nextInt(4) - random.nextInt(4);
      int k1 = k + random.nextInt(8) - random.nextInt(8);

      if (world.isEmpty(i1, j1, k1) && this.a.j(world, i1, j1, k1)) {
        world.setTypeAndData(i1, j1, k1, this.a, this.b, 2);
      }
    }

    return true;
  }
Пример #30
0
  protected void a(BlockPosition blockposition, Block block) {
    StepSound stepsound = block.stepSound;

    if (this.world.getType(blockposition.up()).getBlock() == Blocks.SNOW_LAYER) {
      stepsound = Blocks.SNOW_LAYER.stepSound;
      this.makeSound(
          stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
    } else if (!block.getMaterial().isLiquid()) {
      this.makeSound(
          stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
    }
  }