Пример #1
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;
      }
    }
  }
Пример #2
0
  public int getDropData(World world, BlockPosition blockposition) {
    TileEntity tileentity = world.getTileEntity(blockposition);

    return tileentity instanceof TileEntitySkull
        ? ((TileEntitySkull) tileentity).getSkullType()
        : super.getDropData(world, blockposition);
  }
Пример #3
0
  public static IInventory getInventoryAt(World world, double d0, double d1, double d2) {
    IInventory iinventory = null;
    int i = MathHelper.floor(d0);
    int j = MathHelper.floor(d1);
    int k = MathHelper.floor(d2);
    if (!world.isLoaded(i, j, k)) return null; // Spigot
    TileEntity tileentity = world.getTileEntity(i, j, k);

    if (tileentity != null && tileentity instanceof IInventory) {
      iinventory = (IInventory) tileentity;
      if (iinventory instanceof TileEntityChest) {
        Block block = world.getType(i, j, k);

        if (block instanceof BlockChest) {
          iinventory = ((BlockChest) block).m(world, i, j, k);
        }
      } else if (iinventory instanceof TileEntityIronChest) {
        isIronChest = true;
        // alkazia fix for iron chest
      }
    }
    if (iinventory == null) {
      List list =
          world.getEntities(
              (Entity) null,
              AxisAlignedBB.a().a(d0, d1, d2, d0 + 1.0D, d1 + 1.0D, d2 + 1.0D),
              IEntitySelector.b);

      if (list != null && list.size() > 0) {
        iinventory = (IInventory) list.get(world.random.nextInt(list.size()));
      }
    }

    return iinventory;
  }
Пример #4
0
  public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
    if (!world.isStatic) {
      // CraftBukkit start - Drop item in code above, not here
      // if (!((Boolean) iblockdata.get(BlockSkull.NODROP)).booleanValue()) {
      if (false) {
        // CraftBukkit end
        TileEntity tileentity = world.getTileEntity(blockposition);

        if (tileentity instanceof TileEntitySkull) {
          TileEntitySkull tileentityskull = (TileEntitySkull) tileentity;
          ItemStack itemstack =
              new ItemStack(Items.SKULL, 1, this.getDropData(world, blockposition));

          if (tileentityskull.getSkullType() == 3 && tileentityskull.getGameProfile() != null) {
            itemstack.setTag(new NBTTagCompound());
            NBTTagCompound nbttagcompound = new NBTTagCompound();

            GameProfileSerializer.serialize(nbttagcompound, tileentityskull.getGameProfile());
            itemstack.getTag().set("SkullOwner", nbttagcompound);
          }

          a(world, blockposition, itemstack);
        }
      }

      super.remove(world, blockposition, iblockdata);
    }
  }
Пример #5
0
  public boolean interact(
      World world,
      int i,
      int j,
      int k,
      EntityHuman entityhuman,
      int l,
      float f,
      float f1,
      float f2) {
    InventoryEnderChest inventoryenderchest = entityhuman.getEnderChest();
    TileEntityEnderChest tileentityenderchest = (TileEntityEnderChest) world.getTileEntity(i, j, k);

    if (inventoryenderchest != null && tileentityenderchest != null) {
      if (world.s(i, j + 1, k)) {
        return true;
      } else if (world.isStatic) {
        return true;
      } else {
        inventoryenderchest.a(tileentityenderchest);
        entityhuman.openContainer(inventoryenderchest);
        return true;
      }
    } else {
      return true;
    }
  }
Пример #6
0
  public void dropRecord(World world, int i, int j, int k) {
    if (!world.isStatic) {
      TileEntityRecordPlayer tileentityrecordplayer =
          (TileEntityRecordPlayer) world.getTileEntity(i, j, k);

      if (tileentityrecordplayer != null) {
        ItemStack itemstack = tileentityrecordplayer.record;

        if (itemstack != null) {
          world.triggerEffect(1005, i, j, k, 0);
          world.a((String) null, i, j, k);
          tileentityrecordplayer.record = null;
          tileentityrecordplayer.update();
          world.setData(i, j, k, 0);
          float f = 0.7F;
          double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
          double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
          double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
          ItemStack itemstack1 = itemstack.cloneItemStack();
          EntityItem entityitem =
              new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, itemstack1);

          entityitem.pickupDelay = 10;
          world.addEntity(entityitem);
        }
      }
    }
  }
