当前位置: 首页>>代码示例>>Java>>正文


Java OreDictionary类代码示例

本文整理汇总了Java中net.minecraftforge.oredict.OreDictionary的典型用法代码示例。如果您正苦于以下问题:Java OreDictionary类的具体用法?Java OreDictionary怎么用?Java OreDictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OreDictionary类属于net.minecraftforge.oredict包,在下文中一共展示了OreDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) {
	NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);

	ModRecipes.init();

	proxy.registerEvents();
	proxy.registerEntities();
	proxy.registerRenderers();

	if (ModEntityList.hasEntitiesWithEggs()) {
		ModEntityList.entity_egg = new ItemEntityEgg();
		GameRegistry.registerItem(ModEntityList.entity_egg, "entity_egg");
		OreDictionary.registerOre("mobEgg", ModEntityList.entity_egg);
	}

	isTinkersConstructLoaded = Loader.isModLoaded("TConstruct");
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:19,代码来源:EtFuturum.java

示例2: register

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
/**
     * Attempt to register all entries from {@link #enumInstanceMap} to {@link ForgeRegistries}.
     * @see ForgeRegistries
     */
    public void register() {
        enumInstanceMap.forEach((instanceClass, enumMap) -> {
            if (IForgeRegistryEntry.class.isAssignableFrom(instanceClass))
                enumMap.values().stream().map(o -> (IForgeRegistryEntry<? extends IForgeRegistryEntry<?>>) o)
//                    .map(o -> new RegisterHandler(o))
                    .forEach(o -> {
//                    TODO RegisterManager.getInstance().putRegister(o);
                        if (o instanceof Item) {
                            ForgeRegistries.ITEMS.register((Item) o);
                            if (o instanceof OreDictated)
                                Arrays.stream(((OreDictated) o).getOreDictNames()).forEach(s -> OreDictionary.registerOre(s, (Item) o));
                        }
                        else if (o instanceof Block) {
                            ForgeRegistries.BLOCKS.register((Block) o);
                            if (o instanceof OreDictated)
                                Arrays.stream(((OreDictated) o).getOreDictNames()).forEach(s -> OreDictionary.registerOre(s, (Block) o));
                        }
                    });
            else if (Fluid.class.isAssignableFrom(instanceClass))
                enumMap.values().stream().map(o -> (Fluid) o).forEach(fluid -> {
                    FluidRegistry.registerFluid(fluid);
                    FluidRegistry.addBucketForFluid(fluid);
                });
        });
    }
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:30,代码来源:EnumLoader.java

示例3: matches

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
@Override
public boolean matches(ItemStack subject) {
	List<ItemStack> inputs = getOres();
	boolean useOreStackMeta = (meta == null);
	Item subjectItem = subject.getItem();
	int subjectMeta = subject.getItemDamage();

	for (ItemStack oreStack : inputs) {
		Item oreItem = oreStack.getItem();
		if (oreItem == null) continue; // ignore invalid

		int metaRequired = useOreStackMeta ? oreStack.getItemDamage() : meta;

		if (subjectItem == oreItem &&
				(subjectMeta == metaRequired || metaRequired == OreDictionary.WILDCARD_VALUE)) {
			return true;
		}
	}

	return false;
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:22,代码来源:RecipeInputOreDict.java

示例4: ContainerSmelter

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
public ContainerSmelter(InventoryPlayer playerInventory, TileEntitySmelter smelter) {

		for(String ore : OreDictionary.getOreNames())
			if(ore.toLowerCase().contains("ore"))
				ores.addAll(OreDictionary.getOres(ore));

		this.addSlotToContainer(new SlotSmelterInput(ores, smelter.getInventory(), 0, 56, 17));
		this.addSlotToContainer(new SlotPanOutput(playerInventory.player, smelter.getInventory(), 1, 116, 35));
		this.addSlotToContainer(new SlotPanOutput(playerInventory.player, smelter.getInventory(), 2, 140, 39));

		for (int i = 0; i < 3; ++i)
			for (int j = 0; j < 9; ++j)
				this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));

		for (int k = 0; k < 9; ++k)
			this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
	}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:18,代码来源:ContainerSmelter.java

示例5: 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;
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:22,代码来源:SlotPanInput.java

