Ejemplo n.º 1
0
 @Override
 public boolean setWindowProperty(Property prop, int value) {
   net.minecraft.inventory.Container container = getHandle().field_71070_bA;
   if (container.getBukkitView().getType() != prop.getType()) {
     return false;
   }
   getHandle().func_71112_a(container, prop.getId(), value);
   return true;
 }
 @Override
 public void addCraftingToCrafters(ICrafting par1ICrafting) {
   super.addCraftingToCrafters(par1ICrafting);
   par1ICrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime);
   par1ICrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime);
   par1ICrafting.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime);
 }
  public void updateCraftingResults() {
    super.updateCraftingResults();
    Iterator var1 = this.crafters.iterator();

    while (var1.hasNext()) {
      ICrafting var2 = (ICrafting) var1.next();

      if (this.lastCookTime != this.furnace.furnaceCookTime) {

        var2.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime);
      }

      if (this.lastBurnTime != this.furnace.furnaceBurnTime) {
        var2.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime);
      }

      if (this.lastItemBurnTime != this.furnace.currentItemBurnTime) {
        var2.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime);
      }
    }

    this.lastCookTime = this.furnace.furnaceCookTime;
    this.lastBurnTime = this.furnace.furnaceBurnTime;
    this.lastItemBurnTime = this.furnace.currentItemBurnTime;
  }
 @Override
 public void onContainerClosed(EntityPlayer player) {
   super.onContainerClosed(player);
   if (!player.worldObj.isRemote) {
     dnaSynthesizer.closeInventory(player);
   }
 }
Ejemplo n.º 5
0
 @Override
 public ItemStack getItem(int slot) {
   if (slot == -999) {
     return null;
   }
   return CraftItemStack.asCraftMirror(container.getSlot(slot).getStack());
 }
Ejemplo n.º 6
0
  @Override
  public void onContainerClosed(EntityPlayer entityplayer) {
    super.onContainerClosed(entityplayer);

    tileEntity.playersUsing.remove(entityplayer);
    tileEntity.closeChest();
  }
  @Override
  public void detectAndSendChanges() {
    super.detectAndSendChanges();

    boolean allFieldsHaveChanged = false;
    boolean fieldHasChanged[] = new boolean[te.getFieldCount()];
    if (cachedFields == null) {
      cachedFields = new int[te.getFieldCount()];
      allFieldsHaveChanged = true;
    }
    for (int i = 0; i < cachedFields.length; i++) {
      if (allFieldsHaveChanged || cachedFields[i] != te.getField(i)) {
        cachedFields[i] = te.getField(i);
        fieldHasChanged[i] = true;
      }
    }

    for (int i = 0; i < this.crafters.size(); i++) {
      ICrafting icrafting = (ICrafting) this.crafters.get(i);
      for (int fieldID = 0; fieldID < te.getFieldCount(); fieldID++) {
        if (fieldHasChanged[fieldID]) {
          icrafting.sendProgressBarUpdate(this, fieldID, cachedFields[fieldID]);
        }
      }
    }
  }
  @Override
  public void onContainerClosed(EntityPlayer entityplayer) {
    super.onContainerClosed(entityplayer);

    tileEntity.close(entityplayer);
    tileEntity.closeInventory();
  }
Ejemplo n.º 9
0
 @Override
 public void onCraftGuiOpened(ICrafting crafting) {
   super.onCraftGuiOpened(crafting);
   crafting.sendProgressBarUpdate(this, 0, this.scribe.processTime);
   crafting.sendProgressBarUpdate(this, 1, this.scribe.bookTime);
   crafting.sendProgressBarUpdate(this, 2, this.scribe.currentBookBuffer);
 }
Ejemplo n.º 10
0
 @Override
 public void addCraftingToCrafters(ICrafting icrafting) {
   super.addCraftingToCrafters(icrafting);
   icrafting.sendProgressBarUpdate(this, 0, robit.furnaceCookTime);
   icrafting.sendProgressBarUpdate(this, 1, robit.furnaceBurnTime);
   icrafting.sendProgressBarUpdate(this, 2, robit.currentItemBurnTime);
 }
 /**
  * Sends the contents of an inventory slot to the client-side Container. This doesn't have to
  * match the actual contents of that slot. Args: Container, slot number, slot contents
  */
 public void sendSlotContents(Container p_71111_1_, int p_71111_2_, ItemStack p_71111_3_) {
   if (!(p_71111_1_.getSlot(p_71111_2_) instanceof SlotCrafting)) {
     if (!this.isChangingQuantityOnly) {
       this.playerNetServerHandler.sendPacket(
           new S2FPacketSetSlot(p_71111_1_.windowId, p_71111_2_, p_71111_3_));
     }
   }
 }
