Fix smelting vanilla xp boost. Fixes #3270

This commit is contained in:
t00thpick1 2017-09-01 00:32:11 -04:00
parent 4c3f3ee4e2
commit d3cc23f6a0
2 changed files with 5 additions and 6 deletions

View File

@ -124,10 +124,8 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceExtractEvent(FurnaceExtractEvent event) { public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
Block furnaceBlock = event.getBlock(); 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; return;
} }
@ -137,7 +135,8 @@ public class InventoryListener implements Listener {
return; 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) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)

View File

@ -524,8 +524,8 @@ public final class ItemUtils {
} }
for (Recipe recipe : mcMMO.p.getServer().getRecipesFor(item)) { for (Recipe recipe : mcMMO.p.getServer().getRecipesFor(item)) {
if (recipe instanceof FurnaceRecipe) { if (recipe instanceof FurnaceRecipe && MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getData())) {
return MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getData()); return true;
} }
} }