示例6: isItemValid

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
@Override
public boolean isItemValid(ItemStack stack) {
	if(!stack.isEmpty())
	{
		if(stack.getItem() instanceof ItemBlock)
		{
			for(ItemStack ore : ores)
				if(OreDictionary.itemMatches(ore, stack, false))
				{
					return true;
				}
		}
		
		else
		{
			ItemStack result = FurnaceRecipes.instance().getSmeltingResult(getStack());
			if (result.getItem().equals(Items.field_191525_da))
			{
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:25,代码来源:SlotSmelterInput.java

示例7: getRecipeInput

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
/**
 * Gets recipe input without the chars for the shape.
 */
Object[] getRecipeInput()
{
    Object[] result = new Object[getRecipeWidth() * getRecipeHeight()];

    for (int row = 0; row < shape.length; row++)
    {
        for (int col = 0; col < shape[0].length(); col++)
        {
            RecipeInput input = items.get(shape[row].charAt(col));

            int index = col + row * shape[0].length();

            if (input != null)
            {
                result[index] = input.isOreClass() ? OreDictionary.getOres(input.getOreClass().getOreName()) : input.getStack().getItemStack();
            } else
            {
                result[index] = ItemStack.EMPTY;
            }
        }
    }

    return result;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:28,代码来源:ShapedRecipe.java

示例8: getBlocksFromString

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
public static ArrayList<Block> getBlocksFromString(String blockName)
{
	ArrayList<Block> blocks = new ArrayList<>();
	if(!HarshenUtils.toArray(Blocks.AIR, null).contains(Block.getBlockFromName(blockName)))
		blocks.add(Block.getBlockFromName(blockName));
	for(ItemStack oreStack : OreDictionary.getOres(blockName))
		if(oreStack.getItem() instanceof ItemBlock)
			blocks.add(((ItemBlock)oreStack.getItem()).getBlock());
	ArrayList<Block> finalBlocks = new ArrayList<>();
	for(Block b : blocks)
	{
		NonNullList<ItemStack> items = NonNullList.create();
		b.getSubBlocks(CreativeTabs.SEARCH, items);
		for(ItemStack stack : items)
			if(!stack.isEmpty())
				finalBlocks.add(Block.getBlockFromItem(stack.getItem()));
			else
				finalBlocks.add(b);
	}
	return finalBlocks;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:22,代码来源:HarshenUtils.java

示例9: HarshenStack

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
/**
 * Used to create a list of stacks, from oreDictionary
 * @param oreDictName A list of OreDictionary value you want to use
 */
public HarshenStack(String... oreDictNames) {
	for(String oreDictName : oreDictNames)
	{
		NonNullList<ItemStack> stackList = OreDictionary.getOres(oreDictName);
		if(stackList.isEmpty())
			new IllegalArgumentException("Oredictionary vaule " + oreDictName + " doesnt exist").printStackTrace(System.out);
		else
			for(ItemStack stack : stackList)
				if(stack.getMetadata() == OreDictionary.WILDCARD_VALUE)
				{
			    		NonNullList<ItemStack> innerStacklist = NonNullList.create();
			    		stack.getItem().getSubItems(CreativeTabs.SEARCH, innerStacklist);
					for(ItemStack wildStack : innerStacklist)
						this.stackList.add(stack.copy());
				}
				else
					this.stackList.add(stack);
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:24,代码来源:HarshenStack.java

示例10: register

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
@Override
public void register(@Nonnull IModRegistry registry) {
	blacklist = registry.getJeiHelpers().getIngredientBlacklist();

	blacklistItem(new ItemStack(ModItems.DANK_NULL_HOLDER, 1, OreDictionary.WILDCARD_VALUE));

	List<ItemStack> dankNulls = new ArrayList<ItemStack>();
	dankNulls.addAll(Arrays.asList(new ItemStack(ModItems.DANK_NULL, 1, 0), new ItemStack(ModItems.DANK_NULL, 1, 1), new ItemStack(ModItems.DANK_NULL, 1, 2), new ItemStack(ModItems.DANK_NULL, 1, 3), new ItemStack(ModItems.DANK_NULL, 1, 4), new ItemStack(ModItems.DANK_NULL, 1, 5)));
	registry.addIngredientInfo(dankNulls, ItemStack.class, "jei.danknull.desc");
	registry.addIngredientInfo(new ItemStack(ModItems.DANK_NULL, 1, 0), ItemStack.class, "jei.danknull.desc0");
	registry.addIngredientInfo(new ItemStack(ModItems.DANK_NULL, 1, 1), ItemStack.class, "jei.danknull.desc1");
	registry.addIngredientInfo(new ItemStack(ModItems.DANK_NULL, 1, 2), ItemStack.class, "jei.danknull.desc2");
	registry.addIngredientInfo(new ItemStack(ModItems.DANK_NULL, 1, 3), ItemStack.class, "jei.danknull.desc3");
	registry.addIngredientInfo(new ItemStack(ModItems.DANK_NULL, 1, 4), ItemStack.class, "jei.danknull.desc4");
	registry.addIngredientInfo(new ItemStack(ModItems.DANK_NULL, 1, 5), ItemStack.class, "jei.danknull.desc5");

	registry.addIngredientInfo(new ItemStack(ModBlocks.DANKNULL_DOCK), ItemStack.class, "jei.danknull_dock.desc");

}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:20,代码来源:JEI.java

示例11: parseItemStack

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
private static ItemStack parseItemStack(String itemString)
{
    Matcher matcher = itemRegex.matcher(itemString);

    if (!matcher.matches())
    {
        ToolBelt.logger.warn("Could not parse item " + itemString);
        return ItemStack.EMPTY;
    }

    Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(matcher.group("item")));
    if (item == null)
    {
        ToolBelt.logger.warn("Could not parse item " + itemString);
        return ItemStack.EMPTY;
    }

    String anyString = matcher.group("meta");
    String metaString = matcher.group("meta");
    int meta = Strings.isNullOrEmpty(anyString)
            ? (Strings.isNullOrEmpty(metaString) ? 0 : Integer.parseInt(metaString))
            : OreDictionary.WILDCARD_VALUE;

    return new ItemStack(item, 1, meta);
}
 
开发者ID:gigaherz,项目名称:ToolBelt,代码行数:26,代码来源:Config.java

示例12: isItemStackAllowed

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
public static boolean isItemStackAllowed(final ItemStack stack)
{
    if (stack.getCount() <= 0)
        return true;

    if (whiteList.stream().anyMatch((s) -> OreDictionary.itemMatches(s, stack, false)))
        return true;

    if (blackList.stream().anyMatch((s) -> OreDictionary.itemMatches(s, stack, false)))
        return false;

    if (stack.getItem() instanceof ItemToolBelt)
        return false;

    if (stack.getMaxStackSize() != 1)
        return false;

    return true;
}
 
开发者ID:gigaherz,项目名称:ToolBelt,代码行数:20,代码来源:Config.java

示例13: initialize

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
/**
 * Method invoked by FML before any other mods are loaded.
 */
public static void initialize()
{
    FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion());

    OreDictionary.getOreName(0);

    UsernameCache.load();
    // Load before all the mods, so MC owns the MC fluids
    FluidRegistry.validateFluidRegistry();
    ForgeHooks.initTools();

    //For all the normal CrashReport classes to be defined. We're in MC's classloader so this should all be fine
    new CrashReport("ThisIsFake", new Exception("Not real"));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:MinecraftForge.java

示例14: loadLiqueurs

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
@Load
public void loadLiqueurs() {
    ForgeRegistries.ITEMS.getKeys().stream().filter(s -> s.getResourcePath().contains("liqueur")).map(ForgeRegistries.ITEMS::getValue).forEach(liqueur -> {
        for (LiqueurType liqueurType : LiqueurTypes.values()) {
            if (liqueurType == LiqueurTypes.NORMAL)
                continue;
            ItemLiqueur typedLiqueur = new ItemLiqueur(MathHelper.floor(liqueurType.getHealModifier() * ((ItemFood) liqueur).getHealAmount(new ItemStack(liqueur))));
            typedLiqueur.setLiqueurType(liqueurType);
            typedLiqueur.setRegistryName(liqueur.getRegistryName().getResourceDomain(), liqueurType.getUnlocalizedName() + "_" + liqueur.getRegistryName().getResourcePath());
            typedLiqueur.setUnlocalizedName(liqueur.getUnlocalizedName());
            ForgeRegistries.ITEMS.register(typedLiqueur);
            OreDictionary.registerOre("listAll" + StringUtils.capitalize(liqueurType.getUnlocalizedName()) + "liqueur", typedLiqueur);
            OreDictionary.registerOre("listAllliqueur", typedLiqueur);
            OreDictionary.registerOre("listAllfoods", typedLiqueur);
            cachedLiqueurs.add(typedLiqueur);
        }
    });
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:19,代码来源:LiqueurLoader.java

示例15: CachedPatternRecipe

import net.minecraftforge.oredict.OreDictionary; //导入依赖的package包/类
public CachedPatternRecipe(EnumBannerPattern pattern, String[] grid, List<Object> inputs) {
	this.pattern = pattern;

	for (int y = 0; y < 3; y++)
		for (int x = 0; x < 3; x++) {
			char c = grid[y].charAt(x);
			if (c != ' ') {
				Object input = inputs.get(inputs.indexOf(c) + 1);
				if (input instanceof String)
					input = OreDictionary.getOres((String) input);
				PositionedStack stack = new PositionedStack(input, 25 + x * 18, 6 + y * 18);
				stack.setMaxSize(1);
				ingredients.add(stack);
			}
		}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:17,代码来源:BannerPatternHandler.java


注:本文中的net.minecraftforge.oredict.OreDictionary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。