Add tridents/crossbows to salvage

This commit is contained in:
nossr50
2024-11-10 13:46:34 -08:00
parent 04eefaef79
commit b4871fe49f
10 changed files with 56 additions and 12 deletions

View File

@@ -436,6 +436,10 @@ public final class ItemUtils {
return mcMMO.getMaterialMapStore().isStringTool(item.getType().getKey().getKey());
}
public static boolean isPrismarineTool(ItemStack item) {
return mcMMO.getMaterialMapStore().isPrismarineTool(item.getType().getKey().getKey());
}
/**
* Checks to see if an item is a gold tool.
*

View File

@@ -33,6 +33,7 @@ public class MaterialMapStore {
private final @NotNull HashSet<String> ironArmor;
private final @NotNull HashSet<String> ironTools;
private final @NotNull HashSet<String> stringTools;
private final @NotNull HashSet<String> prismarineTools;
private final @NotNull HashSet<String> goldArmor;
private final @NotNull HashSet<String> goldTools;
private final @NotNull HashSet<String> chainmailArmor;
@@ -89,6 +90,7 @@ public class MaterialMapStore {
bows = new HashSet<>();
crossbows = new HashSet<>();
stringTools = new HashSet<>();
prismarineTools = new HashSet<>();
tools = new HashSet<>();
swords = new HashSet<>();
@@ -462,7 +464,7 @@ public class MaterialMapStore {
fillIronToolsWhiteList();
fillGoldToolsWhiteList();
fillDiamondToolsWhiteList();
fillnetheriteToolsWhiteList();
fillNetheriteToolsWhiteList();
fillSwords();
fillAxes();
@@ -472,6 +474,7 @@ public class MaterialMapStore {
fillTridents();
fillMaces();
fillStringTools();
fillPrismarineTools();
fillBows();
fillCrossbows();
@@ -501,6 +504,11 @@ public class MaterialMapStore {
stringTools.add("bow");
stringTools.add("fishing_rod");
stringTools.add("carrot_on_a_stick");
stringTools.add("crossbow");
}
private void fillPrismarineTools() {
prismarineTools.add("trident");
}
private void fillMaces() {
@@ -674,7 +682,7 @@ public class MaterialMapStore {
diamondTools.add("diamond_shovel");
}
private void fillnetheriteToolsWhiteList() {
private void fillNetheriteToolsWhiteList() {
netheriteTools.add("netherite_sword");
netheriteTools.add("netherite_axe");
netheriteTools.add("netherite_hoe");
@@ -976,6 +984,14 @@ public class MaterialMapStore {
return stringTools.contains(id);
}
public boolean isPrismarineTool(@NotNull Material material) {
return isPrismarineTool(material.getKey().getKey());
}
public boolean isPrismarineTool(@NotNull String id) {
return prismarineTools.contains(id);
}
public boolean isGlass(@NotNull Material material) {
return glassBlocks.contains(material.getKey().getKey());
}

View File

@@ -17,7 +17,6 @@ import java.util.concurrent.ConcurrentMap;
import static com.gmail.nossr50.util.MetadataService.*;
//TODO: Use SpawnReason where appropriate instead of MobMetaFlagType
public final class MobMetadataUtils {
private static final @NotNull ConcurrentMap<Entity, HashSet<MobMetaFlagType>> mobRegistry; //transient data
private static final @NotNull EnumMap<MobMetaFlagType, NamespacedKey> mobFlagKeyMap; //used for persistent data

View File

@@ -280,7 +280,11 @@ public final class SkillUtils {
@Nullable
public static Material getRepairAndSalvageItem(@NotNull ItemStack inHand) {
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
if (ItemUtils.isPrismarineTool(inHand)) {
return Material.PRISMARINE_CRYSTALS;
} else if (ItemUtils.isNetheriteTool(inHand) || ItemUtils.isNetheriteArmor(inHand)) {
return Material.NETHERITE_SCRAP;
} else if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
return Material.DIAMOND;
} else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
return Material.GOLD_INGOT;
@@ -306,7 +310,12 @@ public final class SkillUtils {
public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) {
int quantity = 0;
if (mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
if (mcMMO.getMaterialMapStore().isPrismarineTool(itemMaterial)) {
return 16;
}
if (mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial)
|| mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
//One netherite bar requires 4 netherite scraps
return 4;
}