Skip to content

Commit

Permalink
Add fake key copy recipe, move / rename things
Browse files Browse the repository at this point in the history
  • Loading branch information
copygirl committed Aug 7, 2014
1 parent 8acc191 commit 1b920c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
30 changes: 17 additions & 13 deletions src/main/java/net/mcft/copy/betterstorage/addon/nei/NEIAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe;
import codechicken.nei.api.API;
import codechicken.nei.recipe.DefaultOverlayHandler;
import cpw.mods.fml.common.FMLCommonHandler;
Expand All @@ -28,13 +28,6 @@ public NEIAddon() {
public void postInitialize() {
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) return;

//Fake key recipe
GameRegistry.addRecipe(new FakedShapedRecipe(2, 3, new ItemStack[]{
new ItemStack(Items.gold_nugget), new ItemStack(Items.gold_ingot),
new ItemStack(Items.gold_nugget), new ItemStack(Items.gold_ingot),
null, new ItemStack(Items.gold_ingot)},
new ItemStack(BetterStorageItems.key)));

NEIRecipeHandler handler = new NEIRecipeHandler();
API.registerRecipeHandler(handler);
API.registerUsageHandler(handler);
Expand All @@ -48,6 +41,19 @@ null, new ItemStack(Items.gold_ingot)},
new StationOverlayHandler(-8, 11), "crafting");

API.hideItem(new ItemStack(BetterStorageTiles.lockableDoor));

// Fake key recipes
GameRegistry.addRecipe(new FakeShapedRecipe(new ItemStack(BetterStorageItems.key),
".o",
".o",
" o", 'o', Items.gold_ingot,
'.', Items.gold_nugget));
GameRegistry.addRecipe(new FakeShapedRecipe(new ItemStack(BetterStorageItems.key),
".o ",
".o ",
" ok", 'o', Items.gold_ingot,
'.', Items.gold_nugget,
'k', BetterStorageItems.key));
}

private static class StationOverlayHandler extends DefaultOverlayHandler {
Expand All @@ -60,11 +66,9 @@ public boolean canMoveFrom(Slot slot, GuiContainer gui) {
}
}

private static class FakedShapedRecipe extends ShapedRecipes {
public FakedShapedRecipe(int width, int height, ItemStack[] input, ItemStack output) {
super(width, height, input, output);
}

private static class FakeShapedRecipe extends ShapedOreRecipe {
public FakeShapedRecipe(ItemStack result, Object... recipe) { super(result, recipe); }

@Override
public boolean matches(InventoryCrafting crafting, World world) { return false; }
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/mcft/copy/betterstorage/misc/Recipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import net.minecraftforge.oredict.ShapedOreRecipe;
Expand Down Expand Up @@ -141,14 +140,15 @@ private static void addItemRecipes() {

if (BetterStorageItems.key != null) {
// Key recipe
// TODO: Add support for ore dictionary gold ingots / nuggets.
GameRegistry.addRecipe(KeyRecipe.createKeyRecipe(
".o",
".o",
" o", 'o', Items.gold_ingot,
'.', Items.gold_nugget));
// Key modify recipe
GameRegistry.addRecipe(KeyRecipe.createKeyRecipe(
"k", 'k', new ItemStack(BetterStorageItems.key, 1, OreDictionary.WILDCARD_VALUE)));
"k", 'k', new ItemStack(BetterStorageItems.key)));
}

if (BetterStorageItems.lock != null) {
Expand Down

0 comments on commit 1b920c7

Please sign in to comment.