1.16 Support part 2

This commit is contained in:
nossr50 2020-02-28 16:44:37 -08:00
parent efea1c5d33
commit 1101815f18
3 changed files with 40 additions and 2 deletions

View File

@ -266,7 +266,7 @@ public final class ItemUtils {
* @return true if the item is armor, false otherwise
*/
public static boolean isMinecraftArmor(ItemStack item) {
return isLeatherArmor(item) || isGoldArmor(item) || isIronArmor(item) || isDiamondArmor(item) || isChainmailArmor(item);
return isLeatherArmor(item) || isGoldArmor(item) || isIronArmor(item) || isDiamondArmor(item) || isNetherriteTool(item) || isChainmailArmor(item);
}
/**
@ -345,6 +345,14 @@ public final class ItemUtils {
}
}
public static boolean isNetherriteArmor(ItemStack itemStack) {
return mcMMO.getMaterialMapStore().isNetherriteArmor(itemStack.getType());
}
public static boolean isNetherriteTool(ItemStack itemStack) {
return mcMMO.getMaterialMapStore().isNetherriteTool(itemStack.getType());
}
/**
* Checks to see if an item is a chainmail armor piece.
*
@ -371,7 +379,7 @@ public final class ItemUtils {
* @return true if the item is a tool, false otherwise
*/
public static boolean isMinecraftTool(ItemStack item) {
return isStoneTool(item) || isWoodTool(item) || isGoldTool(item) || isIronTool(item) || isDiamondTool(item) || isStringTool(item) || item.getType() == Material.TRIDENT;
return isStoneTool(item) || isWoodTool(item) || isGoldTool(item) || isIronTool(item) || isDiamondTool(item) || isNetherriteTool(item) || isStringTool(item) || item.getType() == Material.TRIDENT;
}
/**

View File

@ -24,6 +24,8 @@ public class MaterialMapStore {
private HashSet<String> multiBlockPlant;
private HashSet<String> foodItemWhiteList;
private HashSet<String> glassBlocks;
private HashSet<String> netherriteArmor;
private HashSet<String> netherriteTools;
public MaterialMapStore()
{
@ -37,6 +39,8 @@ public class MaterialMapStore {
multiBlockPlant = new HashSet<>();
foodItemWhiteList = new HashSet<>();
glassBlocks = new HashSet<>();
netherriteArmor = new HashSet<>();
netherriteTools = new HashSet<>();
fillHardcodedHashSets();
}
@ -93,6 +97,20 @@ public class MaterialMapStore {
fillMultiBlockPlantSet();
fillFoodWhiteList();
fillGlassBlockWhiteList();
fillNetherriteWhiteList();
}
private void fillNetherriteWhiteList() {
netherriteTools.add("netherrite_sword");
netherriteTools.add("netherrite_axe");
netherriteTools.add("netherrite_hoe");
netherriteTools.add("netherrite_pickaxe");
netherriteTools.add("netherrite_shovel");
netherriteArmor.add("netherrite_helmet");
netherriteArmor.add("netherrite_chestplate");
netherriteArmor.add("netherrite_leggings");
netherriteArmor.add("netherrite_boots");
}
private void fillGlassBlockWhiteList() {
@ -171,6 +189,14 @@ public class MaterialMapStore {
foodItemWhiteList.add("tropical_fish");
}
public boolean isNetherriteArmor(Material material) {
return netherriteArmor.contains(material.getKey().getKey());
}
public boolean isNetherriteTool(Material material) {
return netherriteTools.contains(material.getKey().getKey());
}
public boolean isGlass(Material material) {
return glassBlocks.contains(material.getKey().getKey());
}

View File

@ -7,6 +7,10 @@ public final class MaterialUtils {
private MaterialUtils() {}
protected static boolean isOre(Material data) {
//Netherrite Ore (Kind of)
if(data.getKey().getKey().equalsIgnoreCase("ancient_debris"))
return true;
switch (data) {
case COAL_ORE:
case DIAMOND_ORE: