當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。