diff options
author | miozune <miozune@gmail.com> | 2022-12-25 17:58:16 +0900 |
---|---|---|
committer | miozune <miozune@gmail.com> | 2022-12-25 17:58:16 +0900 |
commit | 791a450dea76b38c69eaef61b0f31007fe59c11f (patch) | |
tree | b77666b61dc2f7e8c50d2caff26990def025ca24 | |
parent | bff3786df80df1fc97779d20ce0bf633ee1f6b3b (diff) | |
download | GT5-Unofficial-791a450dea76b38c69eaef61b0f31007fe59c11f.tar.gz GT5-Unofficial-791a450dea76b38c69eaef61b0f31007fe59c11f.tar.bz2 GT5-Unofficial-791a450dea76b38c69eaef61b0f31007fe59c11f.zip |
Adapt to more NEI stuff
-rw-r--r-- | dependencies.gradle | 2 | ||||
-rw-r--r-- | src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java | 49 | ||||
-rw-r--r-- | src/main/java/com/github/technus/tectech/recipe/TT_recipe.java | 38 |
3 files changed, 35 insertions, 54 deletions
diff --git a/dependencies.gradle b/dependencies.gradle index a9729c8dad..3519695c73 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ dependencies { shadowImplementation('com.github.GTNewHorizons:AVRcore:1.0.1') - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.186-pre:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.189-pre:dev') compile("com.github.GTNewHorizons:ModularUI:1.0.16:dev") {transitive=false} compile('com.github.GTNewHorizons:Yamcl:0.5.84:dev') compile('com.github.GTNewHorizons:NotEnoughItems:2.3.7-GTNH:dev') diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java index 3e2b04c5c2..7d8e982443 100644 --- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java @@ -1,21 +1,14 @@ package com.github.technus.tectech.nei; import static com.github.technus.tectech.Reference.MODID; -import static net.minecraft.util.EnumChatFormatting.*; -import appeng.util.ReadableNumberConverter; -import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiUsageRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; -import com.github.technus.tectech.recipe.EyeOfHarmonyRecipe; import cpw.mods.fml.common.event.FMLInterModComms; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Recipe; import gregtech.nei.GT_NEI_DefaultHandler; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import org.lwjgl.opengl.GL11; public class TT_NEI_EyeOfHarmonyHandler extends GT_NEI_DefaultHandler { @@ -37,46 +30,4 @@ public class TT_NEI_EyeOfHarmonyHandler extends GT_NEI_DefaultHandler { public TemplateRecipeHandler newInstance() { return new TT_NEI_EyeOfHarmonyHandler(this.mRecipeMap); } - - @Override - protected void drawOverlays(CachedDefaultRecipe recipe) { - for (PositionedStack stack : recipe.mOutputs) { - if (!(stack instanceof FixedPositionedStack)) continue; - - EyeOfHarmonyRecipe EOHRecipe = (EyeOfHarmonyRecipe) recipe.mRecipe.mSpecialItems; - - if (EOHRecipe.getItemStackToTrueStackSizeMap().containsKey(stack.item)) { - drawOverlayForStack( - (FixedPositionedStack) stack, - EOHRecipe.getItemStackToTrueStackSizeMap().get(stack.item)); - } - } - } - - protected void drawOverlayForStack(FixedPositionedStack stack, long stackSize) { - - FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; - float smallTextScale = 0.5f; - - GL11.glPushMatrix(); - GL11.glTranslatef(stack.relx, stack.rely, 300); - GL11.glScalef(smallTextScale, smallTextScale, 1.0f); - - String displayString; - - if (stackSize > 9999) { - displayString = ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize); - } else { - displayString = String.valueOf(stackSize); - } - - fontRender.drawString( - displayString, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); - - GL11.glPopMatrix(); - - GL11.glDisable(GL11.GL_ALPHA_TEST); - - super.drawOverlayForStack(stack); - } } diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index cff23e4498..3deb049246 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -8,12 +8,14 @@ import static java.lang.Math.min; import static net.minecraft.util.EnumChatFormatting.*; import appeng.util.ReadableNumberConverter; +import codechicken.nei.PositionedStack; import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.IEMDefinition; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack; import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import com.gtnewhorizons.modularui.api.math.Alignment; import com.gtnewhorizons.modularui.api.math.Pos2d; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.common.widget.ProgressBar; @@ -586,25 +588,25 @@ public class TT_recipe extends GT_Recipe { @Override public List<Pos2d> getItemInputPositions(int itemInputCount) { - return UIHelper.getItemGridPositions(itemInputCount, 79, yOrigin, 1, 1); + return UIHelper.getGridPositions(itemInputCount, 79, yOrigin, 1, 1); } public static final int maxItemsToRender = 80; @Override public List<Pos2d> getItemOutputPositions(int itemOutputCount) { - return UIHelper.getItemGridPositions( + return UIHelper.getGridPositions( min(itemOutputCount, maxItemsToRender + 1), 7, yOrigin + 36, xDirMaxCount, 12); } @Override public List<Pos2d> getFluidInputPositions(int fluidInputCount) { - return UIHelper.getItemGridPositions(fluidInputCount, 0, 0, 0, 0); + return UIHelper.getGridPositions(fluidInputCount, 0, 0, 0, 0); } @Override public List<Pos2d> getFluidOutputPositions(int fluidOutputCount) { - return UIHelper.getItemGridPositions(fluidOutputCount, 7, yOrigin + 13 * 17 - 7 - 16, xDirMaxCount, 3); + return UIHelper.getGridPositions(fluidOutputCount, 7, yOrigin + 13 * 17 - 7 - 16, xDirMaxCount); } @Override @@ -668,5 +670,33 @@ public class TT_recipe extends GT_Recipe { return currentTip; } + + @Override + public void drawNEIOverlays(GT_NEI_DefaultHandler.CachedDefaultRecipe neiCachedRecipe) { + EyeOfHarmonyRecipe EOHRecipe = (EyeOfHarmonyRecipe) neiCachedRecipe.mRecipe.mSpecialItems; + for (PositionedStack stack : neiCachedRecipe.mInputs) { + if (stack instanceof GT_NEI_DefaultHandler.FixedPositionedStack) { + if (stack.item.isItemEqual(EOHRecipe.getRecipeTriggerItem())) { + drawNEIOverlayText("NC", stack); + } + } + } + for (PositionedStack stack : neiCachedRecipe.mOutputs) { + if (stack instanceof GT_NEI_DefaultHandler.FixedPositionedStack) { + if (EOHRecipe.getItemStackToTrueStackSizeMap().containsKey(stack.item)) { + long stackSize = + EOHRecipe.getItemStackToTrueStackSizeMap().get(stack.item); + String displayString; + if (stackSize > 9999) { + displayString = ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize); + } else { + displayString = String.valueOf(stackSize); + } + + drawNEIOverlayText(displayString, stack, 0xffffff, 0.5f, true, Alignment.BottomRight); + } + } + } + } } } |