本文整理汇总了Java中net.minecraftforge.oredict.OreDictionary.getOreIDs方法的典型用法代码示例。如果您正苦于以下问题:Java OreDictionary.getOreIDs方法的具体用法?Java OreDictionary.getOreIDs怎么用?Java OreDictionary.getOreIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.oredict.OreDictionary
的用法示例。
在下文中一共展示了OreDictionary.getOreIDs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isItemValid
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@Override
public boolean isItemValid(ItemStack stack) {
if(!stack.isEmpty())
{
boolean flag = false;
int[] ids = OreDictionary.getOreIDs(stack);
for(int id: ids)
if(OreDictionary.getOreName(id).contains("food")){
flag = true;
break;
}
if(stack.getItem() instanceof ItemFood || flag)
{
if(!FurnaceRecipes.instance().getSmeltingResult(stack).isEmpty())
{
return true;
}
}
}
return false;
}
示例2: matchStack
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
private boolean matchStack(ItemStack stack, Set<Integer> ores, ItemStack s) {
if (ItemStackTools.isValid(s)) {
if (s.getItem() == stack.getItem()) {
return true;
}
if (!ores.isEmpty()) {
int[] iDs = OreDictionary.getOreIDs(s);
for (int d : iDs) {
if (ores.contains(d)) {
return true;
}
}
}
}
return false;
}
示例3: isItemValid
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
/**
* Check if the stack is a valid item for this slot. Always true beside for
* the armor slots.
*/
@Override
public boolean isItemValid(@Nonnull ItemStack stack) {
if (itemAllowed != null) {
Item item = stack.isEmpty() ? null : stack.getItem();
return item == itemAllowed;
} else {
int[] ids = OreDictionary.getOreIDs(stack);
for (int id : ids) {
if (id == oreDictEntry) return true;
if (dye && TileEntityPlasticMixer.getDyeIndex(stack) >= 0) return true;
}
return false;
}
}
示例4: getOreNames
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static List<String> getOreNames(ItemStack stack)
{
List<String> res = new ArrayList<>();
for (int id : OreDictionary.getOreIDs(stack))
{
res.add(OreDictionary.getOreName(id));
}
return res;
}
示例5: getDyeIndex
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static int getDyeIndex(ItemStack stack) {
int[] ids = OreDictionary.getOreIDs(stack);
for (int id : ids) {
String name = OreDictionary.getOreName(id);
for (int i = 0; i < DYES.length; i++) {
if (DYES[i].equals(name)) return i;
}
}
return -1;
}
示例6: matchesOreDict
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static boolean matchesOreDict(ItemStack stack, String oreDictName)
{
if(stack.isEmpty()) return false;
int checkid = OreDictionary.getOreID(oreDictName);
for (int id:OreDictionary.getOreIDs(stack)) {
if(id == checkid) return true;
}
return false;
}
示例7: isStackOreDict
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static boolean isStackOreDict(ItemStack stack, String string) {
if (stack.isEmpty()) return false;
int id = OreDictionary.getOreID(string);
for (int i : OreDictionary.getOreIDs(stack)) {
if (i == id) return true;
}
return false;
}
示例8: isOre
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static boolean isOre(ItemStack stack) {
if (stack.isEmpty()) return false;
for (int i : OreDictionary.getOreIDs(stack)) {
if (OreDictionary.getOreName(i).startsWith("ore")) return true;
}
return false;
}
示例9: matches
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@Override
public boolean matches(ItemStack stackGiven)
{
for(int id : OreDictionary.getOreIDs(stackGiven))
{
if(oreDictionaryEntry.equals(OreDictionary.getOreName(id))) return true;
}
return false;
}
示例10: isBlockOreDict
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static boolean isBlockOreDict(World world, BlockPos pos, String ore) {
IBlockState state = world.getBlockState(pos);
Item item = Item.getItemFromBlock(state.getBlock());
if (!item.equals(Items.AIR)) {
ItemStack stack = new ItemStack(item);
int id = OreDictionary.getOreID(ore);
for (int i : OreDictionary.getOreIDs(stack)) {
if (i == id) return true;
}
}
return false;
}
示例11: hasColor
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@Override
protected boolean hasColor(ItemStack stack) {
int[] ids = OreDictionary.getOreIDs(stack);
for (int id : ids) {
if (ArrayUtils.contains(PonySocks.dyeOreIds, id)) {
return true;
}
}
return false;
}
示例12: getOreEntries
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@Override
public List<OreDictionaryEntry> getOreEntries(ItemStack itemStack) {
int[] ids = OreDictionary.getOreIDs(CraftItemStack.asNMSCopy(itemStack));
ImmutableList.Builder<OreDictionaryEntry> builder = ImmutableList.builder();
for (int id : ids) {
builder.add(OreDictionaryEntry.valueOf(id));
}
return builder.build();
}
示例13: cacheOre
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
private static void cacheOre(Block b, int meta) {
List key = Arrays.asList(b, meta);
if (!name_cache.containsKey(key) && b != Blocks.stone && b != Blocks.air && b != Blocks.dirt && b != Blocks.grass && b != Blocks.gravel) {
String name = null;
float value = 1f;
int[] ids = OreDictionary.getOreIDs(new ItemStack(b, 1, meta));
if (ids.length > 0) {
String dict_name = OreDictionary.getOreName(ids[0]);
if (dict_name.length() > 3 && dict_name.substring(0, 3).equals("ore")) {
dict_name = dict_name.substring(3);
if (dict_name.length() > 4 && dict_name.substring(0, 4).equals("Poor")) {
dict_name = dict_name.substring(4);
value = (1f/9f);
}
} else if (dict_name.length() > 8 && dict_name.substring(0, 8).equals("denseore")) {
dict_name = dict_name.substring(8);
value = 3f;
}
String norm = normalizeName(dict_name);
if (hasNugget(norm)) {
Prospecting.logger.info("Parsed name: " + norm);
Prospecting.logger.info("Amount: " + value);
name_cache.put(key, norm);
value_cache.put(key, value);
}
}
}
}
示例14: getColor
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@Override
protected int getColor(ItemStack stack) {
int[] ids = OreDictionary.getOreIDs(stack);
for (int id : ids) {
for (int i = 0; i < 16; i++) {
if (id == PonySocks.dyeOreIds[i]) {
return fromFloats(EntitySheep.getDyeRgb(EnumDyeColor.byDyeDamage(i)));
}
}
}
throw new RuntimeException("Shouldn't happen!");
}
示例15: findFromOreDict
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public List<MaterialDefinition> findFromOreDict(World world, ItemStack stack) {
List<String> names = new ArrayList<>();
for(int index : OreDictionary.getOreIDs(stack)) {
names.add(OreDictionary.getOreName(index));
}
return RandoresWorldData.getAll(RandoresWorldData.getId(world)).stream().filter(def -> !names.contains(def.getMaterial().getType().getDictName() + def.getName())).collect(Collectors.toList());
}