Faster Furnaces

Discussion in 'Spigot Plugin Development' started by JoeyPlayzTV, Jun 11, 2019.

  1. I have this code

    Code (Java):
    @EventHandler
        public void onFurnaceBoosterSmelt(FurnaceSmeltEvent event) {
            if(BoosterVariables.furnacebooster) {
                Furnace furnace = (Furnace) event.getBlock().getState();
                furnace.setCookTime((short) 190);
                furnace.update();
            }
        }
    But on 1.14.2 it donsent work :(
    Can you help me to make this working on 1.14.2?
     
  2. What do you mean "doesn't work"?
    What is happening?
    What are you expecting to happen?
    Do you see any errors in console?

    Have you tried Furnace#setCookTimetotal?
     
    • Agree Agree x 1
  3. I’m not sure but I think you are setting the total amount it takes to cook something and not the speed of the furnace.

    Since I read your comment yes that is what is happening everytime the furnace is burning you set the time to 160 again making it stuck at the same time
     
  4. The furnace stuck. The items not burn and this arrow stuck
     
  5. You set cook time which is the amount of time it has been cooking for. Change it to setCookTimeTotal. If you wanted to double the speed you could do
    setCookTimeTotal(furnace.getCookTimeTotal() / 2);

    Also you don't need to call update
     
  6. It dosent work :( the same problem. here my code:
    Code (Java):
    @EventHandler
        public void onFurnaceBoosterSmelt(FurnaceSmeltEvent event) {
            if(BoosterVariables.furnacebooster) {
                Furnace furnace = (Furnace) event.getBlock().getState();
                furnace.setCookTimeTotal(furnace.getCookTimeTotal() / 2);
            }
        }
    Here the result: http://prntscr.com/o0i59k
     
  7. what do you want to do exactly? to cook the object instantly?

    The issue may come from the event FurnaceSmeltEvent, maybe try to use FurnaceBurnEvent.
     
    • Make sure that you have registered the listener with
    Code (Java):
    Bukkit.getPluginManager().registerEvents(new Listeners(), this);
    • Make sure the BoosterVariables.furnacebooster boolean method is true and does not throws an error. (And what is the returns of BoosterVariables?)
     
  8. all is true and the listener works.
     
  9. bute the furnace stuck
     
  10. maybe try this:

    Code (Java):
        @EventHandler
        public void onFurnaceBoosterBurn(FurnaceBurnEvent event) {
            if(BoosterVariables.furnacebooster) ((Furnace) event.getBlock().getState()).setCookTime(Short.MAX_VALUE);
        }

        @EventHandler
        public void onFurnaceBoosterSmelt(FurnaceSmeltEvent event) {
            if(BoosterVariables.furnacebooster) ((Furnace) event.getBlock().getState()).setCookTime(Short.MAX_VALUE);
        }
     
  11. Has anyone a solution that work?
    Or is it not longer possible to make faster furnaces in the 1.14 version.
     
  12. You might want to give us some more code. It’s hard to debug when you don’t have the full picture. Could you send your main class and your full listener class?
     
  13. Step back and look at your code. Think about how and how often the event is being called. I don't think you understand the event FurnaceSmeltEvent.
     
  14. You need to update the furnace's state after manipulating cook time total.

    Also, I see you're currently "boosting" speed by 10 ticks, but that doesn't take into account recipes that have a lower cook time requirement, which is possible in 1.14. Recommend you find out which recipe is being used and adjust accordingly, your current code is going to make boosted blast furnaces and smokers much slower.
     
  15. The SmeltEvent is called, when a item is ready cooked in the furnace.
     
  16. And you never call furnace.update(), like I said.
     
  17. Here is my Listener
    Code (Java):
    EventHandler
        public void onFurnaceBoosterSmelt(FurnaceSmeltEvent event) {
            if(BoosterVariables.furnacebooster) {
                Furnace furnace = (Furnace) event.getBlock().getState();
                furnace.setCookTime((short) 190);
                furnace.update();
            }
        }