diff --git a/src/main/java/com/hbm/handler/nei/ChunkyHandler.java b/src/main/java/com/hbm/handler/nei/ChunkyHandler.java new file mode 100644 index 000000000..8b087549d --- /dev/null +++ b/src/main/java/com/hbm/handler/nei/ChunkyHandler.java @@ -0,0 +1,62 @@ +package com.hbm.handler.nei; + +import org.lwjgl.opengl.GL11; + +import com.hbm.lib.RefStrings; + +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.recipe.TemplateRecipeHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.item.ItemStack; + +public class ChunkyHandler extends TemplateRecipeHandler { + + public class RecipeSet extends TemplateRecipeHandler.CachedRecipe { + + ItemStack stack; + + public RecipeSet(ItemStack stack) { + this.stack = stack.copy(); + this.stack.stackSize = 1; + } + + @Override + public PositionedStack getResult() { + return null; + } + } + + @Override + public String getRecipeName() { + return "The same thing but in big"; + } + + @Override + public String getGuiTexture() { + return RefStrings.MODID + ":textures/gui/nei/gui_nei.png"; + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + this.arecipes.add(new RecipeSet(result)); + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + this.arecipes.add(new RecipeSet(ingredient)); + } + + @Override + public void drawExtras(int recipe) { + RecipeSet rec = (RecipeSet) this.arecipes.get(recipe); + GL11.glPushMatrix(); + double scale = 10D; + GL11.glScaled(scale, scale, scale); + GuiContainerManager.drawItem(50, 50, rec.stack); //TODO: center properly + GL11.glPopMatrix(); + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; + fontRenderer.drawString("so you can really stare at it", 52, 100, 0x404040); + } +} diff --git a/src/main/java/com/hbm/handler/nei/SILEXRecipeHandler.java b/src/main/java/com/hbm/handler/nei/SILEXRecipeHandler.java index 00e0ed6a2..444489abc 100644 --- a/src/main/java/com/hbm/handler/nei/SILEXRecipeHandler.java +++ b/src/main/java/com/hbm/handler/nei/SILEXRecipeHandler.java @@ -198,7 +198,7 @@ public class SILEXRecipeHandler extends TemplateRecipeHandler { String am = ((int)(rec.produced * 10D) / 10D) + "x"; fontRenderer.drawString(am, 52 - fontRenderer.getStringWidth(am) / 2, 43, 0x404040); - String wavelength = (rec.crystalStrength == EnumWavelengths.NULL) ? EnumChatFormatting.WHITE+"N/A" : rec.crystalStrength.textColor + I18nUtil.resolveKey(rec.crystalStrength.name); + String wavelength = (rec.crystalStrength == EnumWavelengths.NULL) ? EnumChatFormatting.WHITE + "N/A" : rec.crystalStrength.textColor + I18nUtil.resolveKey(rec.crystalStrength.name); fontRenderer.drawString(wavelength, (33 - fontRenderer.getStringWidth(wavelength) / 2), 8, 0x404040); diff --git a/src/main/java/com/hbm/main/NEIConfig.java b/src/main/java/com/hbm/main/NEIConfig.java index ba4c7f9bf..c717ee070 100644 --- a/src/main/java/com/hbm/main/NEIConfig.java +++ b/src/main/java/com/hbm/main/NEIConfig.java @@ -14,6 +14,8 @@ import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; import codechicken.nei.api.IHighlightHandler; import codechicken.nei.api.ItemInfo.Layout; +import codechicken.nei.recipe.ICraftingHandler; +import codechicken.nei.recipe.IUsageHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -24,72 +26,42 @@ public class NEIConfig implements IConfigureNEI { @Override public void loadConfig() { - API.registerRecipeHandler(new AlloyFurnaceRecipeHandler()); - API.registerUsageHandler(new AlloyFurnaceRecipeHandler()); - API.registerRecipeHandler(new CentrifugeRecipeHandler()); - API.registerUsageHandler(new CentrifugeRecipeHandler()); - API.registerRecipeHandler(new GasCentrifugeRecipeHandler()); - API.registerUsageHandler(new GasCentrifugeRecipeHandler()); - API.registerRecipeHandler(new BreederRecipeHandler()); - API.registerUsageHandler(new BreederRecipeHandler()); - API.registerRecipeHandler(new ShredderRecipeHandler()); - API.registerUsageHandler(new ShredderRecipeHandler()); - API.registerRecipeHandler(new CMBFurnaceRecipeHandler()); - API.registerUsageHandler(new CMBFurnaceRecipeHandler()); - API.registerRecipeHandler(new CyclotronRecipeHandler()); - API.registerUsageHandler(new CyclotronRecipeHandler()); - API.registerRecipeHandler(new AssemblerRecipeHandler()); - API.registerUsageHandler(new AssemblerRecipeHandler()); - API.registerRecipeHandler(new RefineryRecipeHandler()); - API.registerUsageHandler(new RefineryRecipeHandler()); - API.registerRecipeHandler(new BoilerRecipeHandler()); - API.registerUsageHandler(new BoilerRecipeHandler()); - API.registerRecipeHandler(new ChemplantRecipeHandler()); - API.registerUsageHandler(new ChemplantRecipeHandler()); - API.registerRecipeHandler(new FluidRecipeHandler()); - API.registerUsageHandler(new FluidRecipeHandler()); - API.registerRecipeHandler(new PressRecipeHandler()); - API.registerUsageHandler(new PressRecipeHandler()); - API.registerRecipeHandler(new CrystallizerRecipeHandler()); - API.registerUsageHandler(new CrystallizerRecipeHandler()); - API.registerRecipeHandler(new BookRecipeHandler()); - API.registerUsageHandler(new BookRecipeHandler()); - API.registerRecipeHandler(new FusionRecipeHandler()); - API.registerUsageHandler(new FusionRecipeHandler()); - API.registerRecipeHandler(new HadronRecipeHandler()); - API.registerUsageHandler(new HadronRecipeHandler()); - API.registerRecipeHandler(new SILEXRecipeHandler()); - API.registerUsageHandler(new SILEXRecipeHandler()); - API.registerRecipeHandler(new SmithingRecipeHandler()); - API.registerUsageHandler(new SmithingRecipeHandler()); - API.registerRecipeHandler(new AnvilRecipeHandler()); - API.registerUsageHandler(new AnvilRecipeHandler()); - API.registerRecipeHandler(new FuelPoolHandler()); - API.registerUsageHandler(new FuelPoolHandler()); - API.registerRecipeHandler(new RadiolysisRecipeHandler()); - API.registerUsageHandler(new RadiolysisRecipeHandler()); - API.registerRecipeHandler(new CrucibleSmeltingHandler()); - API.registerUsageHandler(new CrucibleSmeltingHandler()); - API.registerRecipeHandler(new CrucibleAlloyingHandler()); - API.registerUsageHandler(new CrucibleAlloyingHandler()); - API.registerRecipeHandler(new CrucibleCastingHandler()); - API.registerUsageHandler(new CrucibleCastingHandler()); + registerHandler(new AlloyFurnaceRecipeHandler()); + registerHandler(new CentrifugeRecipeHandler()); + registerHandler(new GasCentrifugeRecipeHandler()); + registerHandler(new BreederRecipeHandler()); + registerHandler(new ShredderRecipeHandler()); + registerHandler(new CMBFurnaceRecipeHandler()); + registerHandler(new CyclotronRecipeHandler()); + registerHandler(new AssemblerRecipeHandler()); + registerHandler(new RefineryRecipeHandler()); + registerHandler(new BoilerRecipeHandler()); + registerHandler(new ChemplantRecipeHandler()); + registerHandler(new FluidRecipeHandler()); + registerHandler(new PressRecipeHandler()); + registerHandler(new CrystallizerRecipeHandler()); + registerHandler(new BookRecipeHandler()); + registerHandler(new FusionRecipeHandler()); + registerHandler(new HadronRecipeHandler()); + registerHandler(new SILEXRecipeHandler()); + registerHandler(new SmithingRecipeHandler()); + registerHandler(new AnvilRecipeHandler()); + registerHandler(new FuelPoolHandler()); + registerHandler(new RadiolysisRecipeHandler()); + registerHandler(new CrucibleSmeltingHandler()); + registerHandler(new CrucibleAlloyingHandler()); + registerHandler(new CrucibleCastingHandler()); + registerHandler(new ChunkyHandler()); //universal boyes - API.registerRecipeHandler(new ZirnoxRecipeHandler()); - API.registerUsageHandler(new ZirnoxRecipeHandler()); + registerHandler(new ZirnoxRecipeHandler()); if(VersatileConfig.rtgDecay()) { - API.registerRecipeHandler(new RTGRecipeHandler()); - API.registerUsageHandler(new RTGRecipeHandler()); + registerHandler(new RTGRecipeHandler()); } - API.registerRecipeHandler(new LiquefactionHandler()); - API.registerUsageHandler(new LiquefactionHandler()); - API.registerRecipeHandler(new SolidificationHandler()); - API.registerUsageHandler(new SolidificationHandler()); - API.registerRecipeHandler(new CrackingHandler()); - API.registerUsageHandler(new CrackingHandler()); - API.registerRecipeHandler(new FractioningHandler()); - API.registerUsageHandler(new FractioningHandler()); + registerHandler(new LiquefactionHandler()); + registerHandler(new SolidificationHandler()); + registerHandler(new CrackingHandler()); + registerHandler(new FractioningHandler()); //Some things are even beyond my control...or are they? API.hideItem(ItemBattery.getEmptyBattery(ModItems.memory)); @@ -183,6 +155,11 @@ public class NEIConfig implements IConfigureNEI { }); } + + public static void registerHandler(Object o) { + API.registerRecipeHandler((ICraftingHandler) o); + API.registerUsageHandler((IUsageHandler) o); + } @Override public String getName() {