本文整理匯總了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);
}
示例2: AlwaysInvalidShapelessOreRecipe
import net.minecraftforge.oredict.ShapelessOreRecipe; //導入方法依賴的package包/類
public AlwaysInvalidShapelessOreRecipe(ShapelessOreRecipe dummy){
super(new ResourceLocation(dummy.getGroup()), dummy.getIngredients(), dummy.getRecipeOutput());
}
示例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());
}
示例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; }
*/
}