Пример #7
0
  public void doPhysics(World world, int i, int j, int k, int l) {
    super.doPhysics(world, i, j, k, l);
    TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k);

    if (tileentitychest != null) {
      tileentitychest.d();
    }
  }
Пример #8
0
  public ItemStack a(World world, BlockPosition blockposition, IBlockData iblockdata) {
    int i = 0;
    TileEntity tileentity = world.getTileEntity(blockposition);

    if (tileentity instanceof TileEntitySkull) {
      i = ((TileEntitySkull) tileentity).getSkullType();
    }

    return new ItemStack(Items.SKULL, 1, i);
  }
Пример #9
0
  public void a(World world, int i, int j, int k, ItemStack itemstack) {
    if (!world.isStatic) {
      TileEntityRecordPlayer tileentityrecordplayer =
          (TileEntityRecordPlayer) world.getTileEntity(i, j, k);

      if (tileentityrecordplayer != null) {
        tileentityrecordplayer.record = itemstack.cloneItemStack();
        tileentityrecordplayer.update();
        world.setData(i, j, k, 1);
      }
    }
  }
Пример #10
0
 // Spigot start
 // Helper method for scheduleTicks. If the hopper at x0, y0, z0 is pointed
 // at this tile entity, then make it active.
 private void scheduleTick(int x0, int y0, int z0) {
   TileEntity tileEntity = world.getTileEntity(x0, y0, z0);
   if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) {
     // i is the metadeta assoiated with the direction the hopper faces.
     int i = BlockHopper.b(tileEntity.p());
     // Facing class provides arrays for direction offset.
     if (tileEntity.x + Facing.b[i] == x
         && tileEntity.y + Facing.c[i] == y
         && tileEntity.z + Facing.d[i] == z) {
       ((TileEntityHopper) tileEntity).makeTick();
     }
   }
 }
Пример #11
0
  public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
    if (world.isStatic) {
      return true;
    } else {
      TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);

      if (tileentitydispenser != null) {
        entityhuman.openDispenser(tileentitydispenser);
      }

      return true;
    }
  }
Пример #12
0
 // Called from update when the contents have changed, so hoppers need updates.
 // Check all 6 faces.
 public void scheduleTicks() {
   if (world != null && world.spigotConfig.altHopperTicking) {
     // Check the top
     scheduleTick(x, y + 1, z);
     // Check the sides
     for (int i = 2; i < 6; i++) {
       scheduleTick(x + Facing.b[i], y, z + Facing.d[i]);
     }
     // Check the bottom.
     TileEntity tileEntity = world.getTileEntity(x, y - 1, z);
     if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) {
       ((TileEntityHopper) tileEntity).makeTick();
     }
   }
 }
Пример #13
0
  // CraftBukkit start - Special case dropping so we can get info from the tile entity
  public void dropNaturally(
      World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) {
    if (world.random.nextFloat() < f) {
      ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, blockposition));
      TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(blockposition);

      if (tileentityskull.getSkullType() == 3 && tileentityskull.getGameProfile() != null) {
        itemstack.setTag(new NBTTagCompound());
        NBTTagCompound nbttagcompound = new NBTTagCompound();

        GameProfileSerializer.serialize(nbttagcompound, tileentityskull.getGameProfile());
        itemstack.getTag().set("SkullOwner", nbttagcompound);
      }

      a(world, blockposition, itemstack);
    }
  }
Пример #14
0
  public void remove(World world, int i, int j, int k) {
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);

    if (tileentitydispenser != null) {
      for (int l = 0; l < tileentitydispenser.getSize(); ++l) {
        ItemStack itemstack = tileentitydispenser.getItem(l);

        if (itemstack != null) {
          float f = this.a.nextFloat() * 0.8F + 0.1F;
          float f1 = this.a.nextFloat() * 0.8F + 0.1F;
          float f2 = this.a.nextFloat() * 0.8F + 0.1F;

          while (itemstack.count > 0) {
            int i1 = this.a.nextInt(21) + 10;

            if (i1 > itemstack.count) {
              i1 = itemstack.count;
            }

            itemstack.count -= i1;
            EntityItem entityitem =
                new EntityItem(
                    world,
                    (double) ((float) i + f),
                    (double) ((float) j + f1),
                    (double) ((float) k + f2),
                    new ItemStack(itemstack.id, i1, itemstack.getData()));

            if (itemstack.hasTag()) {
              entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
            }

            float f3 = 0.05F;

            entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
            entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
            entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
            world.addEntity(entityitem);
          }
        }
      }
    }

    super.remove(world, i, j, k);
  }
