Fix #508. Add recipe sorting

This commit is contained in:
Bartek Bok 2014-10-14 20:46:55 +02:00
parent 928ab13a9a
commit 9ce511abde
2 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe;
import openblocks.OpenBlocks.Enchantments; import openblocks.OpenBlocks.Enchantments;
@ -300,6 +301,7 @@ public class Config {
} }
recipeList.add(new CrayonMixingRecipe()); recipeList.add(new CrayonMixingRecipe());
RecipeSorter.register("openblocks:crayon_mix", CrayonMixingRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
} }
if (OpenBlocks.Blocks.fan != null) { if (OpenBlocks.Blocks.fan != null) {
@ -414,6 +416,8 @@ public class Config {
if (OpenBlocks.Items.crayonGlasses != null) { if (OpenBlocks.Items.crayonGlasses != null) {
recipeList.add(new CrayonGlassesRecipe()); recipeList.add(new CrayonGlassesRecipe());
// must be after pencil
RecipeSorter.register("openblocks:crayon_glasses", CrayonGlassesRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
} }
if (OpenBlocks.Items.technicolorGlasses != null) { if (OpenBlocks.Items.technicolorGlasses != null) {
@ -473,9 +477,11 @@ public class Config {
if (OpenBlocks.Items.emptyMap != null) { if (OpenBlocks.Items.emptyMap != null) {
if (OpenBlocks.Items.heightMap != null) { if (OpenBlocks.Items.heightMap != null) {
recipeList.add(new MapCloneRecipe()); recipeList.add(new MapCloneRecipe());
RecipeSorter.register("openblocks:map_clone", MapCloneRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
} }
recipeList.add(new MapResizeRecipe()); recipeList.add(new MapResizeRecipe());
RecipeSorter.register("openblocks:map_resize", MapResizeRecipe.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped");
ItemStack memory = MetasGeneric.mapMemory.newItemStack(2); ItemStack memory = MetasGeneric.mapMemory.newItemStack(2);
ItemStack cpu = MetasGeneric.mapController.newItemStack(1); ItemStack cpu = MetasGeneric.mapController.newItemStack(1);
@ -489,6 +495,7 @@ public class Config {
if (OpenBlocks.Items.goldenEye != null) { if (OpenBlocks.Items.goldenEye != null) {
recipeList.add(new GoldenEyeRechargeRecipe()); recipeList.add(new GoldenEyeRechargeRecipe());
RecipeSorter.register("openblocks:golden_eye_recharge", GoldenEyeRechargeRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Items.goldenEye, 1, ItemGoldenEye.MAX_DAMAGE), "ggg", "geg", "ggg", 'g', Items.gold_nugget, 'e', Items.ender_eye)); recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Items.goldenEye, 1, ItemGoldenEye.MAX_DAMAGE), "ggg", "geg", "ggg", 'g', Items.gold_nugget, 'e', Items.ender_eye));
} }

View File

@ -6,6 +6,7 @@ import net.minecraft.init.Items;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import openblocks.OpenBlocks; import openblocks.OpenBlocks;
import openblocks.common.item.ItemImaginary; import openblocks.common.item.ItemImaginary;
@ -58,7 +59,8 @@ public class CrayonGlassesRecipe extends ShapelessRecipes {
for (int i = 0; i < inv.getSizeInventory(); i++) { for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i); ItemStack stack = inv.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof ItemImaginary) { if (stack != null && stack.getItem() instanceof ItemImaginary) {
Integer color = ItemUtils.getInt(stack, ItemImaginary.TAG_COLOR); NBTTagCompound tag = ItemUtils.getItemTag(stack);
int color = tag.getInteger(ItemImaginary.TAG_COLOR);
return OpenBlocks.Items.crayonGlasses.createCrayonGlasses(color); return OpenBlocks.Items.crayonGlasses.createCrayonGlasses(color);
} }
} }