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


Java ShapelessOreRecipe.getIngredients方法代码示例

本文整理汇总了Java中net.minecraftforge.oredict.ShapelessOreRecipe.getIngredients方法的典型用法代码示例。如果您正苦于以下问题:Java ShapelessOreRecipe.getIngredients方法的具体用法?Java ShapelessOreRecipe.getIngredients怎么用?Java ShapelessOreRecipe.getIngredients使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.oredict.ShapelessOreRecipe的用法示例。


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

示例1: convert

import net.minecraftforge.oredict.ShapelessOreRecipe; //导入方法依赖的package包/类
public static JsonBrickOvenShapelessRecipe convert(ShapelessOreRecipe recipe)
{
	List<Object> inputs = new ArrayList<>();
	for (Object obj : recipe.getIngredients())
	{
		if (obj instanceof ItemStack)
		{
			inputs.add(obj);
		}
		else if (obj instanceof List)
		{
			try
			{
			    	@SuppressWarnings("unchecked")
				String ore = RegistryUtil.getCommonOreDictName((List<ItemStack>)obj);
				inputs.add(ore);
			}
			catch (ClassCastException ex)
			{
				LogUtil.log(Level.ERROR, "Failed to cast list in ore dictionary conversion: " + ex.toString());
			}
		}
	}

	return new JsonBrickOvenShapelessRecipe(recipe.getRecipeOutput(), inputs);
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:27,代码来源:BrickOvenConfig.java

示例2: AlwaysInvalidShapelessOreRecipe

import net.minecraftforge.oredict.ShapelessOreRecipe; //导入方法依赖的package包/类
public AlwaysInvalidShapelessOreRecipe(ShapelessOreRecipe dummy){
    super(new ResourceLocation(dummy.getGroup()), dummy.getIngredients(), dummy.getRecipeOutput());
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:4,代码来源:AlwaysInvalidShapelessRecipeFactory.java

示例3: parse

import net.minecraftforge.oredict.ShapelessOreRecipe; //导入方法依赖的package包/类
@Override
public IRecipe parse(JsonContext context, JsonObject json) {
    ShapelessOreRecipe recipe = ShapelessOreRecipe.factory(context, json);

    return new RemainBottleRecipe("mooncakecraft:remain_bottle", recipe.getRecipeOutput(), recipe.getIngredients());
}
 
开发者ID:TeamCovertDragon,项目名称:MooncakeCraft,代码行数:7,代码来源:RemainBottleRecipeFactory.java

示例4: smeltItem

import net.minecraftforge.oredict.ShapelessOreRecipe; //导入方法依赖的package包/类
/**
 * Turn one item from the furnace source stack into the appropriate smelted
 * item in the furnace result stack
 */
@SuppressWarnings("unchecked")
public void smeltItem() {
	int ammoToConsume = MathHelper.ceil(
			TF2CraftingManager.AMMO_RECIPES[this.ammoSmeltType].getRecipeOutput().getCount() * 1.2f);
	for (int i = 0; i < 9; i++) {
		ItemStack base = this.furnaceItemStacks.get(i);
		if (base != null && base.getItem() instanceof ItemAmmo && base.getItemDamage() == this.ammoSmeltType) {

			ShapelessOreRecipe recipe = TF2CraftingManager.AMMO_RECIPES[base.getItemDamage()];
			int ammoConsumed = Math.min(base.getCount(), ammoToConsume);
			base.shrink(ammoConsumed);
			ammoToConsume -= ammoConsumed;
			if (base.getCount() <= 0)
				this.setInventorySlotContents(i, ItemStack.EMPTY);

			if (ammoToConsume <= 0) {
				for (Ingredient obj : recipe.getIngredients()) {

					ItemStack out=obj.getMatchingStacks()[0];
					for (int j = 10; j < 19; j++) {
						boolean handled = false;
						ItemStack inSlot = this.getStackInSlot(j);
						if (inSlot.isEmpty()) {
							this.setInventorySlotContents(j, out.copy());
							handled = true;
						} else if (out.isItemEqual(inSlot) && ItemStack.areItemStackTagsEqual(out, inSlot)) {
							int size = out.getCount() + inSlot.getCount();

							if (size <= out.getMaxStackSize()) {
								inSlot.setCount( size);
								handled = true;
							}
						}
						if (handled)
							break;
					}
				}
				return;
			}
		}
	}
	/*
	 * ItemStack itemstack =
	 * FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]
	 * );
	 * 
	 * if (this.furnaceItemStacks[2] == null) { this.furnaceItemStacks[2] =
	 * itemstack.copy(); } else if (this.furnaceItemStacks[2].getItem() ==
	 * itemstack.getItem()) { this.furnaceItemStacks[2].getCount() +=
	 * itemstack.getCount(); // Forge BugFix: Results may have multiple items
	 * }
	 * 
	 * if (this.furnaceItemStacks[0].getItem() ==
	 * Item.getItemFromBlock(Blocks.SPONGE) &&
	 * this.furnaceItemStacks[0].getMetadata() == 1 &&
	 * this.furnaceItemStacks[1] != null &&
	 * this.furnaceItemStacks[1].getItem() == Items.BUCKET) {
	 * this.furnaceItemStacks[1] = new ItemStack(Items.WATER_BUCKET); }
	 * 
	 * --this.furnaceItemStacks[0].getCount();
	 * 
	 * if (this.furnaceItemStacks[0].getCount() <= 0) {
	 * this.furnaceItemStacks[0] = null; }
	 */
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:70,代码来源:TileEntityAmmoFurnace.java


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