Furnace inventory opens, but there are no furnace recipes themselves

Discussion in 'Plugin Development' started by DreamSmoke, Sep 13, 2019 at 2:07 AM.

  1. Offline

    DreamSmoke

    code:
    Code:
    @EventHandler
        public void onPlayerClick(PlayerInteractEvent e) {
            Player player = e.getPlayer();
            Action action = e.getAction();
            if(action == action.RIGHT_CLICK_AIR || action == action.RIGHT_CLICK_BLOCK) {
                Inventory inv = Bukkit.createInventory(player, InventoryType.FURNACE);
                ItemStack stack = player.getItemInHand();
                if(stack == null) {
                    return;
                }
               
                if(stack.getTypeId() == 263) {
                    player.openInventory(inv);
                }
            }
        }
    Thanks for attention :rolleyes:
     
  2. Offline

    DerDonut

    That's because you only open the GUI. You could place a furnace block somewhere in the world and pass it as the InventoryHolder (I believe) or you have to manually do the cooking process. Either with packets or using InventoryView#Property
     
  3. Offline

    DreamSmoke

    If the player is not in the world where the stove is installed? He couldn’t probably be able to open it then?
    How exactly do I need to work with InventoryView # Property? I saw a method with opening an inventory for a player with this argument, but probably this is not what I need, can you help me figure this out?
     

Share This Page