Fix rollingmachine closes #1174
This commit is contained in:
parent
768da9961c
commit
faddc0089e
1 changed files with 16 additions and 14 deletions
|
@ -36,6 +36,9 @@ import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@ -45,21 +48,21 @@ public class RollingMachineRecipe {
|
||||||
private final HashMap<ResourceLocation, IRecipe> recipes = new HashMap<>();
|
private final HashMap<ResourceLocation, IRecipe> recipes = new HashMap<>();
|
||||||
|
|
||||||
public void addShapedOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
|
public void addShapedOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
|
||||||
// Validate.notNull(outputItemStack);
|
Validate.notNull(outputItemStack);
|
||||||
// Validate.notNull(outputItemStack.getItem());
|
Validate.notNull(outputItemStack.getItem());
|
||||||
// if (objectInputs.length == 0) {
|
if (objectInputs.length == 0) {
|
||||||
// Validate.notNull(null); //Quick way to crash
|
Validate.notNull(null); //Quick way to crash
|
||||||
// }
|
}
|
||||||
// recipes.put(resourceLocation, new ShapedOreRecipe(resourceLocation, outputItemStack, objectInputs));
|
recipes.put(resourceLocation, new ShapedOreRecipe(resourceLocation, outputItemStack, objectInputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addShapelessOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
|
public void addShapelessOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
|
||||||
// Validate.notNull(outputItemStack);
|
Validate.notNull(outputItemStack);
|
||||||
// Validate.notNull(outputItemStack.getItem());
|
Validate.notNull(outputItemStack.getItem());
|
||||||
// if (objectInputs.length == 0) {
|
if (objectInputs.length == 0) {
|
||||||
// Validate.notNull(null); //Quick way to crash
|
Validate.notNull(null); //Quick way to crash
|
||||||
// }
|
}
|
||||||
// recipes.put(resourceLocation, new ShapelessOreRecipe(resourceLocation, outputItemStack, objectInputs));
|
recipes.put(resourceLocation, new ShapelessOreRecipe(resourceLocation, outputItemStack, objectInputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
|
public void addRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
|
||||||
|
@ -119,8 +122,7 @@ public class RollingMachineRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
|
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
|
||||||
for (int k = 0; k < recipes.size(); k++) {
|
for (IRecipe irecipe : recipes.values()) {
|
||||||
IRecipe irecipe = recipes.get(k);
|
|
||||||
if (irecipe.matches(inv, world)) {
|
if (irecipe.matches(inv, world)) {
|
||||||
return irecipe.getCraftingResult(inv);
|
return irecipe.getCraftingResult(inv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue