From a114860793676d0a12f3a7e78fc9390e8db09987 Mon Sep 17 00:00:00 2001 From: Jason Taylor Date: Thu, 1 Feb 2018 13:56:55 -0800 Subject: [PATCH] improved readability of JEI recipes when using resource packs that alter the background texture --- assets/jei.xcf | Bin 10244 -> 17398 bytes .../integration/jei/JEICategoryMortar.java | 1 + .../jei/JEIRecipeWrapperMortar.java | 13 ++++++++++++ .../mortar/integration/jei/PluginJEI.java | 20 +++++++++++++++--- .../advancedmortars/textures/gui/jei.png | Bin 440 -> 339 bytes .../textures/gui/jei_primary.png | Bin 0 -> 187 bytes .../textures/gui/jei_secondary.png | Bin 234 -> 219 bytes 7 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/assets/advancedmortars/textures/gui/jei_primary.png diff --git a/assets/jei.xcf b/assets/jei.xcf index 4c66a722b4788679ad1b0f1bd66f669685df0a9e..65ed80b64f7dfbd3bea45e08c6412be30e04e9cf 100644 GIT binary patch literal 17398 zcmeHPO>7)V6@D|__GIjgV~FFQEY6M$A+|R5j$=EsvG+&VT0pRfMW8(_hh^;8vqp9t z*$yNEG?q9P5;u-}0f`$IBo16w;?M`+0vvX=EGI+`3j(x4#2d#hzOTA!+@17zW3S_k zmoB+#UcFaUUG?6pSFc}JQe9lWUc5QCQ2b7*G$u&v$d?HqeF8a?L2(-S#Ppm07+?n6 zh3q5$0J+=3Y!1M zmR44agXU*=wK`iVmPSe@B>X3^;_k$g?$Cd{+Gz~U)(78 zbz-HI@-J0x&94?eZN%IP1VxF#<%ESzBMak4J{5u6B5->IJ{f@v5%?5fj_Xnm0H4R? z)ad1~$};;C3%d!UZT1&n!Ygrn_BX))k+@o6Bc8n%WJk;B(HDKvt83Y}rIyY>YT5U} zjk6R&H;dl?3&?2z)N&H}3F;@3)8**qn;^k$z83&LuFdxnClaPs+Ic27VQjwEr;vXa zq8+{!^KJbqaSv?1woR$I?6p(qebS?!c!b&LSS|Z+PAAIrv#2wZ>76fE*4F2*7Omkk z2c6@+2Ho)b5b=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Q3eLK1_lO>#|#WyKsL`g1_nVD z1_lvX1_rg?3_vj1SXO27X0eRP=VjH^n5sZRKp+LgW)Gc_ z_EFrlIZJ*w6C=~)1X=0Hdo@BPFI7@kXLkUr1=YOv7>NpU3IoG0!aqeZ9{6N)X@-tN@AYKI2D+026lDfJYcQsTgA3{5K zKdKn_{LQ}VK8#Rp)rPz^Q27!d4fQbZ6kr%hpo;UZ0E&T}wYgBUiD`1ZCdcN_+Wa7M zS}Z|6g#y8=PzI85f^UJrEr=>E#K^!P%(?lzt{W57DFu^P8gLtl+(1;n`!f0^S5j;RwC2pF1vgdu(`6%)q3h{Q1yb$R6hd5KTyThfp)9E Jm>eT!005JOZ7~1< diff --git a/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEICategoryMortar.java b/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEICategoryMortar.java index 303c3d9..1a104bf 100644 --- a/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEICategoryMortar.java +++ b/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEICategoryMortar.java @@ -7,6 +7,7 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEIRecipeWrapperMortar.java b/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEIRecipeWrapperMortar.java index ccf3bb2..7b3ec6e 100644 --- a/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEIRecipeWrapperMortar.java +++ b/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/JEIRecipeWrapperMortar.java @@ -6,6 +6,7 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; @@ -18,6 +19,11 @@ public class JEIRecipeWrapperMortar implements IRecipeWrapper { + private static final ResourceLocation TEXTURE_PRIMARY_OVERLAY = new ResourceLocation( + ModuleMortar.MOD_ID, + "textures/gui/jei_primary.png" + ); + private static final ResourceLocation TEXTURE_SECONDARY_OVERLAY = new ResourceLocation( ModuleMortar.MOD_ID, "textures/gui/jei_secondary.png" @@ -59,11 +65,18 @@ public void drawInfo( Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY ) { + GlStateManager.enableBlend(); + if (this.outputs.size() > 1) { GuiHelper.drawTexturedRect(minecraft, TEXTURE_SECONDARY_OVERLAY, recipeWidth - 26, 0, 26, 54, 0, 0, 0, 26, 54); String text = Math.round(this.secondaryOutputChance * 100) + "%"; minecraft.fontRenderer.drawStringWithShadow(text, recipeWidth - 2, 32, 0xFFFFFF); + + } else { + GuiHelper.drawTexturedRect(minecraft, TEXTURE_PRIMARY_OVERLAY, recipeWidth - 26, 0, 26, 54, 0, 0, 0, 26, 54); } + + GlStateManager.disableBlend(); } } diff --git a/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/PluginJEI.java b/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/PluginJEI.java index de2fe40..095fcbb 100644 --- a/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/PluginJEI.java +++ b/src/main/java/com/codetaylor/mc/advancedmortars/modules/mortar/integration/jei/PluginJEI.java @@ -5,9 +5,15 @@ import com.codetaylor.mc.advancedmortars.modules.mortar.recipe.IRecipeMortar; import com.codetaylor.mc.advancedmortars.modules.mortar.recipe.RecipeMortar; import com.codetaylor.mc.advancedmortars.modules.mortar.reference.EnumMortarType; -import mezz.jei.api.*; +import mezz.jei.api.IJeiHelpers; +import mezz.jei.api.IModPlugin; +import mezz.jei.api.IModRegistry; +import mezz.jei.api.JEIPlugin; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.recipe.IRecipeCategoryRegistration; +import mezz.jei.gui.elements.DrawableResource; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -63,12 +69,20 @@ private JEICategoryMortar createCategory(EnumMortarType type) { private IDrawable createBackground() { - IGuiHelper guiHelper = this.jeiHelpers.getGuiHelper(); ResourceLocation resourceLocation = new ResourceLocation( ModuleMortar.MOD_ID, TEXTURE_BACKGROUND ); - return guiHelper.createDrawable(resourceLocation, 0, 0, 116, 54, 116, 54); + return new DrawableResource(resourceLocation, 0, 0, 116, 54, 0, 0, 0, 0, 116, 54) { + + @Override + public void draw(Minecraft minecraft) { + + GlStateManager.enableBlend(); + super.draw(minecraft); + GlStateManager.disableBlend(); + } + }; } private String createTitleTranslateKey(EnumMortarType type) { diff --git a/src/main/resources/assets/advancedmortars/textures/gui/jei.png b/src/main/resources/assets/advancedmortars/textures/gui/jei.png index c245934d42ecaa2baf4d9cbdba7a4bd701b883d7..84b09d2266fb071b4379ea1cbec5f47659a338da 100644 GIT binary patch delta 286 zcmdnNe3@y23O`$tx4R1i82ohJT|ZG#uKp1dqo|Ue$y&Y$pzs4v7srr_TW@dray1(W zuwBToong*xIm`U@vDT@2T&nhd_nMu;rhQDlBsoh6VhqFoQ_tJGuCXa{ZC|+dVY%pf z>tm+UJGI+ar+-ySy83C=pFg%sOXfU(T-KNHKj?XhtW>GQsm*Lsl@_N0nfLNJe6KHl zqW3oL_N5gYj1oCigWBV`wI;7MinT74T=8I$^L*(HJ|mr{7uoi&bryHyEIy%Gw^}Ae z^2aRRos)8>9@4S*+iMxH!uiU@P0pu1xGRnrRR3vnGr7XMxrFah{SyAD=uHO6?-oW* dfV%ZSySag%hEf;boEIPwPgg$|mUT`EO#mqYa$*1g delta 414 zcmV;P0b%~r0=NT^B!3BTNLh0L01meR}WE>wAQ zw1U(U73>}Ee5_ohD`cxtRX7Ga&(77V^wSdDeOkt_mU|~}Ts-9m46|~D&d{r?^!?dc ztQxZ_wEm~7_kYuif0twCNU53P&a+i<=Q}$~jTHIY{8YS!Ss_o2ka-pCYS%k+H>i4l zomQdavDzkRrHe9khAOgJhbc1yKE2(p`1{MOpuF&YSj)Y7fPhGW2MY)kXt^L5dTg2$$^SBDoOa@O^KbLh*2~7Z~5IBqg literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/advancedmortars/textures/gui/jei_secondary.png b/src/main/resources/assets/advancedmortars/textures/gui/jei_secondary.png index 5cacefb41258044ce95b7d5cc31645ab969a2eff..75fc1c9d4db9d3cf4bd0a985864b26e324e1e260 100644 GIT binary patch delta 146 zcmaFGc$;xTVErQ|Mo~rHz0Y-CGB7Y?c)B=-L>zv5&5^4?LB#dq_rtYM&)u4}?u{vz zl!rtr^X_sL`G-C%^&YoO_D$+L>~XX#?n|Hp6#Q>-x|C&|J#CR;b+W78q*s*_^z`ha v8kHA)+SAwo1XkI9-BVYspWE?nJM-!?;Y%%I`}Z+$18wzm^>bP0l+XkK_~Aaj delta 161 zcmcc3_=<5tVEscLQ6V(6Q(bN^{NHx-wf}6aJP}