Furnace setCookTime and setBurnTime

Discussion in 'Plugin Development' started by knokko, Jul 8, 2020.

Thread Status:
Not open for further replies.
  1. For complex custom smelting recipes before minecraft 1.13, I need to be able to set the cooking time and burning time of furnaces. I am using the following code to play with it:
        public void handleFurnaceClicks(InventoryClickEvent event) {
            if (event.getInventory() instanceof FurnaceInventory) {
                FurnaceInventory inv = (FurnaceInventory) event.getInventory();
                Bukkit.broadcastMessage("inv is " + System.identityHashCode(inv));
                if (event.getSlotType() == SlotType.CRAFTING) {
                    Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin(), () -> {
                        Bukkit.broadcastMessage("set cooking time");
                        inv.getHolder().setCookTime((short) 100);
                        inv.getHolder().setBurnTime((short) 1600);
                    }, 1, 1);
    This code will start spamming "set cooking time" in the server after I click on the smelting slot of a furnace (because of the repeating task), but the furnace does not display the new cook time or burn time at all (nothing lights up). So it looks like the calls to setCookTime and setBurnTime don't have any effect. Does anyone know why or what I'm doing wrong?
Thread Status:
Not open for further replies.

Share This Page