Java Code Examples for net.minecraftforge.common.ForgeHooks#defaultRecipeGetRemainingItems()

The following examples show how to use net.minecraftforge.common.ForgeHooks#defaultRecipeGetRemainingItems() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecipeShapedFluid.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
	NonNullList<ItemStack> remains = ForgeHooks.defaultRecipeGetRemainingItems(inv);
	for (int i = 0; i < height * width; i++) {
		ItemStack stack = inv.getStackInSlot(i);
		NonNullList<Ingredient> matchedIngredients = this.input;
		if (matchedIngredients.get(i) instanceof IngredientFluidStack) {
			if (!stack.isEmpty()) {
				ItemStack copy = stack.copy();
				copy.setCount(1);
				remains.set(i, copy);
			}
			IFluidHandlerItem handler = FluidUtil.getFluidHandler(remains.get(i));
			if (handler != null) {
				FluidStack fluid = ((IngredientFluidStack) matchedIngredients.get(i)).getFluid();
				handler.drain(fluid.amount, true);
				remains.set(i, handler.getContainer());
			}
		}
	}
	return remains;
}
 
Example 2
Source File: RecipeJam.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(@Nonnull InventoryCrafting inv) {
	NonNullList<ItemStack> remainingItems = ForgeHooks.defaultRecipeGetRemainingItems(inv);

	ItemStack sword;
	for (int i = 0; i < inv.getSizeInventory(); i++) {
		ItemStack stack = inv.getStackInSlot(i);
		if (stack.getItem() == Items.GOLDEN_SWORD) {
			sword = stack.copy();
			sword.setItemDamage(sword.getItemDamage() + 1);
			if (sword.getItemDamage() > sword.getMaxDamage()) sword = null;
			if (sword != null) {
				remainingItems.set(i, sword);
			}
			break;
		}
	}

	return remainingItems;
}
 
Example 3
Source File: RecipeCrudeHaloInfusion.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(@Nonnull InventoryCrafting inv) {
	NonNullList<ItemStack> remainingItems = ForgeHooks.defaultRecipeGetRemainingItems(inv);

	ItemStack gluestick;
	for (int i = 0; i < inv.getSizeInventory(); i++) {
		ItemStack stack = inv.getStackInSlot(i);
		if (stack.getItem() == Items.SLIME_BALL) {
			gluestick = stack.copy();
			remainingItems.set(i, gluestick);
			break;
		}
	}

	return remainingItems;
}
 
Example 4
Source File: RecipeUnmountPearl.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(@Nonnull InventoryCrafting inv) {
	NonNullList<ItemStack> remainingItems = ForgeHooks.defaultRecipeGetRemainingItems(inv);

	for (int i = 0; i < inv.getSizeInventory(); i++) {
		ItemStack stack = inv.getStackInSlot(i);
		if (stack.getItem() instanceof IPearlSwappable) {
			remainingItems.set(i, new ItemStack(stack.getItem()));
		}
	}

	return remainingItems;
}
 
Example 5
Source File: RecipeMountPearl.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems(@Nonnull InventoryCrafting inv) {
	return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}
 
Example 6
Source File: ShapedOreRecipeTFC.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) //getRecipeLeftovers
{
	return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}
 
Example 7
Source File: ShapelessOreRecipeTFC.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) //getRecipeLeftovers
{
	return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}