mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 21:20:12 +00:00
Initial 1.11-pre1 update
This commit is contained in:
1 parent
c177219ff3
commit
4e6a774075
294 files changed
+3099
-2846
No files matched your search
@@ -54,7 +54,7 @@ public abstract class AbstractBrewingRecipe<T> implements IBrewingRecipe {
|
||||
@Override
|
||||
public ItemStack getOutput(ItemStack input, ItemStack ingredient)
|
||||
{
|
||||
return isInput(input) && isIngredient(ingredient) ? ItemStack.copyItemStack(getOutput()) : null;
|
||||
return isInput(input) && isIngredient(ingredient) ? getOutput().copy() : null;
|
||||
}
|
||||
|
||||
public ItemStack getInput()
|
||||
|
||||
@@ -23,6 +23,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BrewingRecipeRegistry {
|
||||
|
||||
@@ -84,10 +87,11 @@ public class BrewingRecipeRegistry {
|
||||
* Returns the output ItemStack obtained by brewing the passed input and
|
||||
* ingredient. Null if no matches are found.
|
||||
*/
|
||||
public static ItemStack getOutput(ItemStack input, ItemStack ingredient)
|
||||
@Nonnull
|
||||
public static ItemStack getOutput(@Nonnull ItemStack input, ItemStack ingredient)
|
||||
{
|
||||
if (input == null || input.getMaxStackSize() != 1 || input.stackSize != 1) return null;
|
||||
if (ingredient == null || ingredient.stackSize <= 0) return null;
|
||||
if (input.func_190926_b() || input.getMaxStackSize() != 1 || input.func_190916_E() != 1) return ItemStack.field_190927_a;
|
||||
if (ingredient.func_190926_b()) return ItemStack.field_190927_a;
|
||||
|
||||
for (IBrewingRecipe recipe : recipes)
|
||||
{
|
||||
@@ -97,7 +101,7 @@ public class BrewingRecipeRegistry {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +109,7 @@ public class BrewingRecipeRegistry {
|
||||
*/
|
||||
public static boolean hasOutput(ItemStack input, ItemStack ingredient)
|
||||
{
|
||||
return getOutput(input, ingredient) != null;
|
||||
return !getOutput(input, ingredient).func_190926_b();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,13 +117,13 @@ public class BrewingRecipeRegistry {
|
||||
* Extra parameters exist to allow modders to create bigger brewing stands
|
||||
* without much hassle
|
||||
*/
|
||||
public static boolean canBrew(ItemStack[] inputs, ItemStack ingredient, int[] inputIndexes)
|
||||
public static boolean canBrew(NonNullList<ItemStack> inputs, @Nonnull ItemStack ingredient, int[] inputIndexes)
|
||||
{
|
||||
if (ingredient == null || ingredient.stackSize <= 0) return false;
|
||||
if (ingredient.func_190926_b()) return false;
|
||||
|
||||
for (int i : inputIndexes)
|
||||
{
|
||||
if (hasOutput(inputs[i], ingredient))
|
||||
if (hasOutput(inputs.get(i), ingredient))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -132,14 +136,14 @@ public class BrewingRecipeRegistry {
|
||||
* Used by the brewing stand to brew its inventory Extra parameters exist to
|
||||
* allow modders to create bigger brewing stands without much hassle
|
||||
*/
|
||||
public static void brewPotions(ItemStack[] inputs, ItemStack ingredient, int[] inputIndexes)
|
||||
public static void brewPotions(NonNullList<ItemStack> inputs, @Nonnull ItemStack ingredient, int[] inputIndexes)
|
||||
{
|
||||
for (int i : inputIndexes)
|
||||
{
|
||||
ItemStack output = getOutput(inputs[i], ingredient);
|
||||
if (output != null)
|
||||
ItemStack output = getOutput(inputs.get(i), ingredient);
|
||||
if (!output.func_190926_b())
|
||||
{
|
||||
inputs[i] = output;
|
||||
inputs.set(i, output);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,9 +152,9 @@ public class BrewingRecipeRegistry {
|
||||
* Returns true if the passed ItemStack is a valid ingredient for any of the
|
||||
* recipes in the registry.
|
||||
*/
|
||||
public static boolean isValidIngredient(ItemStack stack)
|
||||
public static boolean isValidIngredient(@Nonnull ItemStack stack)
|
||||
{
|
||||
if (stack == null || stack.stackSize <= 0) return false;
|
||||
if (stack.func_190926_b()) return false;
|
||||
|
||||
for (IBrewingRecipe recipe : recipes)
|
||||
{
|
||||
@@ -166,9 +170,9 @@ public class BrewingRecipeRegistry {
|
||||
* Returns true if the passed ItemStack is a valid input for any of the
|
||||
* recipes in the registry.
|
||||
*/
|
||||
public static boolean isValidInput(ItemStack stack)
|
||||
public static boolean isValidInput(@Nonnull ItemStack stack)
|
||||
{
|
||||
if (stack == null || stack.getMaxStackSize() != 1 || stack.stackSize != 1) return false;
|
||||
if (stack.getMaxStackSize() != 1 || stack.func_190916_E() != 1) return false;
|
||||
|
||||
for (IBrewingRecipe recipe : recipes)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user