1.15.2 Disable hoppers moving items into furnaces

Discussion in 'Spigot Plugin Development' started by Joshuak52, Feb 29, 2020.

Thread Status:
Not open for further replies.
  1. Hey, is there an event or a way I can disable items in a hopper move into a furnace?
     
  2. InventoryMoveItemEvent I think
     
  3. Tried, the code below but no luck.

    Code (Text):
    @EventHandler
        public void InventoryMoveItemEvent(InventoryMoveItemEvent event) {
            if(event.getSource().getType().equals(InventoryType.HOPPER)){
                if(event.getDestination().getType().equals(InventoryType.FURNACE)) {
                    Bukkit.broadcastMessage("1");
                }
            }
        }
     
  4. Log what event.getSource().getType() and event.getDestination().getType() actually come up as.
     
  5. Try using InventoryHolder, and checking if it is an instanceof a block, then check if the type is furnace/hopper.
     
  6. Use InventoryPickupItemEvent and check if the inventory type is a hopper, if it is just cancel the event.
     
  7. But he isn't trying to disable hoppers, just the movement into furnaces, and an item moving from a chest into a hopper then into a furnace would not call the InventoryPickupItemEvent, which is why you need the InventoryMoveItemEvent.
     
  8. So your goal is to check if a item is going into a furnace? Use the hopper event when a item is moving through it and check if it’s a furnace for where it is heading.
     
  9. Why even check the source, just check the destination if it is a furnace cancel the event.

    Bt event I mean InventoryMoveItemEvent...
     
Thread Status:
Not open for further replies.