mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
1.16 Support part 2
This commit is contained in:
parent
efea1c5d33
commit
1101815f18
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user