Makes ActionStartEvent give duration in ticks instead of end time
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2024-07-29 01:40:08 +02:00
parent 523e4cb47a
commit afb608b609
5 changed files with 43 additions and 47 deletions

View File

@ -184,15 +184,12 @@ public final class SalvageHelper {
}
/**
* Gets the salvage resulting from the given recipe and the given item
* Gets the raw salvage of a recipe, assuming full salvage would be possible
*
* @param recipe <p>The recipe to get salvage for</p>
* @param salvagedItem <p>The item to be salvaged</p>
* @param trashSalvage <p>Any material treated as trash salvage</p>
* @return <p>A list of items, or null if not a valid type of recipe</p>
* @param recipe <p>The recipe to get salvage for</p>
* @return <p>The salvage resulting from the recipe</p>
*/
private static @Nullable List<ItemStack> getRecipeSalvage(@NotNull Recipe recipe, @NotNull ItemStack salvagedItem,
@NotNull Collection<Material> trashSalvage) {
private static List<ItemStack> getRawRecipeSalvage(@NotNull Recipe recipe) {
List<ItemStack> ingredients;
if (recipe instanceof ShapedRecipe shapedRecipe) {
ingredients = getIngredients(shapedRecipe);
@ -203,8 +200,23 @@ public final class SalvageHelper {
return null;
}
//Make things easier by eliminating identical stacks
ingredients = combineStacks(ingredients);
return combineStacks(ingredients);
}
/**
* Gets the salvage resulting from the given recipe and the given item
*
* @param recipe <p>The recipe to get salvage for</p>
* @param salvagedItem <p>The item to be salvaged</p>
* @param trashSalvage <p>Any material treated as trash salvage</p>
* @return <p>A list of items, or null if not a valid type of recipe</p>
*/
private static @Nullable List<ItemStack> getRecipeSalvage(@NotNull Recipe recipe, @NotNull ItemStack salvagedItem,
@NotNull Collection<Material> trashSalvage) {
List<ItemStack> ingredients = getRawRecipeSalvage(recipe);
if (ingredients == null) {
return null;
}
return combineStacks(getSalvage(copyItems(ingredients), salvagedItem, trashSalvage));
}