Skip to content

Commit

Permalink
Fix Fire and Burst issues
Browse files Browse the repository at this point in the history
Not a 1.17 related issue this time around
  • Loading branch information
Geolykt committed Jun 11, 2021
1 parent aa43277 commit 0d770c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public final byte protectedBlockQuery(Block block, boolean netherstep_remove, bo
return 0;
}

@EventHandler(ignoreCancelled = true)
@EventHandler(ignoreCancelled = false)
public void onBlockInteract(PlayerInteractEvent evt) {
if (evt.getAction() == Action.PHYSICAL) {
return;
Expand Down
23 changes: 12 additions & 11 deletions src/main/java/de/geolykt/enchantments_plus/util/RecipeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.RecipeChoice;

/**
* This class has the goal of replacing the rigid CompatibilityAdapter with something more Soft-coded.<br>
Expand All @@ -43,19 +44,19 @@ private static ItemStack getSmeltedVariant(ItemStack input) {
Iterator<Recipe> recipes = Bukkit.recipeIterator();
while (recipes.hasNext()) {
Recipe recipe = recipes.next();
if (!(recipe instanceof FurnaceRecipe)) {
continue;
if (recipe instanceof FurnaceRecipe) {
RecipeChoice choice = ((FurnaceRecipe) recipe).getInputChoice();
if (!choice.test(input)) {
continue;
}
ItemStack predone = recipe.getResult();
predone.setAmount(predone.getAmount()*input.getAmount());
return predone;
}
if (((FurnaceRecipe) recipe).getInput().getType() != input.getType()) {
continue;
}
ItemStack predone = recipe.getResult();
predone.setAmount(predone.getAmount()*input.getAmount());
return predone;
}
return new ItemStack(Material.AIR);
}

/**
* Recipe cache for smelting recipes
*/
Expand All @@ -80,10 +81,10 @@ public static ItemStack getSmeltedVariant(ItemStack input, boolean updateCache)
out.setAmount(out.getAmount()*input.getAmount());
return out;
}

private static final HashMap<Material, Long> cacheDuration = new HashMap<>();
public static final int REFRESH_EVERY = 60000; // Refresh every minute

/**
* Returns the smelted Itemstack based on a given ItemStack.<br>
* Does not account for stack capacity!
Expand Down

0 comments on commit 0d770c2

Please sign in to comment.