Пример #15
0
  public void remove(World world, int i, int j, int k, int l, int i1) {
    TileEntity tileentity = world.getTileEntity(i, j, k);

    if (tileentity instanceof TileEntityBrewingStand) {
      TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) tileentity;

      for (int j1 = 0; j1 < tileentitybrewingstand.getSize(); ++j1) {
        ItemStack itemstack = tileentitybrewingstand.getItem(j1);

        if (itemstack != null) {
          float f = this.a.nextFloat() * 0.8F + 0.1F;
          float f1 = this.a.nextFloat() * 0.8F + 0.1F;
          float f2 = this.a.nextFloat() * 0.8F + 0.1F;

          while (itemstack.count > 0) {
            int k1 = this.a.nextInt(21) + 10;

            if (k1 > itemstack.count) {
              k1 = itemstack.count;
            }

            itemstack.count -= k1;
            EntityItem entityitem =
                new EntityItem(
                    world,
                    (double) ((float) i + f),
                    (double) ((float) j + f1),
                    (double) ((float) k + f2),
                    new ItemStack(itemstack.id, k1, itemstack.getData()));
            float f3 = 0.05F;

            entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
            entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
            entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
            world.addEntity(entityitem);
          }
        }
      }
    }

    super.remove(world, i, j, k, l, i1);
  }
Пример #16
0
  public static boolean a(
      World world, EntityHuman entityhuman, BlockPosition blockposition, ItemStack itemstack) {
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (minecraftserver == null) {
      return false;
    } else {
      if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("BlockEntityTag", 10)) {
        TileEntity tileentity = world.getTileEntity(blockposition);

        if (tileentity != null) {
          if (!world.isClientSide
              && tileentity.F()
              && !minecraftserver.getPlayerList().isOp(entityhuman.getProfile())) {
            return false;
          }

          NBTTagCompound nbttagcompound = new NBTTagCompound();
          NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.clone();

          tileentity.b(nbttagcompound);
          NBTTagCompound nbttagcompound2 =
              (NBTTagCompound) itemstack.getTag().get("BlockEntityTag");

          nbttagcompound.a(nbttagcompound2);
          nbttagcompound.setInt("x", blockposition.getX());
          nbttagcompound.setInt("y", blockposition.getY());
          nbttagcompound.setInt("z", blockposition.getZ());
          if (!nbttagcompound.equals(nbttagcompound1)) {
            tileentity.a(nbttagcompound);
            tileentity.update();
            return true;
          }
        }
      }

      return false;
    }
  }
Пример #17
0
  public boolean interact(
      World world,
      int i,
      int j,
      int k,
      EntityHuman entityhuman,
      int l,
      float f,
      float f1,
      float f2) {
    if (world.isStatic) {
      return true;
    } else {
      TileEntityBrewingStand tileentitybrewingstand =
          (TileEntityBrewingStand) world.getTileEntity(i, j, k);

      if (tileentitybrewingstand != null) {
        entityhuman.openBrewingStand(tileentitybrewingstand);
      }

      return true;
    }
  }
Пример #18
0
  private void updateTileEntityOrientation(World world, int i, int j, int k) {
    TileEntityPortalController controller =
        (TileEntityPortalController) world.getTileEntity(i, j, k);
    int metadata = world.getBlockMetadata(i, j, k);

    if (metadata == 1) {
      controller.pitch = -90;
      controller.yaw = -90;
      /*}else if(metadata == 1){
      controller.pitch = 90;
      controller.yaw = -90;*/
    } else if (metadata == 2) {
      controller.yaw = 270;
    } else if (metadata == 3) {
      controller.yaw = 90;
    } else if (metadata == 4) {
      controller.yaw = 0;
    } else if (metadata == 5) {
      controller.yaw = 180;
    }

    controller.markDirty();
  }
  public boolean a(
      World paramWorld, Random paramRandom, StructureBoundingBox paramStructureBoundingBox) {
    if (a(paramWorld, paramStructureBoundingBox)) {
      return false;
    }

    int i = this.d * 5 - 1;

    a(paramWorld, paramStructureBoundingBox, 0, 0, 0, 2, 1, i, 0, 0, false);
    a(paramWorld, paramStructureBoundingBox, paramRandom, 0.8F, 0, 2, 0, 2, 2, i, 0, 0, false);

    if (this.b)
      a(
          paramWorld,
          paramStructureBoundingBox,
          paramRandom,
          0.6F,
          0,
          0,
          0,
          2,
          1,
          i,
          Block.WEB.id,
          0,
          false);
    int k;
    int m;
    for (int j = 0; j < this.d; j++) {
      k = 2 + j * 5;

      a(paramWorld, paramStructureBoundingBox, 0, 0, k, 0, 1, k, Block.FENCE.id, 0, false);
      a(paramWorld, paramStructureBoundingBox, 2, 0, k, 2, 1, k, Block.FENCE.id, 0, false);
      if (paramRandom.nextInt(4) != 0) {
        a(paramWorld, paramStructureBoundingBox, 0, 2, k, 2, 2, k, Block.WOOD.id, 0, false);
      } else {
        a(paramWorld, paramStructureBoundingBox, 0, 2, k, 0, 2, k, Block.WOOD.id, 0, false);
        a(paramWorld, paramStructureBoundingBox, 2, 2, k, 2, 2, k, Block.WOOD.id, 0, false);
      }
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.1F, 0, 2, k - 1, Block.WEB.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.1F, 2, 2, k - 1, Block.WEB.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.1F, 0, 2, k + 1, Block.WEB.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.1F, 2, 2, k + 1, Block.WEB.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.05F, 0, 2, k - 2, Block.WEB.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.05F, 2, 2, k - 2, Block.WEB.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.05F, 0, 2, k + 2, Block.WEB.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.05F, 2, 2, k + 2, Block.WEB.id, 0);

      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.05F, 1, 2, k - 1, Block.TORCH.id, 0);
      a(paramWorld, paramStructureBoundingBox, paramRandom, 0.05F, 1, 2, k + 1, Block.TORCH.id, 0);

      if (paramRandom.nextInt(100) == 0) {
        a(
            paramWorld,
            paramStructureBoundingBox,
            paramRandom,
            2,
            0,
            k - 1,
            WorldGenMineshaftPieces.a(),
            3 + paramRandom.nextInt(4));
      }
      if (paramRandom.nextInt(100) == 0) {
        a(
            paramWorld,
            paramStructureBoundingBox,
            paramRandom,
            0,
            0,
            k + 1,
            WorldGenMineshaftPieces.a(),
            3 + paramRandom.nextInt(4));
      }
      if ((this.b) && (!this.c)) {
        m = b(0);
        int n = k - 1 + paramRandom.nextInt(3);
        int i1 = a(1, n);
        n = b(1, n);
        if (paramStructureBoundingBox.b(i1, m, n)) {
          this.c = true;
          paramWorld.setTypeId(i1, m, n, Block.MOB_SPAWNER.id);
          TileEntityMobSpawner localTileEntityMobSpawner =
              (TileEntityMobSpawner) paramWorld.getTileEntity(i1, m, n);
          if (localTileEntityMobSpawner != null) localTileEntityMobSpawner.a("CaveSpider");
        }
      }
    }

    for (j = 0; j <= 2; j++) {
      for (k = 0; k <= i; k++) {
        m = a(paramWorld, j, -1, k, paramStructureBoundingBox);
        if (m == 0) {
          a(paramWorld, Block.WOOD.id, 0, j, -1, k, paramStructureBoundingBox);
        }
      }
    }

    if (this.a) {
      for (j = 0; j <= i; j++) {
        k = a(paramWorld, 1, -1, j, paramStructureBoundingBox);
        if ((k > 0) && (Block.n[k] != 0)) {
          a(
              paramWorld,
              paramStructureBoundingBox,
              paramRandom,
              0.7F,
              1,
              0,
              j,
              Block.RAILS.id,
              c(Block.RAILS.id, 0));
        }
      }
    }

    return true;
  }
Пример #20
0
  // CraftBukkit - priv to public
  public void dispense(World world, int i, int j, int k, Random random) {
    int l = world.getData(i, j, k);
    byte b0 = 0;
    byte b1 = 0;

    if (l == 3) {
      b1 = 1;
    } else if (l == 2) {
      b1 = -1;
    } else if (l == 5) {
      b0 = 1;
    } else {
      b0 = -1;
    }

    TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);

    if (tileentitydispenser != null) {
      // CraftBukkit start
      int dispenseSlot = tileentitydispenser.findDispenseSlot();
      ItemStack itemstack = null;
      if (dispenseSlot > -1) {
        itemstack = tileentitydispenser.getContents()[dispenseSlot];

        // Copy item stack, because we want it to have 1 item
        itemstack =
            new ItemStack(itemstack.id, 1, itemstack.getData(), itemstack.getEnchantments());
      }
      // CraftBukkit end

      double d0 = (double) i + (double) b0 * 0.6D + 0.5D;
      double d1 = (double) j + 0.5D;
      double d2 = (double) k + (double) b1 * 0.6D + 0.5D;

      if (itemstack == null) {
        world.triggerEffect(1001, i, j, k, 0);
      } else {
        // CraftBukkit start
        double d3 = random.nextDouble() * 0.1D + 0.2D;
        double motX = (double) b0 * d3;
        double motY = 0.20000000298023224D;
        double motZ = (double) b1 * d3;
        motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
        motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
        motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;

        org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
        org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();

        BlockDispenseEvent event =
            new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
        world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
          return;
        }

        if (event.getItem().equals(bukkitItem)) {
          // Actually remove the item
          tileentitydispenser.splitStack(dispenseSlot, 1);
        }

        motX = event.getVelocity().getX();
        motY = event.getVelocity().getY();
        motZ = event.getVelocity().getZ();

        itemstack = CraftItemStack.createNMSItemStack(event.getItem());
        // CraftBukkit end

        if (itemstack.id == Item.ARROW.id) {
          EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);

          entityarrow.shoot((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
          entityarrow.fromPlayer = true;
          world.addEntity(entityarrow);
          world.triggerEffect(1002, i, j, k, 0);
        } else if (itemstack.id == Item.EGG.id) {
          EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);

          entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
          world.addEntity(entityegg);
          world.triggerEffect(1002, i, j, k, 0);
        } else if (itemstack.id == Item.SNOW_BALL.id) {
          EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);

          entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
          world.addEntity(entitysnowball);
          world.triggerEffect(1002, i, j, k, 0);
        } else if (itemstack.id == Item.POTION.id && ItemPotion.c(itemstack.getData())) {
          EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData());

          entitypotion.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
          world.addEntity(entitypotion);
          world.triggerEffect(1002, i, j, k, 0);
        } else if (itemstack.id == Item.EXP_BOTTLE.id) {
          EntityThrownExpBottle entitythrownexpbottle =
              new EntityThrownExpBottle(world, d0, d1, d2);

          entitythrownexpbottle.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
          world.addEntity(entitythrownexpbottle);
          world.triggerEffect(1002, i, j, k, 0);
        } else if (itemstack.id == Item.MONSTER_EGG.id) {
          ItemMonsterEgg.a(
              world,
              itemstack.getData(),
              d0 + (double) b0 * 0.3D,
              d1 - 0.3D,
              d2 + (double) b1 * 0.3D);
          world.triggerEffect(1002, i, j, k, 0);
        } else if (itemstack.id == Item.FIREBALL.id) {
          EntitySmallFireball entitysmallfireball =
              new EntitySmallFireball(
                  world,
                  d0 + (double) b0 * 0.3D,
                  d1,
                  d2 + (double) b1 * 0.3D,
                  (double) b0 + random.nextGaussian() * 0.05D,
                  random.nextGaussian() * 0.05D,
                  (double) b1 + random.nextGaussian() * 0.05D);

          world.addEntity(entitysmallfireball);
          world.triggerEffect(1009, i, j, k, 0);
        } else {
          EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
          // CraftBukkit start
          // double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
          entityitem.motX = motX;
          entityitem.motY = motY;
          entityitem.motZ = motZ;
          // CraftBukkit end
          world.addEntity(entityitem);
          world.triggerEffect(1000, i, j, k, 0);
        }

        world.triggerEffect(2000, i, j, k, b0 + 1 + (b1 + 1) * 3);
      }
    }
  }
Пример #21
0
 public int b_(World world, int i, int j, int k, int l) {
   return Container.b((IInventory) world.getTileEntity(i, j, k));
 }
Пример #22
0
 public void postPlace(
     World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
   if (itemstack.hasName()) {
     ((TileEntityBrewingStand) world.getTileEntity(i, j, k)).a(itemstack.getName());
   }
 }