@@ -143,21 +143,25 @@ public boolean shouldPause(final @Nullable Event event) {
143143
144144 ItemStack input ;
145145 ItemStack result ;
146+ CookingRecipe <?> recipe ;
146147 if (event instanceof FurnaceSmeltEvent smeltEvent ) {
147148 // Special case FurnaceSmeltEvent: smelt has not completed, input and result are different.
148149 // Decrease input for post-smelt
149150 input = smeltEvent .getSource ().clone ();
150151 input .setAmount (input .getAmount () - 1 );
151152 // Use post-smelt result
152153 result = smeltEvent .getResult ();
154+ // FurnaceSmeltEvent is the only pause event that provides the active recipe.
155+ recipe = smeltEvent .getRecipe ();
153156 } else {
154157 // In all other cases use current contents of furnace.
155158 FurnaceInventory inventory = furnace .getInventory ();
156159 input = inventory .getSmelting ();
157160 result = inventory .getResult ();
161+ recipe = null ;
158162 }
159163
160- return shouldPause (furnace , input , result );
164+ return shouldPause (furnace , input , result , recipe );
161165 }
162166
163167 /**
@@ -172,7 +176,9 @@ public boolean shouldPause(final @Nullable Event event) {
172176 private boolean shouldPause (
173177 final @ NotNull Furnace furnace ,
174178 final @ Nullable ItemStack input ,
175- final @ Nullable ItemStack result ) {
179+ final @ Nullable ItemStack result ,
180+ final @ Nullable CookingRecipe <?> recipe
181+ ) {
176182 if (!this .canPause ()) {
177183 return false ;
178184 }
@@ -182,13 +188,15 @@ private boolean shouldPause(
182188 return false ;
183189 }
184190
185- return isFreezableState (furnace .getInventory (), input , result );
191+ return isFreezableState (furnace .getInventory (), input , result , recipe );
186192 }
187193
188194 private boolean isFreezableState (
189195 final @ NotNull FurnaceInventory inventory ,
190196 final @ Nullable ItemStack input ,
191- final @ Nullable ItemStack result ) {
197+ final @ Nullable ItemStack result ,
198+ @ Nullable CookingRecipe <?> recipe
199+ ) {
192200 // Is there no input?
193201 if (ItemUtil .isEmpty (input )) {
194202 return true ;
@@ -202,7 +210,10 @@ private boolean isFreezableState(
202210 }
203211 }
204212
205- CookingRecipe <?> recipe = getRegistration ().getFurnaceRecipe (inventory );
213+ // If the recipe wasn't provided, look it up.
214+ if (recipe == null ) {
215+ recipe = getRegistration ().getFurnaceRecipe (inventory );
216+ }
206217
207218 // Does the current smelting item not have a recipe?
208219 if (recipe == null ) {
@@ -263,7 +274,7 @@ public boolean resume(boolean checkState) {
263274 }
264275
265276 FurnaceInventory inventory = furnace .getInventory ();
266- if (checkState && isFreezableState (inventory , inventory .getSmelting (), inventory .getResult ())) {
277+ if (checkState && isFreezableState (inventory , inventory .getSmelting (), inventory .getResult (), null )) {
267278 return false ;
268279 }
269280
@@ -377,7 +388,7 @@ static void update(
377388
378389 plugin .getServer ().getScheduler ().runTask (plugin , () -> {
379390 boolean shouldPause =
380- enchantableFurnace .shouldPause (furnace , inventory .getSmelting (), inventory .getResult ());
391+ enchantableFurnace .shouldPause (furnace , inventory .getSmelting (), inventory .getResult (), null );
381392 if (enchantableFurnace .isPaused () == shouldPause ) {
382393 enchantableFurnace .updating = false ;
383394 return ;
0 commit comments