コード例 #1
0
 /**
  * Change the items in an inventory view, will overwrite if any item already exists in the slot
  * indicated by the map key. DOES NOT UPDATE THE VIEW FOR THOSE LOOKING.
  *
  * @param inventoryView view to modify the items of
  * @param inventoryItems map of index -> item entries to set the view to.
  */
 public static void setViewItems(
     InventoryView inventoryView, Map<Integer, ItemStack> inventoryItems) {
   for (Map.Entry<Integer, ItemStack> itemEntry : inventoryItems.entrySet()) {
     inventoryView.setItem(itemEntry.getKey(), itemEntry.getValue());
   }
 }
コード例 #2
0
 /**
  * Set the item at a specific slot in the inventory view. DOES NOT PERFORM AN UPDATE FOR EVERYONE
  * CURRENTLY LOOKING.
  *
  * @param inventoryView inventory view to modify
  * @param itemSlot slot to set the item at
  * @param itemStack item to set in the chosen slot
  */
 public static void setViewItemAtSlot(
     InventoryView inventoryView, int itemSlot, ItemStack itemStack) {
   inventoryView.setItem(itemSlot, itemStack);
 }