Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean scrollToWart() {
- PlayerInventory inv = player.getInventory();
- ItemStack lowestStack = null;
- int lowestSlot = Integer.MAX_VALUE;
- for (ItemStack stack : inv.main) {
- if(!stack.isOf(Items.NETHER_WART))
- continue;
- if(lowestStack != null && lowestStack.getCount() < stack.getCount())
- continue;
- lowestStack = stack;
- lowestSlot = inv.getSlotWithStack(stack);
- }
- if(lowestStack == null)
- return false;
- int dest = 44;
- swapItems(lowestSlot, dest);
- player.getInventory().selectedSlot = 8;
- return true;
- }
- private synchronized void swapItems(int from, int to) {
- MainMod.LOGGER.info("Moving stack from {} to {}", from, to);
- interaction.clickSlot(player.currentScreenHandler.syncId, from, 0, SlotActionType.PICKUP, player);
- try {
- Thread.sleep(50);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- interaction.clickSlot(player.currentScreenHandler.syncId, to, 0, SlotActionType.PICKUP, player);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement