diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/nei')
10 files changed, 191 insertions, 21 deletions
diff --git a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java b/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java index fe1204a661..8acd54c401 100644 --- a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java +++ b/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java @@ -2,11 +2,7 @@ package gtPlusPlus.nei; import java.awt.Rectangle; import java.lang.ref.SoftReference; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; import org.lwjgl.opengl.GL11; @@ -15,20 +11,13 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.guihook.IContainerInputHandler; import codechicken.nei.guihook.IContainerTooltipHandler; -import codechicken.nei.recipe.GuiCraftingRecipe; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.GuiUsageRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.recipe.*; import cpw.mods.fml.common.event.FMLInterModComms; import gregtech.api.enums.GT_Values; import gregtech.api.enums.OrePrefixes; import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; +import gregtech.api.util.*; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.client.Minecraft; @@ -246,7 +235,7 @@ public class GTPP_NEI_DefaultHandler extends TemplateRecipeHandler { } } if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Long.valueOf(tDuration / 20))) + " secs", -16777216); + drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); } if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index 7ef76f68b2..9885ac5474 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -78,7 +78,7 @@ public class GT_NEI_FluidReactor extends GTPP_NEI_DefaultHandler { } } if (tDuration > 0) { - drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); + drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); } if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { int aTier = (((ChemPlantDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue); diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java index dd7338eccd..3683676808 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java @@ -36,7 +36,7 @@ public class GT_NEI_LFTR extends GTPP_NEI_DefaultHandler { public void drawExtras(final int aRecipeIndex) { final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - drawText(10, 83, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); + drawText(10, 83, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); drawText(10, 93, this.mRecipeMap.mNEISpecialValuePre + MathUtils.formatNumbers((((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)) + this.mRecipeMap.mNEISpecialValuePost, -16777216); drawText(10, 103, "Dynamo: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); drawText(10, 113, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt * 4)) + " EU", -16777216); diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java index c9f9f0722a..5b8451b6b5 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java @@ -156,7 +156,7 @@ public class GT_NEI_LFTR_Sparging extends TemplateRecipeHandler { final long tDuration = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; GT_NEI_LFTR.drawText(10, 73, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); GT_NEI_LFTR.drawText(10, 83, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216); - GT_NEI_LFTR.drawText(10, 93, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Long.valueOf(tDuration / 20))) + " secs", -16777216); + GT_NEI_LFTR.drawText(10, 93, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); GT_NEI_LFTR.drawText(10, 103, "Gas not used to sparge is", -16777216); GT_NEI_LFTR.drawText(10, 113, "returned alongside outputs.", -16777216); } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java index fc2c16b423..5e62d8f3df 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MolecularTransformer.java @@ -28,7 +28,7 @@ public class GT_NEI_MolecularTransformer extends GTPP_NEI_DefaultHandler { drawText(10, 103, "Amperage: " + aRecipe.mSpecialValue, -16777216); } if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Long.valueOf(tDuration / 20))) + " secs", -16777216); + drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); } } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java index f4f69589b6..5fd6cc5b64 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java @@ -48,7 +48,7 @@ public class GT_NEI_MultiNoCell extends GTPP_NEI_DefaultHandler { drawText(10, 100, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216); } if (tDuration > 0) { - drawText(10, 110, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); + drawText(10, 110, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); } if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { drawText(10, 120, this.mRecipeMap.mNEISpecialValuePre + MathUtils.formatNumbers((((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)) + this.mRecipeMap.mNEISpecialValuePost, -16777216); diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java index e5666d84b4..fd611cbabe 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java @@ -26,7 +26,7 @@ public class GT_NEI_MultiSolarTower extends GT_NEI_MultiNoCell { public void drawExtras(final int aRecipeIndex) { final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; if (tDuration > 0) { - drawText(10, 90, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); + drawText(10, 90, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); } drawText(5, 100, "Solar Heater rings boost tier", -16777216); drawText(5, 110, "R1:T1, R2:T2, R3:T4, R4:T8, R5:T16", -16777216); diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java new file mode 100644 index 0000000000..33d5f1c884 --- /dev/null +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java @@ -0,0 +1,177 @@ +package gtPlusPlus.nei; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +import java.util.HashMap; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; +import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.core.item.ModItems; +import net.minecraft.item.ItemStack; + +public class GT_NEI_MultiTreeGrowthSimulator extends GTPP_NEI_DefaultHandler { + + private static final HashMap<Integer, Pair<Integer, Integer>> mInputSlotMap = new HashMap<Integer, Pair<Integer, Integer>>(); + private static final HashMap<Integer, Pair<Integer, Integer>> mOutputSlotMap = new HashMap<Integer, Pair<Integer, Integer>>(); + + static { + int[] aSlotX = new int[] {12, 30, 48}; + int[] aSlotY = new int[] {5, 23, 41, 64}; + // Input slots + int aIndex = 0; + for (int y=0; y<aSlotY.length;y++) { + for (int x=0; x<aSlotX.length;x++) { + mInputSlotMap.put(aIndex++, new Pair<Integer, Integer>(aSlotX[x], aSlotY[y])); + } + } + // Output slots + aSlotX = new int[] {102, 120, 138}; + aIndex = 0; + for (int y=0; y<aSlotY.length;y++) { + for (int x=0; x<aSlotX.length;x++) { + mOutputSlotMap.put(aIndex++, new Pair<Integer, Integer>(aSlotX[x], aSlotY[y])); + } + } + } + + public GT_NEI_MultiTreeGrowthSimulator() { + super(GTPP_Recipe_Map.sTreeSimFakeRecipes); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_MultiTreeGrowthSimulator(); + } + + @Override + public CachedDefaultRecipe createCachedRecipe(GT_Recipe aRecipe) { + return new TreeSimDefaultRecipe(aRecipe); + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 89); + } + + @Override + public String getGuiTexture() { + return RES_PATH_GUI + "basicmachines/FissionFuel.png"; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + if (ModItems.fluidFertBasic != null) { + drawText(5, 90, "Chance of Sapling output if", -16777216); + drawText(5, 100, ""+ModItems.fluidFertBasic.getLocalizedName()+" is provided.", -16777216); + drawText(5, 110, "This is optional.", -16777216); + } + } + + @Override + public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof CachedDefaultRecipe)) { + final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + if (ModItems.fluidFertBasic != null) { + currenttip.add("Chance output if "+ModItems.fluidFertBasic.getLocalizedName()+" is provided."); + } + break; + } + } + } + return currenttip; + } + + public class TreeSimDefaultRecipe extends CachedDefaultRecipe { + + public TreeSimDefaultRecipe(final GT_Recipe aRecipe) { + super(aRecipe); + + } + + @Override + public void handleSlots() { + + int aInputItemsCount = this.mRecipe.mInputs.length; + int aInputFluidsCount = this.mRecipe.mFluidInputs.length; + int aOutputItemsCount = this.mRecipe.mOutputs.length; + int aInputSlotsUsed = 0; + int aOutputSlotsUsed = 0; + int aSlotToCheck = 0; + + // Special Slot + if (mRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(mRecipe.mSpecialItems, 120, 52)); + } + + /* + * Items + */ + + // Upto 9 Inputs Slots + if (aInputItemsCount > 0) { + if (aInputItemsCount > 9) { + aInputItemsCount = 9; + } + for (int i=0;i<aInputItemsCount;i++) { + int x = mInputSlotMap.get(aInputSlotsUsed).getKey(); + int y = mInputSlotMap.get(aInputSlotsUsed).getValue(); + ItemStack aRepStack = mRecipe.getRepresentativeInput(aSlotToCheck++); + if (aRepStack != null) { + this.mInputs.add(new FixedPositionedStack(aRepStack, x, y)); + aInputSlotsUsed++; + } + } + } + aSlotToCheck = 0; + // Upto 9 Output Slots + if (aOutputItemsCount > 0) { + if (aOutputItemsCount > 9) { + aOutputItemsCount = 9; + } + for (int i=0;i<aOutputItemsCount;i++) { + int x = mOutputSlotMap.get(aOutputSlotsUsed).getKey(); + int y = mOutputSlotMap.get(aOutputSlotsUsed).getValue(); + ItemStack aRepStack = mRecipe.getOutput(aSlotToCheck); + if (aRepStack != null) { + this.mOutputs.add(new FixedPositionedStack(aRepStack, x, y, mRecipe.getOutputChance(aSlotToCheck))); + aOutputSlotsUsed++; + } + aSlotToCheck++; + } + } + + /* + * Fluids + */ + aInputSlotsUsed = 9; + aSlotToCheck = aInputSlotsUsed; + if (aInputFluidsCount > 0) { + for (int i=0;i<aInputFluidsCount;i++) { + int x = mInputSlotMap.get(aSlotToCheck).getKey(); + int y = mInputSlotMap.get(aSlotToCheck).getValue(); + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mRecipe.mFluidInputs[i], true), x, y)); + aSlotToCheck++; + aInputSlotsUsed++; + } + } + } + } + +} diff --git a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java index 3686cd5dba..d08f17d5fb 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java @@ -35,6 +35,7 @@ implements IConfigureNEI { mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sThermalFuels.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sSolarTowerRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sTreeSimFakeRecipes.mUnlocalizedName); // Standard GT Recipe Maps Logger.INFO("NEI Registration: "+GTPP_Recipe_Map_Internal.sMappingsEx.size()+" sMappingEx"); @@ -71,6 +72,8 @@ implements IConfigureNEI { new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sThermalFuels); Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sSolarTowerRecipes.mNEIName); new GT_NEI_MultiSolarTower(GTPP_Recipe_Map.sSolarTowerRecipes); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sTreeSimFakeRecipes.mNEIName); + new GT_NEI_MultiTreeGrowthSimulator(); Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAdvFreezerRecipes_GT); Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mNEIName); diff --git a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java index 325345fc05..4b8abc09ed 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java +++ b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java @@ -31,6 +31,7 @@ public class NEI_IMC_Sender { setNBTInfoAndSendIt("gtpp.recipe.lftr.sparging", "gregtech:gt.blockmachines:31035", 1); setNBTInfoAndSendIt("gtpp.recipe.coldtrap", "gregtech:gt.blockmachines:31034"); setNBTInfoAndSendIt("gtpp.recipe.reactorprocessingunit", "gregtech:gt.blockmachines:31032"); + setNBTInfoAndSendIt("gtpp.recipe.treefarm", "gregtech:gt.blockmachines:836"); if (LoadedMods.AdvancedSolarPanel) { setNBTInfoAndSendIt("gtpp.recipe.moleculartransformer", "AdvancedSolarPanel:BlockMolecularTransformer"); } |