Advertisement
raffa50

Alchemy custom brew ingredients

Jan 23rd, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  2.     public void onBrewPlaceIngredient(InventoryClickEvent e){
  3.         if(e.getClickedInventory().getType() != InventoryType.BREWING ||
  4.             e.getSlotType() != InventoryType.SlotType.FUEL ||
  5.             e.getAction() != InventoryAction.PLACE_ALL)
  6.             return;
  7.  
  8.         var brewInv = (BrewerInventory) e.getClickedInventory();
  9.         var ingr = e.getCursor();
  10.  
  11.         log.info(e.getSlotType()+" "+e.getAction().toString()+" "+ingr.toString());
  12.  
  13.         if(ingr != null && ingr.getType() == Material.GOLD_NUGGET) {
  14.             ingr.setAmount(ingr.getAmount() - 1);
  15.             brewInv.setIngredient(new ItemStack(Material.GOLD_NUGGET));
  16.             brewInv.getHolder().update();
  17.             ((Player) e.getWhoClicked()).updateInventory();
  18.             /*if ( Arrays.stream(brewInv.getStorageContents()).anyMatch(Utils::isEffectPotion) ) {
  19.                 ingr.setAmount(ingr.getAmount() - 1);
  20.                 brewInv.setIngredient(new ItemStack(Material.GOLD_NUGGET));
  21.                 brewInv.getHolder().setBrewingTime(400);
  22.                 brewInv.getHolder().update();
  23.                 log.info("brewing...");
  24.             }*/
  25.         }
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement