mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
Closes #904
This commit is contained in:
parent
77a808ab76
commit
22f9f4440e
6 changed files with 44 additions and 36 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -11,6 +11,7 @@
|
|||
/lib
|
||||
/classes
|
||||
/bin/
|
||||
/run/
|
||||
|
||||
*.classpath
|
||||
*.project
|
||||
|
|
|
@ -24,7 +24,7 @@ if(hasProperty('buildnumber')){
|
|||
|
||||
minecraft {
|
||||
version = "1.12-14.21.1.2426"
|
||||
runDir = "idea"
|
||||
runDir = "run"
|
||||
mappings = "snapshot_20170625"
|
||||
replaceIn "ModUtil.java"
|
||||
replace "@VERSION@", project.version.toString()
|
||||
|
|
|
@ -17,9 +17,11 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
|||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -35,68 +37,70 @@ public final class CrusherCrafting{
|
|||
public static void init(){
|
||||
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), null, 0);
|
||||
final NonNullList<ItemStack> LIST = NonNullList.withSize(1, StackUtil.getNull());
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreRedstone", false), new ItemStack(Items.REDSTONE), 10, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreLapis", false), new ItemStack(Items.DYE, 1, 4), 12, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("coal", false), OreDictionary.getOres("dustCoal", false), 1, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreCoal", false), new ItemStack(Items.COAL), 3, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("blockCoal", false), new ItemStack(Items.COAL), 9, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreQuartz", false), new ItemStack(Items.QUARTZ), 3, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("cobblestone", false), new ItemStack(Blocks.SAND), 1, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreRedstone", false), new ItemStack(Items.REDSTONE), 10, StackUtil.getNull(), 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreLapis", false), new ItemStack(Items.DYE, 1, 4), 12, StackUtil.getNull(), 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("coal", false), OreDictionary.getOres("dustCoal", false), 1, LIST, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreCoal", false), new ItemStack(Items.COAL), 3, StackUtil.getNull(), 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("blockCoal", false), new ItemStack(Items.COAL), 9, StackUtil.getNull(), 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreQuartz", false), new ItemStack(Items.QUARTZ), 3, StackUtil.getNull(), 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("cobblestone", false), new ItemStack(Blocks.SAND), 1, StackUtil.getNull(), 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, LIST, 0, 0);
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), null, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), StackUtil.getNull(), 0);
|
||||
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreIron", false), OreDictionary.getOres("dustIron", false), 2, OreDictionary.getOres("dustGold", false), 1, 20);
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(Collections.singletonList(new ItemStack(Items.IRON_HORSE_ARMOR)), OreDictionary.getOres("dustIron", false), 6, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(Collections.singletonList(new ItemStack(Items.IRON_HORSE_ARMOR)), OreDictionary.getOres("dustIron", false), 6, LIST, 0, 0);
|
||||
recipeIronHorseArmor = RecipeUtil.lastCrusherRecipe();
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(Collections.singletonList(new ItemStack(Items.GOLDEN_HORSE_ARMOR)), OreDictionary.getOres("dustGold"), 6, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(Collections.singletonList(new ItemStack(Items.GOLDEN_HORSE_ARMOR)), OreDictionary.getOres("dustGold"), 6, LIST, 0, 0);
|
||||
recipeGoldHorseArmor = RecipeUtil.lastCrusherRecipe();
|
||||
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(Collections.singletonList(new ItemStack(Items.DIAMOND_HORSE_ARMOR)), OreDictionary.getOres("dustDiamond"), 6, null, 0, 0);
|
||||
ActuallyAdditionsAPI.addCrusherRecipes(Collections.singletonList(new ItemStack(Items.DIAMOND_HORSE_ARMOR)), OreDictionary.getOres("dustDiamond"), 6, LIST, 0, 0);
|
||||
recipeDiamondHorseArmor = RecipeUtil.lastCrusherRecipe();
|
||||
|
||||
CrusherRecipeRegistry.SEARCH_CASES.add(new CrusherRecipeRegistry.SearchCase("oreNether", 6));
|
||||
|
|
|
@ -269,7 +269,7 @@ public class MethodHandler implements IMethodHandler{
|
|||
ItemStack outputOneCopy = outputOne.copy();
|
||||
outputOneCopy = StackUtil.setStackSize(outputOneCopy, outputOneAmounts);
|
||||
|
||||
if(outputTwos == null || outputTwos.isEmpty()){
|
||||
if(outputTwos.isEmpty()){
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getNull(), 0);
|
||||
hasWorkedOnce = true;
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ public class MethodHandler implements IMethodHandler{
|
|||
ItemStack outputOneCopy = outputOne.copy();
|
||||
outputOneCopy = StackUtil.setStackSize(outputOneCopy, outputOneAmount);
|
||||
|
||||
if(outputTwo == null || outputTwo.isEmpty()){
|
||||
if(!StackUtil.isValid(outputTwo)){
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getNull(), 0);
|
||||
hasWorkedOnce = true;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,6 +31,7 @@ public final class CrusherRecipeRegistry{
|
|||
public static void registerFinally(){
|
||||
ArrayList<String> oresNoResult = new ArrayList<String>();
|
||||
int recipeStartedAt = ActuallyAdditionsAPI.CRUSHER_RECIPES.size();
|
||||
final NonNullList<ItemStack> LIST = NonNullList.withSize(1, StackUtil.getNull());
|
||||
|
||||
for(String ore : OreDictionary.getOreNames()){
|
||||
if(!hasException(ore)){
|
||||
|
@ -38,7 +40,7 @@ public final class CrusherRecipeRegistry{
|
|||
if(ore.substring(0, theCase.theCase.length()).equals(theCase.theCase)){
|
||||
String output = theCase.resultPreString+ore.substring(theCase.theCase.length());
|
||||
|
||||
if(!ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres(ore, false), OreDictionary.getOres(output, false), theCase.resultAmount, null, 0, 0)){
|
||||
if(!ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres(ore, false), OreDictionary.getOres(output, false), theCase.resultAmount, LIST, 0, 0)){
|
||||
if(!oresNoResult.contains(ore)){
|
||||
oresNoResult.add(ore);
|
||||
}
|
||||
|
@ -101,7 +103,7 @@ public final class CrusherRecipeRegistry{
|
|||
|
||||
public static ItemStack getOutputOnes(ItemStack input){
|
||||
CrusherRecipe recipe = getRecipeFromInput(input);
|
||||
return recipe == null ? null : recipe.outputOneStack;
|
||||
return recipe == null ? StackUtil.getNull() : recipe.outputOneStack;
|
||||
}
|
||||
|
||||
public static CrusherRecipe getRecipeFromInput(ItemStack input){
|
||||
|
@ -115,7 +117,7 @@ public final class CrusherRecipeRegistry{
|
|||
|
||||
public static ItemStack getOutputTwos(ItemStack input){
|
||||
CrusherRecipe recipe = getRecipeFromInput(input);
|
||||
return recipe == null ? null : recipe.outputTwoStack;
|
||||
return recipe == null ? StackUtil.getNull() : recipe.outputTwoStack;
|
||||
}
|
||||
|
||||
public static int getOutputTwoChance(ItemStack input){
|
||||
|
|
|
@ -36,6 +36,7 @@ public final class StackUtil{
|
|||
}
|
||||
|
||||
public static boolean isValid(ItemStack stack){//Stacks are nonnull. If we are making null stacks we're stupid anyway.
|
||||
if(stack == null) AwfulUtil.callTheFuckinPolice("Oh yeah some idiot somewhere threw a null itemstack at us, might've been us, but whatever");
|
||||
Item i = stack.getItem();
|
||||
if(i instanceof IDisableableItem) return !((IDisableableItem) i).isDisabled();
|
||||
return !stack.isEmpty();
|
||||
|
|
Loading…
Reference in a new issue