Ejemplo n.º 1
0
  public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {
    // CraftBukkit start - inventory open hook
    Container container =
        CraftEventFactory.callInventoryOpenEvent(
            this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand));
    if (container == null) return;
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(
        new Packet100OpenWindow(
            this.containerCounter,
            5,
            tileentitybrewingstand.getName(),
            tileentitybrewingstand.getSize()));
    this.activeContainer = container; // CraftBukkit - Use container passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
  }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 3
0
  public void a(TileEntityBrewingStand tileentitybrewingstand) {
    // CanaryMod: InventoryHook
    InventoryHook hook =
        new InventoryHook(getPlayer(), tileentitybrewingstand.getCanaryBrewingStand(), false);

    Canary.hooks().callHook(hook);
    if (hook.isCanceled()) {
      return;
    }
    //

    this.ct();
    this.a.b(
        new Packet100OpenWindow(
            this.cu,
            5,
            tileentitybrewingstand.b(),
            tileentitybrewingstand.j_(),
            tileentitybrewingstand.c()));
    this.bM = new ContainerBrewingStand(this.bK, tileentitybrewingstand);
    this.bM.d = this.cu;
    this.bM.a((ICrafting) this);
  }