mirror of
https://github.com/GTNewHorizons/EnderCore.git
synced 2026-11-21 12:32:15 +00:00
Add some new OreDictionary helpers
This commit is contained in:
1 parent
f2ae7d4373
commit
783469229e
1 file changed
+16
-1
@@ -2,6 +2,8 @@ package com.enderio.core.common.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -13,7 +15,7 @@ public final class OreDictionaryHelper {
|
||||
public static final String INGOT_ENDERIUM = "ingotEnderium";
|
||||
|
||||
public static boolean isRegistered(String name) {
|
||||
if(!getOres(name).isEmpty()) {
|
||||
if (!getOres(name).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -42,4 +44,17 @@ public final class OreDictionaryHelper {
|
||||
return isRegistered(INGOT_ENDERIUM);
|
||||
}
|
||||
|
||||
public static String[] getOreNames(ItemStack stack) {
|
||||
int[] ids = OreDictionary.getOreIDs(stack);
|
||||
String[] ret = new String[ids.length];
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
ret[i] = OreDictionary.getOreName(ids[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static boolean hasName(ItemStack stack, String oreName) {
|
||||
return ArrayUtils.contains(getOreNames(stack), oreName);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user