public void a(Container container, List list) {
   this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list));
   this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
   // CraftBukkit start - send a Set Slot to update the crafting result slot
   if (java.util.EnumSet.of(InventoryType.CRAFTING, InventoryType.WORKBENCH)
       .contains(container.getBukkitView().getType())) {
     this.playerConnection.sendPacket(
         new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem()));
   }
   // CraftBukkit end
 }
  private void openCustomInventory(Inventory inventory, EntityPlayer player, int windowType) {
    if (player.playerConnection == null) return;
    Container container = new CraftContainer(inventory, this, player.nextContainerCounter());

    container = CraftEventFactory.callInventoryOpenEvent(player, container);
    if (container == null) return;

    String title = container.getBukkitView().getTitle();
    int size = container.getBukkitView().getTopInventory().getSize();

    player.playerConnection.sendPacket(
        new Packet100OpenWindow(container.windowId, windowType, title, size, true));
    getHandle().activeContainer = container;
    getHandle().activeContainer.addSlotListener(player);
  }
Beispiel #3
0
 public void a(Container container, int i0, ItemStack itemstack) {
   if (!(container.a(i0) instanceof SlotCrafting)) {
     if (!this.h) {
       this.a.b(new Packet103SetSlot(container.d, i0, itemstack));
     }
   }
 }
 public void transferTo(Container other, org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
   InventoryView source = this.getBukkitView(), destination = other.getBukkitView();
   ((CraftInventory) source.getTopInventory()).getInventory().onClose(player);
   ((CraftInventory) source.getBottomInventory()).getInventory().onClose(player);
   ((CraftInventory) destination.getTopInventory()).getInventory().onOpen(player);
   ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player);
 }
 public void a(Container container, int i, ItemStack itemstack) {
   if (!(container.getSlot(i) instanceof SlotResult)) {
     if (!this.h) {
       this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack));
     }
   }
 }
Beispiel #6
0
  public void b(EntityHuman entityhuman) {
    super.b(entityhuman);
    if (!this.h.isStatic) {
      for (int i = 0; i < this.g.getSize(); ++i) {
        ItemStack itemstack = this.g.splitWithoutUpdate(i);

        if (itemstack != null) {
          entityhuman.drop(itemstack);
        }
      }
    }
  }
  public void a(EntityHuman entityhuman) {
    super.a(entityhuman);
    if (!this.c.isStatic) {
      for (int i = 0; i < 9; ++i) {
        ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);

        if (itemstack != null) {
          entityhuman.drop(itemstack);
        }
      }
    }
  }
Beispiel #8
0
  public void b() {
    super.b();
    Iterator iterator = this.listeners.iterator();

    while (iterator.hasNext()) {
      ICrafting icrafting = (ICrafting) iterator.next();

      if (this.f != this.furnace.cookTime) {
        icrafting.setContainerData(this, 0, this.furnace.cookTime);
      }

      if (this.g != this.furnace.burnTime) {
        icrafting.setContainerData(this, 1, this.furnace.burnTime);
      }

      if (this.h != this.furnace.ticksForCurrentFuel) {
        icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
      }
    }

    this.f = this.furnace.cookTime;
    this.g = this.furnace.burnTime;
    this.h = this.furnace.ticksForCurrentFuel;
  }
Beispiel #9
0
 public void a(Container container) {
   this.a(container, container.a());
 }
Beispiel #10
0
 public void addSlotListener(ICrafting icrafting) {
   super.addSlotListener(icrafting);
   icrafting.setContainerData(this, 0, this.furnace.cookTime);
   icrafting.setContainerData(this, 1, this.furnace.burnTime);
   icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
 }
Beispiel #11
0
 public int b_(World world, int i, int j, int k, int l) {
   return Container.b((IInventory) world.getTileEntity(i, j, k));
 }
 public void updateInventory(Container container) {
   this.a(container, container.a());
 }
Beispiel #13
0
 public void a(IInventory iinventory) {
   super.a(iinventory);
   if (iinventory == this.g) {
     this.e();
   }
 }
Beispiel #14
0
 public void addSlotListener(ICrafting icrafting) {
   super.addSlotListener(icrafting);
   icrafting.setContainerData(this, 0, this.a);
 }
 /*     */ public void a() /*     */ {
   /*  70 */ super.a();
   /*     */
   /*  72 */ for (int var1 = 0; var1 < this.listeners.size(); var1++)
   /*     */ {
     /*  74 */ ICrafting var2 = (ICrafting) this.listeners.get(var1);
     /*     */
     /*  76 */ if (this.sunTimeScaled != this.collector.sunTimeScaled)
     /*     */ {
       /*  78 */ var2.setContainerData(this, 0, this.collector.sunTimeScaled);
       /*     */ }
     /*     */
     /*  81 */ if (this.sunStatus != this.collector.currentSunStatus)
     /*     */ {
       /*  83 */ var2.setContainerData(this, 1, this.collector.currentSunStatus);
       /*     */ }
     /*     */
     /*  86 */ if (this.currentFuelProgress != this.collector.currentFuelProgress)
     /*     */ {
       /*  88 */ var2.setContainerData(this, 2, this.collector.currentFuelProgress);
       /*     */ }
     /*     */
     /*  91 */ if (this.isUsingPower != this.collector.isUsingPower)
     /*     */ {
       /*  93 */ var2.setContainerData(this, 3, this.collector.isUsingPower ? 1 : 0);
       /*     */ }
     /*     */
     /*  96 */ if (this.isUsingPower != this.collector.isUsingPower)
     /*     */ {
       /*  98 */ var2.setContainerData(this, 4, this.collector.isUsingPower ? 1 : 0);
       /*     */ }
     /*     */
     /* 101 */ if (this.kleinProgressScaled != this.collector.kleinProgressScaled)
     /*     */ {
       /* 103 */ var2.setContainerData(this, 5, this.collector.kleinProgressScaled);
       /*     */ }
     /*     */
     /* 106 */ if (this.kleinPoints != this.collector.kleinPoints)
     /*     */ {
       /* 108 */ var2.setContainerData(this, 6, this.collector.kleinPoints & 0xFFFF);
       /*     */ }
     /*     */
     /* 111 */ if (this.kleinPoints != this.collector.kleinPoints)
     /*     */ {
       /* 113 */ var2.setContainerData(this, 7, this.collector.kleinPoints >>> 16);
       /*     */ }
     /*     */
     /* 116 */ if (this.sunTime != this.collector.collectorSunTime)
     /*     */ {
       /* 118 */ var2.setContainerData(this, 8, this.collector.collectorSunTime & 0xFFFF);
       /*     */ }
     /*     */
     /* 121 */ if (this.sunTime != this.collector.collectorSunTime)
     /*     */ {
       /* 123 */ var2.setContainerData(this, 9, this.collector.collectorSunTime >>> 16);
       /*     */ }
     /*     */ }
   /*     */
   /* 127 */ this.sunTime = this.collector.collectorSunTime;
   /* 128 */ this.kleinPoints = this.collector.kleinPoints;
   /* 129 */ this.isUsingPower = this.collector.isUsingPower;
   /* 130 */ this.sunTimeScaled = this.collector.sunTimeScaled;
   /* 131 */ this.sunStatus = this.collector.currentSunStatus;
   /* 132 */ this.currentFuelProgress = this.collector.currentFuelProgress;
   /* 133 */ this.kleinProgressScaled = this.collector.kleinProgressScaled;
   /*     */ }