Implements some necessary code for the scrapper
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

Implements ignored salvage
Implements salvage-able items
Adds some TODOs
Implements salvage fail chance
Moves several methods to ItemHelper
Adds option for allowing extended salvage
This commit is contained in:
2023-12-30 13:56:33 +01:00
parent 6872dadca8
commit dfae68050e
13 changed files with 482 additions and 165 deletions

View File

@ -11,6 +11,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -46,7 +47,7 @@ public final class SalvageHelper {
* @return <p>The items to return to the user, or null if not salvageable</p>
*/
public static @Nullable List<ItemStack> getSalvage(@NotNull Server server, @Nullable ItemStack salvagedItem,
@NotNull List<Material> ignoredSalvage) {
@NotNull Collection<Material> ignoredSalvage) {
if (salvagedItem == null || salvagedItem.getAmount() < 1 ||
!ItemHelper.isRepairable(salvagedItem)) {
return null;
@ -71,7 +72,7 @@ public final class SalvageHelper {
* @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 List<Material> ignoredSalvage) {
@NotNull Collection<Material> ignoredSalvage) {
List<ItemStack> ingredients;
if (recipe instanceof ShapedRecipe shapedRecipe) {
ingredients = getIngredients(shapedRecipe);