From d3cc23f6a0b8ed07c49a9ce625d0c2c1cce9e72e Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Fri, 1 Sep 2017 00:32:11 -0400 Subject: [PATCH] Fix smelting vanilla xp boost. Fixes #3270 --- .../com/gmail/nossr50/listeners/InventoryListener.java | 7 +++---- src/main/java/com/gmail/nossr50/util/ItemUtils.java | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index a423f9229..d74eb6483 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -124,10 +124,8 @@ public class InventoryListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onFurnaceExtractEvent(FurnaceExtractEvent event) { Block furnaceBlock = event.getBlock(); - BlockState furnaceState = furnaceBlock.getState(); - ItemStack result = furnaceState instanceof Furnace ? ((Furnace) furnaceState).getInventory().getResult() : null; - if (!ItemUtils.isSmelted(result)) { + if (!ItemUtils.isSmelted(new ItemStack(event.getItemType(), event.getItemAmount()))) { return; } @@ -137,7 +135,8 @@ public class InventoryListener implements Listener { return; } - event.setExpToDrop(UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop())); + int exp = UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop()); + event.setExpToDrop(exp); } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java index 3e05496f7..b8a8d3d79 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java @@ -524,8 +524,8 @@ public final class ItemUtils { } for (Recipe recipe : mcMMO.p.getServer().getRecipesFor(item)) { - if (recipe instanceof FurnaceRecipe) { - return MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getData()); + if (recipe instanceof FurnaceRecipe && MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getData())) { + return true; } }