Ejemplo n.º 12
0
  @Override
  public void addCraftingToCrafters(ICrafting iCrafting) {
    super.addCraftingToCrafters(iCrafting);

    iCrafting.sendProgressBarUpdate(this, 0, campfireEnt.furnaceCookTime);
    iCrafting.sendProgressBarUpdate(this, 1, campfireEnt.furnaceBurnTime);
    iCrafting.sendProgressBarUpdate(this, 2, campfireEnt.currentItemBurnTime);
  }
Ejemplo n.º 13
0
 @Override
 public void detectAndSendChanges() {
   super.detectAndSendChanges();
   for (int i = 0; i < crafters.size(); i++) {
     ICrafting crafting = (ICrafting) crafters.get(i);
     if (oldFuel != planter.fuel) crafting.sendProgressBarUpdate(this, 0, planter.fuel);
   }
   oldFuel = planter.fuel;
 }
Ejemplo n.º 14
0
 @Override
 @SideOnly(Side.CLIENT)
 public void updateProgressBar(int id, int data) {
   super.updateProgressBar(id, data);
   switch (id) {
     case 0:
       planter.fuel = data;
   }
 }
Ejemplo n.º 15
0
 @Override
 public void setItem(int slot, ItemStack item) {
   net.minecraft.item.ItemStack stack = CraftItemStack.asNMSCopy(item);
   if (slot != -999) {
     container.getSlot(slot).putStack(stack);
   } else {
     player.getHandle().dropPlayerItemWithRandomChoice(stack, false);
   }
 }
Ejemplo n.º 16
0
  /** Callback for when the crafting gui is closed. */
  public void onCraftGuiClosed(EntityPlayer par1EntityPlayer) {
    super.onCraftGuiClosed(par1EntityPlayer);
    this.theMerchant.setCustomer((EntityPlayer) null);
    super.onCraftGuiClosed(par1EntityPlayer);

    if (!this.theWorld.isRemote) {
      ItemStack var2 = this.merchantInventory.getStackInSlotOnClosing(0);

      if (var2 != null) {
        par1EntityPlayer.dropPlayerItem(var2);
      }

      var2 = this.merchantInventory.getStackInSlotOnClosing(1);

      if (var2 != null) {
        par1EntityPlayer.dropPlayerItem(var2);
      }
    }
  }
Ejemplo n.º 17
0
 @Override
 public void onContainerClosed(EntityPlayer par1EntityPlayer) {
   super.onContainerClosed(par1EntityPlayer);
   if (!worldObj.isRemote) {
     for (int var2 = 0; var2 < 9; ++var2) {
       ItemStack var3 = craftMatrix.getStackInSlotOnClosing(var2);
       if (var3 != null) par1EntityPlayer.dropPlayerItem(var3);
     }
   }
 }
Ejemplo n.º 18
0
  @Override
  public void onCraftGuiClosed(EntityPlayer entityplayer) {
    super.onCraftGuiClosed(entityplayer);

    if (isBlock) {
      tileEntity.closeChest();
      tileEntity.playersUsing.remove(entityplayer);
    } else {
      itemInventory.closeChest();
    }
  }
  public void detectAndSendChanges() {
    super.detectAndSendChanges();
    for (Object crafter : this.crafters) {
      ICrafting icrafting = (ICrafting) crafter;
      if (this.lastCookTime != this.tileEntity.cookTime) {
        icrafting.sendProgressBarUpdate(this, 0, this.tileEntity.cookTime);
      }
    }

    this.lastCookTime = this.tileEntity.cookTime;
  }
 @Override
 public void detectAndSendChanges() {
   super.detectAndSendChanges();
   for (int i = 0; i < crafters.size(); i++) {
     ICrafting crafter = (ICrafting) crafters.get(i);
     if (lastColourFamily != tileEntityColourMixer.getColourFamily()) {
       crafter.sendProgressBarUpdate(this, 0, tileEntityColourMixer.getColourFamily().ordinal());
     }
   }
   lastColourFamily = tileEntityColourMixer.getColourFamily();
 }
  @Override
  public void onContainerClosed(EntityPlayer player) {
    super.onContainerClosed(player);

    for (int i = 0; i < 4; i++) {
      ItemStack stack = craftMatrix.removeStackFromSlot(i);

      if (stack != null) player.dropItem(stack, false);
    }

    craftResult.setInventorySlotContents(0, ItemStack.field_190927_a);
  }
