本文整理汇总了Java中net.minecraft.item.crafting.IRecipe.getRemainingItems方法的典型用法代码示例。如果您正苦于以下问题:Java IRecipe.getRemainingItems方法的具体用法?Java IRecipe.getRemainingItems怎么用?Java IRecipe.getRemainingItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.crafting.IRecipe
的用法示例。
在下文中一共展示了IRecipe.getRemainingItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: innerUpdate
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
@Override
protected void innerUpdate() {
if (this.world.isRemote) return;
++tick;
if (crafting.getLocked() && tick >= 40 && hasOnlyOneFluid()) {
Fluid fluid = getRecipeFluid();
if (fluid == null) return;
int bucketAmount = getFluidAmount(fluid);
FluidStack stack = tank.drain(bucketAmount * 1000, false);
if (stack != null && stack.getFluid().equals(fluid) && stack.amount == bucketAmount * 1000) {
IRecipe recipe = CraftingUtils.findRecipe(world, simulateRecipeEntries(fluid));
if (recipe == null || recipe.getRecipeOutput().isEmpty()) return;
if (ItemHandlerHelper.insertItem(this.output, recipe.getRecipeOutput().copy(), true).isEmpty() && areAllSolidsPresent(fluid)) {
NonNullList<ItemStack> remaining = recipe.getRemainingItems(CraftingUtils.genCraftingInventory(world, simulateRecipeEntries(fluid)));
for (int i = 0; i < crafting.getSlots(); ++i) {
if (isStackCurrentFluid(fluid, crafting.getFilterStack(i))) continue;
if (remaining.get(i).isEmpty()) crafting.getStackInSlot(i).shrink(1);
else crafting.setStackInSlot(i, remaining.get(i).copy());
}
tank.drain(bucketAmount * 1000, true);
ItemHandlerHelper.insertItem(this.output, recipe.getRecipeOutput().copy(), false);
}
}
tick = 0;
}
}
示例2: getRemainingItems
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting craftMatrix, World worldIn) {
for (IRecipe irecipe : this.recipes)
if (irecipe.matches(craftMatrix, worldIn))
return irecipe.getRemainingItems(craftMatrix);
NonNullList<ItemStack> aitemstack = NonNullList.withSize(craftMatrix.getSizeInventory(),ItemStack.EMPTY);
for (int i = 0; i < aitemstack.size(); ++i)
aitemstack.set(i,craftMatrix.getStackInSlot(i));
return aitemstack;
}