Ejemplo n.º 22
0
 public void onContainerClosed(EntityPlayer entityplayer) {
   super.onContainerClosed(entityplayer);
   if (worldObj.isRemote) {
     return;
   }
   for (int i = 0; i < 9; i++) {
     ItemStack itemstack = craftMatrix.getStackInSlot(i);
     if (itemstack != null) {
       entityplayer.dropPlayerItem(itemstack);
     }
   }
 }
 @Override
 public void clearGrid(EntityPlayer entityPlayer, Container container, int id) {
   try {
     IInventory craftMatrix = (IInventory) crafterField.get(container);
     for (int i = 0; i < 9; i++) {
       craftMatrix.setInventorySlotContents(i, null);
     }
     container.detectAndSendChanges();
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 24
0
  /** Looks for changes made in the container, sends them to every listener. */
  public void detectAndSendChanges() {
    super.detectAndSendChanges();

    for (int i = 0; i < this.crafters.size(); ++i) {
      ICrafting icrafting = (ICrafting) this.crafters.get(i);

      if (this.lastCookTime != this.altar.furnaceCookTime) {
        icrafting.sendProgressBarUpdate(this, 0, this.altar.furnaceCookTime);
      }
    }

    this.lastCookTime = this.altar.furnaceCookTime;
  }
Ejemplo n.º 25
0
  /** Called when the container is closed. */
  public void onContainerClosed(Player playerIn) {
    super.onContainerClosed(playerIn);

    for (int i = 0; i < 4; ++i) {
      ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i);

      if (itemstack != null) {
        playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
      }
    }

    this.craftResult.setInventorySlotContents(0, (ItemStack) null);
  }
Ejemplo n.º 26
0
  /** Called when the container is closed. */
  public void onContainerClosed(EntityPlayer par1EntityPlayer) {
    super.onContainerClosed(par1EntityPlayer);

    if (!this.worldObj.isClient) {
      for (int var2 = 0; var2 < 9; ++var2) {
        ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);

        if (var3 != null) {
          par1EntityPlayer.dropPlayerItemWithRandomChoice(var3, false);
        }
      }
    }
  }
Ejemplo n.º 27
0
  /** Called when the container is closed. */
  public void onContainerClosed(EntityPlayer par1EntityPlayer) {
    super.onContainerClosed(par1EntityPlayer);

    for (int i = 0; i < 4; ++i) {
      ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

      if (itemstack != null) {
        par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false);
      }
    }

    this.craftResult.setInventorySlotContents(0, (ItemStack) null);
  }
Ejemplo n.º 28
0
  /** Called when the container is closed. */
  public void onContainerClosed(EntityPlayer par1EntityPlayer) {
    super.onContainerClosed(par1EntityPlayer);

    for (int var2 = 0; var2 < 4; ++var2) {
      ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);

      if (var3 != null) {
        par1EntityPlayer.dropPlayerItemWithRandomChoice(var3, false);
      }
    }

    this.craftResult.setInventorySlotContents(0, (ItemStack) null);
  }
  @Override
  public void onContainerClosed(EntityPlayer par1EntityPlayer) {
    super.onContainerClosed(par1EntityPlayer);

    if (!this.worldObj.isRemote) {
      for (int var2 = 1; var2 < this.craftMatrix.getSizeInventory(); ++var2) {
        final ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);

        if (var3 != null) {
          par1EntityPlayer.dropPlayerItem(var3);
        }
      }
    }
  }
  @Override
  public void onContainerClosed(EntityPlayer playerIn) {
    if (playerIn.worldObj.isRemote)
      LogHelper.info("ContainerInventoryDodo: onContainerClosed called on client.");
    else LogHelper.info("ContainerInventoryDodo: onContainerClosed called on server.");

    super.onContainerClosed(playerIn);

    ((InventoryDino) invDodo).closeInventory(playerIn);

    this.crafters.remove(playerIn);

    // TODO: Add animation to close lid?
  }