From c9daf24aad31c4c33574116bc68aa79a2ef48288 Mon Sep 17 00:00:00 2001 From: slprime <31038811+slprime@users.noreply.github.com> Date: Fri, 27 Jun 2025 11:43:23 +0300 Subject: [PATCH] ME, FC, WC Terminals (#42) Co-authored-by: slprime --- dependencies.gradle | 28 +- gradle.properties | 6 +- gradle/wrapper/gradle-wrapper.jar | Bin 43583 -> 43705 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 5 +- settings.gradle | 2 +- .../com/github/vfyjxf/nee/NEINeeConfig.java | 164 +++++- .../nee/block/BlockPatternInterface.java | 2 +- .../nee/block/tile/TilePatternInterface.java | 7 +- .../vfyjxf/nee/client/GuiEventHandler.java | 468 +++++++++------- .../nee/client/NEEContainerDrawHandler.java | 271 --------- .../nee/client/gui/GuiCraftingAmount.java | 278 --------- .../container/ContainerCraftingAmount.java | 68 --- .../container/ContainerCraftingConfirm.java | 46 -- .../container/ContainerPatternInterface.java | 2 - .../WCTContainerCraftingConfirm.java | 46 -- .../vfyjxf/nee/nei/NEECraftingHandler.java | 321 ----------- .../vfyjxf/nee/nei/NEECraftingHelper.java | 332 ----------- .../nee/nei/NEECraftingPreviewHandler.java | 406 ++++++++++++++ .../nee/nei/NEECraftingTerminalHandler.java | 191 +++++++ .../nee/nei/NEEExtremeAutoCrafterHandler.java | 83 +++ .../nee/nei/NEEKnowledgeInscriberHandler.java | 184 ++++++ .../nee/nei/NEEPatternTerminalHandler.java | 294 ++++++++++ .../NEETerminalBookmarkContainerHandler.java | 43 ++ .../nee/nei/NEETerminalOverlayButton.java | 151 +++++ .../vfyjxf/nee/network/NEEGuiHandler.java | 185 +----- .../vfyjxf/nee/network/NEENetworkHandler.java | 14 +- .../network/packet/PacketArcaneRecipe.java | 33 ++ .../network/packet/PacketCraftingRequest.java | 528 +++++++++--------- .../nee/network/packet/PacketNEIBookmark.java | 142 +++++ .../packet/PacketNEIPatternRecipe.java | 138 +++-- .../network/packet/PacketOpenCraftAmount.java | 91 --- .../nee/network/packet/PacketOpenGui.java | 10 +- .../nee/network/packet/PacketSetRecipe.java | 144 ----- .../network/packet/PacketSlotStackChange.java | 12 +- .../packet/PacketStackCountChange.java | 25 +- .../packet/PacketValueConfigClient.java | 26 +- .../packet/PacketValueConfigServer.java | 43 +- .../github/vfyjxf/nee/proxy/ClientProxy.java | 19 +- .../com/github/vfyjxf/nee/utils/GuiUtils.java | 158 ++++-- .../vfyjxf/nee/utils/IngredientTracker.java | 148 +---- .../github/vfyjxf/nee/utils/ItemUtils.java | 21 +- .../com/github/vfyjxf/nee/utils/ModIDs.java | 1 + .../assets/neenergistics/lang/en_US.lang | 11 +- .../assets/neenergistics/lang/ru_RU.lang | 6 +- .../assets/neenergistics/lang/zh_CN.lang | 9 +- .../neenergistics/textures/gui/states.png | Bin 1238 -> 1419 bytes 47 files changed, 2484 insertions(+), 2680 deletions(-) delete mode 100644 src/main/java/com/github/vfyjxf/nee/client/NEEContainerDrawHandler.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/client/gui/GuiCraftingAmount.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingAmount.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingConfirm.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/container/WCTContainerCraftingConfirm.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHelper.java create mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEECraftingPreviewHandler.java create mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEECraftingTerminalHandler.java create mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEEExtremeAutoCrafterHandler.java create mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEEKnowledgeInscriberHandler.java create mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEEPatternTerminalHandler.java create mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEETerminalBookmarkContainerHandler.java create mode 100644 src/main/java/com/github/vfyjxf/nee/nei/NEETerminalOverlayButton.java create mode 100644 src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIBookmark.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenCraftAmount.java delete mode 100644 src/main/java/com/github/vfyjxf/nee/network/packet/PacketSetRecipe.java diff --git a/dependencies.gradle b/dependencies.gradle index 76a74f0..6b46597 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,26 +1,22 @@ dependencies { - api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-521-GTNH:dev") - api("com.github.GTNewHorizons:NotEnoughItems:2.7.18-GTNH:dev") + api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-619-GTNH:dev") + api("com.github.GTNewHorizons:NotEnoughItems:2.7.49-GTNH:dev") + api('com.github.GTNewHorizons:CodeChickenCore:1.4.2:dev') - implementation("com.github.GTNewHorizons:Baubles:1.0.4:dev") - implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") + implementation("com.github.GTNewHorizons:Baubles-Expanded:2.1.8-GTNH:dev") + implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.3:dev") + implementation("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.76-gtnh:dev") - compileOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.21-gtnh:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.318:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Avaritia:1.63:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.8.4-GTNH:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:BuildCraftCompat:7.1.17:dev") { transitive = false } - compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev') { transitive=false } - compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.1:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.73:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.7.4-GTNH:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.21-gtnh:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.8.4-GTNH:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:BuildCraftCompat:7.1.17:dev") { transitive = false } - compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev') {transitive=false} - compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.1:dev") { transitive = false } + compileOnly('com.github.GTNewHorizons:EnderIO:2.9.16:dev') {transitive=false} + compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.10:dev") { transitive = false } compileOnly("com.github.GTNewHorizons:GTplusplus:1.12.11:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.7.4-GTNH:dev") { transitive = false } - compileOnly("com.github.GTNewHorizons:Botania:1.12.3-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.7.7-GTNH:dev") { transitive = false } + compileOnly("com.github.GTNewHorizons:Botania:1.12.10-GTNH:dev") { transitive = false } compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") { transitive = false } compileOnly("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false } compileOnly("curse.maven:thermal-expansion-69163:2388759") { transitive = false } diff --git a/gradle.properties b/gradle.properties index ad06290..e8735b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ modId = neenergistics modGroup = com.github.vfyjxf.nee # Whether to use modGroup as the maven publishing group. -# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods. +# When false, com.github.GTNewHorizons is used. useModGroupForPublishing = false # Updates your build.gradle and settings.gradle automatically whenever an update is available. @@ -41,11 +41,11 @@ developmentEnvironmentUserName = Developer # Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8. # See https://github.com/bsideup/jabel for details on how this works. -enableModernJavaSyntax = false +enableModernJavaSyntax = true # Enables injecting missing generics into the decompiled source code for a better coding experience. # Turns most publicly visible List, Map, etc. into proper List, Map types. -enableGenericInjection = false +enableGenericInjection = true # Generate a class with a String field for the mod version named as defined below. # If generateGradleTokenClass is empty or not missing, no such class will be generated. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9530d66f5e68d973ea569d8e19de379189..9bbc975c742b298b441bfb90dbc124400a3751b9 100644 GIT binary patch delta 34744 zcmXuJV_+R@)3u$(Y~1X)v28cDZQE*`9qyPrXx!Mg8{4+s*nWFo&-eX5|IMs5>pW(< z=OJ4cAZzeZfy=9lI!r-0aXh8xKdlGq)X)o#ON+mC6t7t0WtgR!HN%?__cvdWdtQC< zrFQ;?l@%CxY55`8y(t7?1P_O7(6pv~(~l!kHB;z2evtUsGHzEDL+y4*no%g#AsI~i zJ%SFMv{j__Yaxnn2NtDK+!1XZX`CB}DGMIT{#8(iAk*`?VagyHx&|p8npkmz=-n!f z3D+^yIjP`D&Lfz500rpq#dJE`vM|-N7=`uN0z86BpiMcCOCS^;6CUG4o1I)W{q6Gv z1vZB6+|7An``GNoG7D!xJGJd_Qv(M-kdVdsIJ?CrXFEH^@Ts83}QX}1%P6KQFNz^-=) z<|qo#qmR!Nonr$p*Uu1Jo2c~KLTrvc*Yw%L+`IL}y|kd+t{NCrXaP=7C00CO?=pgp z!fyr#XFfFXO6z2TP5P1W{H_`$PKzUiGtJd!U52%yAJf}~tgXF`1#}@y`cZl9y{J-A zyUA&-X)+^N?W=2Fm_ce2w$C6>YWp7MgXa{7=kwwy9guBx26=MnPpuSt zB4}vo3{qxa+*{^oHxe7;JMNMp>F`iNv>0!MsFtnb+5eEZ$WI z0M9}rA&cgQ^Q8t_ojofiHaKuhvIB{B9I}3`Dsy3vW8ibigX}Kc912|UZ1uhH?RuHU=i&ePe2w%65)nBkHr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a{LWl(}xNs*L|lqZ_YV_D(#0Z&u%0rJSw3cc&kg zTTm!^QnsnpO-XUv+E03`riaII-*pXraqE>~$i|mBB|)aSMoyPc3anhatYF66U$rZK z@Pj%~f{}?Yf+zRPUCBB*p(;Xgvemp~mc!G9W=>u>PmIY$U~=F*naQ;RqLUx26kvti zt^R+WC=uynoD+HdCGWoQ!JlHzW4QPvi zy~J8z4dn~9WW=t+?#W_cFh)`QKm$p!HY@l>rpW?}M47_1;Syepv}BO) z$+1T4#Ch@z3~DGQ#h6Y$uviIrMFm75 z_%L*!57z*(4vNChmOzE>vXH}}85rgOPp3!q)hcU-$qx2Xliyn_gY1-rpH~bFEJqZh zgzZ5py}_#B$KL`~*`cTsa%7ln@8|(`KjI`-1_pf;RUXchA1oD}+`rUR8gbAhx`j5A z?=OvI1)s+^*>RaD(_NscOXVhOdMbiVM;w*|Je&{3bX^~yLfOd=mdVS&4_g5`R2N0j zt5C2L43-axH1|&#=Wr3=B#r3YSm5zuZm+d94eoZBHsE zKUgk1*`f-PT@V9^3=9e=25qVaDwLVLbA`MNVnm36K^{dBLpRu2{@vi5DT5dWK~EIW&pHfkaU4roNf6g>=uCr>T__Rcg`=}3c15@4P_ a%EQ2*fnt2> /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -206,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. diff --git a/settings.gradle b/settings.gradle index 7a562ea..ff436f2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.31' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38' } diff --git a/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java b/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java index 560d89e..edf0392 100644 --- a/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java +++ b/src/main/java/com/github/vfyjxf/nee/NEINeeConfig.java @@ -12,11 +12,15 @@ import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTermi import org.lwjgl.input.Keyboard; import com.github.vfyjxf.nee.client.GuiEventHandler; -import com.github.vfyjxf.nee.nei.NEECraftingHandler; -import com.github.vfyjxf.nee.nei.NEECraftingHelper; +import com.github.vfyjxf.nee.nei.NEECraftingTerminalHandler; +import com.github.vfyjxf.nee.nei.NEEExtremeAutoCrafterHandler; +import com.github.vfyjxf.nee.nei.NEEKnowledgeInscriberHandler; +import com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler; +import com.github.vfyjxf.nee.nei.NEETerminalBookmarkContainerHandler; import com.github.vfyjxf.nee.processor.IRecipeProcessor; import com.github.vfyjxf.nee.processor.RecipeProcessor; import com.github.vfyjxf.nee.utils.ModIDs; +import com.glodblock.github.client.gui.GuiFluidCraftingWireless; import com.glodblock.github.client.gui.GuiFluidPatternExWireless; import com.glodblock.github.client.gui.GuiFluidPatternTerminal; import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx; @@ -24,6 +28,8 @@ import com.glodblock.github.client.gui.GuiFluidPatternWireless; import appeng.client.gui.implementations.GuiCraftingTerm; import appeng.client.gui.implementations.GuiInterface; +import appeng.client.gui.implementations.GuiMEMonitorable; +import appeng.client.gui.implementations.GuiMEPortableCell; import appeng.client.gui.implementations.GuiPatternTerm; import appeng.client.gui.implementations.GuiPatternTermEx; import codechicken.nei.NEIController; @@ -31,7 +37,10 @@ import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.recipe.DefaultOverlayHandler; import cpw.mods.fml.common.Loader; +import fox.spiteful.avaritia.gui.GUIExtremeCrafting; +import thaumicenergistics.client.gui.GuiArcaneCraftingTerminal; import thaumicenergistics.client.gui.GuiKnowledgeInscriber; import wanion.avaritiaddons.block.extremeautocrafter.GuiExtremeAutoCrafter; @@ -58,22 +67,26 @@ public class NEINeeConfig implements IConfigureNEI { for (String ident : identifiers) { API.registerGuiOverlay(GuiPatternTerm.class, ident); - API.registerGuiOverlayHandler(GuiPatternTerm.class, NEECraftingHandler.INSTANCE, ident); + API.registerGuiOverlayHandler(GuiPatternTerm.class, NEEPatternTerminalHandler.instance, ident); } installCraftingTermSupport(); installWirelessCraftingTermSupport(); - installFluidPatternTerminalSupport(new HashSet(identifiers)); + installFluidPatternTerminalSupport(new HashSet<>(identifiers)); installThaumicEnergisticsSupport(); + installAvaritiaSupport(); + installAvaritiaddonsSupport(); - installPatternTerminalExSupport(new HashSet(identifiers)); + installPatternTerminalExSupport(new HashSet<>(identifiers)); - installFluidPatternTerminalExSupport(new HashSet(identifiers)); + installFluidPatternTerminalExSupport(new HashSet<>(identifiers)); + + installlBookmarkContainerHandler(); } private void installFluidPatternTerminalExSupport(Set identifiers) { @@ -83,8 +96,15 @@ public class NEINeeConfig implements IConfigureNEI { for (String ident : identifiers) { API.registerGuiOverlay(GuiFluidPatternTerminalEx.class, ident); API.registerGuiOverlay(GuiFluidPatternExWireless.class, ident); - API.registerGuiOverlayHandler(GuiFluidPatternTerminalEx.class, NEECraftingHandler.INSTANCE, ident); - API.registerGuiOverlayHandler(GuiFluidPatternExWireless.class, NEECraftingHandler.INSTANCE, ident); + + API.registerGuiOverlayHandler( + GuiFluidPatternTerminalEx.class, + NEEPatternTerminalHandler.instance, + ident); + API.registerGuiOverlayHandler( + GuiFluidPatternExWireless.class, + NEEPatternTerminalHandler.instance, + ident); } } } @@ -94,12 +114,53 @@ public class NEINeeConfig implements IConfigureNEI { for (String ident : identifiers) { API.registerGuiOverlay(GuiFluidPatternTerminal.class, ident); API.registerGuiOverlay(GuiFluidPatternWireless.class, ident); - API.registerGuiOverlayHandler(GuiFluidPatternTerminal.class, NEECraftingHandler.INSTANCE, ident); - API.registerGuiOverlayHandler(GuiFluidPatternWireless.class, NEECraftingHandler.INSTANCE, ident); + + API.registerGuiOverlayHandler(GuiFluidPatternTerminal.class, NEEPatternTerminalHandler.instance, ident); + API.registerGuiOverlayHandler(GuiFluidPatternWireless.class, NEEPatternTerminalHandler.instance, ident); } } } + private void installlBookmarkContainerHandler() { + API.registerBookmarkContainerHandler(GuiPatternTerm.class, NEETerminalBookmarkContainerHandler.instance); + API.registerBookmarkContainerHandler(GuiPatternTermEx.class, NEETerminalBookmarkContainerHandler.instance); + API.registerBookmarkContainerHandler(GuiCraftingTerm.class, NEETerminalBookmarkContainerHandler.instance); + API.registerBookmarkContainerHandler(GuiMEMonitorable.class, NEETerminalBookmarkContainerHandler.instance); + API.registerBookmarkContainerHandler(GuiMEPortableCell.class, NEETerminalBookmarkContainerHandler.instance); + + if (Loader.isModLoaded(ModIDs.FC)) { + API.registerBookmarkContainerHandler( + GuiFluidPatternWireless.class, + NEETerminalBookmarkContainerHandler.instance); + API.registerBookmarkContainerHandler( + GuiFluidPatternTerminal.class, + NEETerminalBookmarkContainerHandler.instance); + API.registerBookmarkContainerHandler( + GuiFluidPatternTerminalEx.class, + NEETerminalBookmarkContainerHandler.instance); + API.registerBookmarkContainerHandler( + GuiFluidPatternExWireless.class, + NEETerminalBookmarkContainerHandler.instance); + + API.registerBookmarkContainerHandler( + GuiFluidCraftingWireless.class, + NEETerminalBookmarkContainerHandler.instance); + } + + if (Loader.isModLoaded(ModIDs.WCT)) { + API.registerBookmarkContainerHandler( + GuiWirelessCraftingTerminal.class, + NEETerminalBookmarkContainerHandler.instance); + } + + if (Loader.isModLoaded(ModIDs.ThE)) { + API.registerBookmarkContainerHandler( + GuiArcaneCraftingTerminal.class, + NEETerminalBookmarkContainerHandler.instance); + } + + } + @Override public String getName() { return NotEnoughEnergistics.NAME; @@ -119,6 +180,7 @@ public class NEINeeConfig implements IConfigureNEI { private void registerGuiHandler() { API.registerNEIGuiHandler(GuiEventHandler.instance); + GuiContainerManager.addTooltipHandler(GuiEventHandler.instance); // disable MouseScrollTransfer in some gui replaceNEIController(); } @@ -150,32 +212,57 @@ public class NEINeeConfig implements IConfigureNEI { private void installCraftingTermSupport() { API.registerGuiOverlay(GuiCraftingTerm.class, "crafting"); API.registerGuiOverlay(GuiCraftingTerm.class, "crafting2x2"); - API.registerGuiOverlayHandler(GuiCraftingTerm.class, NEECraftingHelper.INSTANCE, "crafting"); - API.registerGuiOverlayHandler(GuiCraftingTerm.class, NEECraftingHelper.INSTANCE, "crafting2x2"); + API.registerGuiOverlayHandler(GuiCraftingTerm.class, NEECraftingTerminalHandler.instance, "crafting"); + API.registerGuiOverlayHandler(GuiCraftingTerm.class, NEECraftingTerminalHandler.instance, "crafting2x2"); + + if (Loader.isModLoaded(ModIDs.FC)) { + API.registerGuiOverlayHandler( + GuiFluidCraftingWireless.class, + NEECraftingTerminalHandler.instance, + "crafting"); + API.registerGuiOverlayHandler( + GuiFluidCraftingWireless.class, + NEECraftingTerminalHandler.instance, + "crafting2x2"); + } } private void installWirelessCraftingTermSupport() { if (Loader.isModLoaded(ModIDs.WCT)) { - API.registerGuiOverlayHandler(GuiWirelessCraftingTerminal.class, NEECraftingHelper.INSTANCE, "crafting"); - API.registerGuiOverlayHandler(GuiWirelessCraftingTerminal.class, NEECraftingHelper.INSTANCE, "crafting2x2"); + API.registerGuiOverlayHandler( + GuiWirelessCraftingTerminal.class, + NEECraftingTerminalHandler.instance, + "crafting"); + API.registerGuiOverlayHandler( + GuiWirelessCraftingTerminal.class, + NEECraftingTerminalHandler.instance, + "crafting2x2"); } } private void installThaumicEnergisticsSupport() { - try { - Class.forName("thaumicenergistics.client.gui.GuiKnowledgeInscriber"); - } catch (ClassNotFoundException e) { - return; - } - if (Loader.isModLoaded("thaumcraftneiplugin")) { + + if (Loader.isModLoaded(ModIDs.ThE)) { NotEnoughEnergistics.logger.info("Install ThaumicEnergistics support"); - API.registerGuiOverlay(GuiKnowledgeInscriber.class, "arcaneshapedrecipes"); - API.registerGuiOverlay(GuiKnowledgeInscriber.class, "arcaneshapelessrecipes"); - API.registerGuiOverlayHandler(GuiKnowledgeInscriber.class, new NEECraftingHandler(), "arcaneshapedrecipes"); - API.registerGuiOverlayHandler( - GuiKnowledgeInscriber.class, - new NEECraftingHandler(), - "arcaneshapelessrecipes"); + + try { + Class.forName("thaumicenergistics.client.gui.GuiKnowledgeInscriber"); + + API.registerGuiOverlay(GuiKnowledgeInscriber.class, "arcaneshapedrecipes"); + API.registerGuiOverlay(GuiKnowledgeInscriber.class, "arcaneshapelessSrecipes"); + API.registerGuiOverlayHandler( + GuiKnowledgeInscriber.class, + NEEKnowledgeInscriberHandler.instance, + "arcaneshapedrecipes"); + API.registerGuiOverlayHandler( + GuiKnowledgeInscriber.class, + NEEKnowledgeInscriberHandler.instance, + "arcaneshapelessrecipes"); + + } catch (ClassNotFoundException e) { + + } + } } @@ -185,7 +272,7 @@ public class NEINeeConfig implements IConfigureNEI { // PatternTermEx Support for (String ident : identifiers) { API.registerGuiOverlay(GuiPatternTermEx.class, ident); - API.registerGuiOverlayHandler(GuiPatternTermEx.class, new NEECraftingHandler(), ident); + API.registerGuiOverlayHandler(GuiPatternTermEx.class, NEEPatternTerminalHandler.instance, ident); } } @@ -195,10 +282,27 @@ public class NEINeeConfig implements IConfigureNEI { } catch (ClassNotFoundException e) { return; } + if (Loader.isModLoaded("avaritiaddons")) { NotEnoughEnergistics.logger.info("Install Avaritiaddons support"); - API.registerGuiOverlay(GuiExtremeAutoCrafter.class, "extreme"); - API.registerGuiOverlayHandler(GuiExtremeAutoCrafter.class, new NEECraftingHandler(), "extreme"); + API.registerGuiOverlay(GuiExtremeAutoCrafter.class, "extreme", 181, 15); + API.registerGuiOverlayHandler( + GuiExtremeAutoCrafter.class, + NEEExtremeAutoCrafterHandler.instance, + "extreme"); + } + } + + private void installAvaritiaSupport() { + try { + Class.forName("fox.spiteful.avaritia.gui.GUIExtremeCrafting"); + } catch (ClassNotFoundException e) { + return; + } + + if (Loader.isModLoaded("Avaritia")) { + API.registerGuiOverlay(GUIExtremeCrafting.class, "extreme", 9, 5); + API.registerGuiOverlayHandler(GUIExtremeCrafting.class, new DefaultOverlayHandler(9, 5), "extreme"); } } } diff --git a/src/main/java/com/github/vfyjxf/nee/block/BlockPatternInterface.java b/src/main/java/com/github/vfyjxf/nee/block/BlockPatternInterface.java index 71a28a9..f3075bf 100644 --- a/src/main/java/com/github/vfyjxf/nee/block/BlockPatternInterface.java +++ b/src/main/java/com/github/vfyjxf/nee/block/BlockPatternInterface.java @@ -39,7 +39,7 @@ public class BlockPatternInterface extends AEBaseTileBlock { return false; } - TilePatternInterface tile = this.getTileEntity(world, x, y, z); + final TilePatternInterface tile = this.getTileEntity(world, x, y, z); if (tile != null) { if (!world.isRemote) { NEEGuiHandler.openGui(player, NEEGuiHandler.PATTERN_INTERFACE_ID, tile, ForgeDirection.UNKNOWN); diff --git a/src/main/java/com/github/vfyjxf/nee/block/tile/TilePatternInterface.java b/src/main/java/com/github/vfyjxf/nee/block/tile/TilePatternInterface.java index a986b06..d120766 100644 --- a/src/main/java/com/github/vfyjxf/nee/block/tile/TilePatternInterface.java +++ b/src/main/java/com/github/vfyjxf/nee/block/tile/TilePatternInterface.java @@ -433,8 +433,7 @@ public class TilePatternInterface extends AENetworkInvTile final ImmutableSet cpuSet = cg.getCpus(); for (ICraftingCPU cpu : cpuSet) { - if (cpu instanceof CraftingCPUCluster) { - CraftingCPUCluster cluster = (CraftingCPUCluster) cpu; + if (cpu instanceof CraftingCPUCluster cluster) { final IItemList pendingList = AEApi.instance().storage().createItemList(); cluster.getListOfItem(pendingList, CraftingItemList.PENDING); for (IAEItemStack pendingStack : pendingList) { @@ -668,12 +667,10 @@ public class TilePatternInterface extends AENetworkInvTile try { final ICraftingGrid cg = this.getProxy().getCrafting(); final ImmutableSet cpuSet = cg.getCpus(); - final IItemList pendingList = AEApi.instance().storage().createItemList(); for (ICraftingCPU cpu : cpuSet) { - if (cpu instanceof CraftingCPUCluster) { - CraftingCPUCluster cluster = (CraftingCPUCluster) cpu; + if (cpu instanceof CraftingCPUCluster cluster) { cluster.getListOfItem(pendingList, CraftingItemList.PENDING); } } diff --git a/src/main/java/com/github/vfyjxf/nee/client/GuiEventHandler.java b/src/main/java/com/github/vfyjxf/nee/client/GuiEventHandler.java index c43b90a..114eccc 100644 --- a/src/main/java/com/github/vfyjxf/nee/client/GuiEventHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/client/GuiEventHandler.java @@ -2,149 +2,166 @@ package com.github.vfyjxf.nee.client; import static com.github.vfyjxf.nee.config.NEEConfig.draggedStackDefaultSize; import static com.github.vfyjxf.nee.config.NEEConfig.useStackSizeFromNEI; -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY; -import static com.github.vfyjxf.nee.nei.NEECraftingHelper.tracker; +import static com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler.INPUT_KEY; import static com.github.vfyjxf.nee.utils.GuiUtils.isPatternTerm; +import java.awt.Point; +import java.awt.Rectangle; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Container; +import net.minecraft.client.resources.I18n; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import com.github.vfyjxf.nee.client.gui.widgets.GuiImgButtonEnableCombination; import com.github.vfyjxf.nee.config.ItemCombination; import com.github.vfyjxf.nee.config.NEEConfig; -import com.github.vfyjxf.nee.container.ContainerCraftingConfirm; -import com.github.vfyjxf.nee.nei.NEECraftingHandler; +import com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler; import com.github.vfyjxf.nee.network.NEENetworkHandler; import com.github.vfyjxf.nee.network.packet.PacketSlotStackChange; import com.github.vfyjxf.nee.network.packet.PacketStackCountChange; +import com.github.vfyjxf.nee.network.packet.PacketValueConfigServer; import com.github.vfyjxf.nee.utils.GuiUtils; import com.github.vfyjxf.nee.utils.ItemUtils; +import com.github.vfyjxf.nee.utils.ModIDs; import com.glodblock.github.client.gui.GuiLevelMaintainer; +import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal; +import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal; import appeng.api.events.GuiScrollEvent; import appeng.client.gui.AEBaseGui; -import appeng.client.gui.implementations.GuiCraftConfirm; import appeng.client.gui.implementations.GuiInterface; -import appeng.client.gui.implementations.GuiPatternTerm; -import appeng.container.implementations.ContainerCraftConfirm; +import appeng.container.AEBaseContainer; import appeng.container.implementations.ContainerPatternTerm; import appeng.container.slot.SlotFake; +import codechicken.lib.gui.GuiDraw; import codechicken.nei.NEIClientConfig; +import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; -import codechicken.nei.VisiblityData; -import codechicken.nei.api.INEIGuiHandler; -import codechicken.nei.api.TaggedInventoryArea; +import codechicken.nei.api.INEIGuiAdapter; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.AcceptsFollowingTooltipLineHandler; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.RecipeInfo; +import codechicken.nei.util.NEIMouseUtils; import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -public class GuiEventHandler implements INEIGuiHandler { +public class GuiEventHandler extends INEIGuiAdapter implements IContainerTooltipHandler { - public static GuiEventHandler instance = new GuiEventHandler(); + public static final GuiEventHandler instance = new GuiEventHandler(); + private final GuiImgButtonEnableCombination buttonCombination = new GuiImgButtonEnableCombination( + 0, + 0, + ItemCombination.ENABLED); - private GuiImgButtonEnableCombination buttonCombination; - private boolean hasDoubleBtn = true; - private boolean hasBeSubstituteBtn = true; - - @SubscribeEvent - public void onGuiOpen(GuiOpenEvent event) { - GuiScreen old = Minecraft.getMinecraft().currentScreen; - GuiScreen next = event.gui; - if (old != null) { - if (GuiUtils.isGuiCraftConfirm(old) && isContainerCraftConfirm(((GuiContainer) old).inventorySlots)) { - if (tracker != null) { - if (GuiUtils.isGuiCraftingTerm(next)) { - if (tracker.hasNext()) { - tracker.requestNextIngredient(); - } else { - tracker = null; - } - } else { - if (tracker != null) { - tracker = null; - } - } - } - } - } - } - - @SubscribeEvent - public void onCraftConfirmActionPerformed(GuiScreenEvent.ActionPerformedEvent.Post event) { - if (tracker != null) { - if (event.gui instanceof GuiCraftConfirm) { - if (getCancelButton((GuiCraftConfirm) event.gui) == event.button) { - tracker = null; - } - } - } - } - - private GuiButton getCancelButton(GuiCraftConfirm gui) { - return ObfuscationReflectionHelper.getPrivateValue(GuiCraftConfirm.class, gui, "cancel"); - } - - private boolean isContainerCraftConfirm(Container container) { - return (container instanceof ContainerCraftConfirm || GuiUtils.isContainerWirelessCraftingConfirm(container)) - && !((container instanceof ContainerCraftingConfirm) - || (GuiUtils.isWCTContainerCraftingConfirm(container))); - } + private AcceptsFollowingTooltipLineHandler acceptsFollowingTooltipLineHandler; + private List buttonList; @SuppressWarnings("unchecked") @SubscribeEvent public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) { - if (event.gui instanceof GuiPatternTerm) { - GuiPatternTerm gui = (GuiPatternTerm) event.gui; - try { - GuiPatternTerm.class.getDeclaredField("doubleBtn"); - } catch (NoSuchFieldException e) { - hasDoubleBtn = false; - } - try { - GuiPatternTerm.class.getDeclaredField("beSubstitutionsEnabledBtn"); - } catch (NoSuchFieldException e) { - hasBeSubstituteBtn = false; + + if (isGuiPatternTerm(event.gui)) { + event.buttonList.add(buttonCombination); + this.buttonList = getButtonList((GuiContainer) event.gui, event.buttonList); + updateCombinationButtonPosition((GuiContainer) event.gui); + } else { + this.buttonList = null; + } + + if (event.gui instanceof GuiRecipe) { + NEENetworkHandler.getInstance().sendToServer(new PacketValueConfigServer("PatternInterface.check")); + } + } + + @SubscribeEvent + public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) { + + if (this.buttonList != null && isGuiPatternTerm(event.gui)) { + updateCombinationButtonPosition((GuiContainer) event.gui); + } + } + + private boolean isGuiPatternTerm(GuiScreen guiScreen) { + if (guiScreen instanceof GuiContainer guiContainer) { + + if (Loader.isModLoaded(ModIDs.FC) && guiContainer instanceof FCGuiEncodeTerminal) { + return false; } - int x, y; - if (hasDoubleBtn && hasBeSubstituteBtn) { - x = gui.guiLeft + 84; - y = gui.guiTop + gui.ySize - 143; - } else if (hasDoubleBtn) { - x = gui.guiLeft + 84; - y = gui.guiTop + gui.ySize - 153; - } else { - x = gui.guiLeft + 74; - y = gui.guiTop + gui.ySize - 153; - } - buttonCombination = new GuiImgButtonEnableCombination( - x, - y, - ItemCombination.valueOf(NEEConfig.itemCombinationMode)); - event.buttonList.add(buttonCombination); + return RecipeInfo.getOverlayHandler(guiContainer, "crafting") instanceof NEEPatternTerminalHandler + || RecipeInfo.getOverlayHandler(guiContainer, "smelting") instanceof NEEPatternTerminalHandler; } + + return false; + } + + private List getButtonList(GuiContainer guiContainer, List items) { + final Rectangle buttonsArea = new Rectangle( + guiContainer.guiLeft + 70, + guiContainer.guiTop + guiContainer.ySize - 165, + 38, + 68); + return items.stream().filter(btn -> btn instanceof GuiButton && btn != buttonCombination) + .map(GuiButton.class::cast).filter(btn -> buttonsArea.contains(btn.xPosition, btn.yPosition)) + .collect(Collectors.toList()); + } + + private void updateCombinationButtonPosition(GuiContainer guiContainer) { + final Point leftPoint = new Point(Integer.MAX_VALUE, 0); + final Point rightPoint = new Point(0, 0); + + for (GuiButton button : buttonList) { + if (button.visible) { + leftPoint.x = Math.min(leftPoint.x, button.xPosition); + rightPoint.x = Math.max(rightPoint.x, button.xPosition); + } + } + + for (GuiButton button : buttonList) { + if (button.visible) { + if (leftPoint.x == button.xPosition) { + leftPoint.y = Math.max(leftPoint.y, button.yPosition + button.height); + } + + if (rightPoint.x == button.xPosition) { + rightPoint.y = Math.max(rightPoint.y, button.yPosition + button.height); + } + } + } + + if (rightPoint.y < leftPoint.y) { + buttonCombination.xPosition = rightPoint.x; + buttonCombination.yPosition = leftPoint.y - buttonCombination.height; + } else if (rightPoint.y == leftPoint.y) { + buttonCombination.xPosition = leftPoint.x; + buttonCombination.yPosition = leftPoint.y + 2; + } else { + buttonCombination.xPosition = leftPoint.x; + buttonCombination.yPosition = rightPoint.y - buttonCombination.height; + } + + buttonCombination.setValue(ItemCombination.valueOf(NEEConfig.itemCombinationMode)); + buttonCombination.enabled = buttonCombination.visible = guiContainer.inventorySlots instanceof AEBaseContainer + && !isCraftingMode((AEBaseContainer) guiContainer.inventorySlots); } @SubscribeEvent public void onActionPerformed(GuiScreenEvent.ActionPerformedEvent.Pre event) { if (event.button == this.buttonCombination) { - GuiImgButtonEnableCombination button = (GuiImgButtonEnableCombination) event.button; - int ordinal = Mouse.getEventButton() != 2 ? button.getCurrentValue().ordinal() + 1 - : button.getCurrentValue().ordinal() - 1; + int ordinal = this.buttonCombination.getCurrentValue().ordinal() + (Mouse.getEventButton() == 0 ? 1 : -1); if (ordinal >= ItemCombination.values().length) { ordinal = 0; @@ -152,38 +169,21 @@ public class GuiEventHandler implements INEIGuiHandler { if (ordinal < 0) { ordinal = ItemCombination.values().length - 1; } - button.setValue(ItemCombination.values()[ordinal]); + + this.buttonCombination.setValue(ItemCombination.values()[ordinal]); NEEConfig.setItemCombinationMode(ItemCombination.values()[ordinal].name()); } } - @SubscribeEvent - public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) { - if (event.gui instanceof GuiPatternTerm) { - ContainerPatternTerm container = (ContainerPatternTerm) ((GuiPatternTerm) event.gui).inventorySlots; - if (container.isCraftingMode()) { - buttonCombination.enabled = false; - buttonCombination.visible = false; - } else { - buttonCombination.enabled = true; - buttonCombination.visible = true; - } + private boolean isCraftingMode(AEBaseContainer container) { + + if (container instanceof ContainerPatternTerm) { + return ((ContainerPatternTerm) container).isCraftingMode(); + } else if (Loader.isModLoaded(ModIDs.FC) && container instanceof FCContainerEncodeTerminal) { + return ((FCContainerEncodeTerminal) container).isCraftingMode(); } - } - @Override - public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) { - return null; - } - - @Override - public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item) { - return null; - } - - @Override - public List getInventoryAreas(GuiContainer gui) { - return null; + return false; } @Override @@ -193,56 +193,47 @@ public class GuiEventHandler implements INEIGuiHandler { return false; } - if (NEEConfig.enableNEIDragDrop) { - if (Loader.isModLoaded("ae2fc") && gui instanceof GuiLevelMaintainer) { - return false; - } - if (gui instanceof AEBaseGui) { - if (draggedStack != null) { - Slot currentSlot = gui.getSlotAtPosition(mouseX, mouseY); - if (currentSlot instanceof SlotFake) { - ItemStack slotStack = currentSlot.getStack(); - ItemStack copyStack = draggedStack.copy(); - boolean sendPacket = false; - int copySize = useStackSizeFromNEI ? copyStack.stackSize : draggedStackDefaultSize; - if (button == 0) { - boolean areStackEqual = slotStack != null && slotStack.isItemEqual(copyStack) - && ItemStack.areItemStackTagsEqual(slotStack, copyStack); - copyStack.stackSize = areStackEqual ? slotStack.stackSize + copySize : copySize; - sendPacket = true; - } else if (button == 1) { - boolean areStackEqual = slotStack != null && slotStack.isItemEqual(copyStack) - && ItemStack.areItemStackTagsEqual(slotStack, copyStack); - if (areStackEqual) { - copyStack.stackSize = slotStack.stackSize; - } else { - copyStack.stackSize = slotStack == null ? 1 : copySize; - } - sendPacket = true; - } + if (NEEConfig.enableNEIDragDrop && Loader.isModLoaded("ae2fc") && gui instanceof GuiLevelMaintainer) { + return false; + } - if (sendPacket) { - NEENetworkHandler.getInstance().sendToServer( - new PacketSlotStackChange( - copyStack, - Collections.singletonList(currentSlot.slotNumber))); - if (!NEEConfig.keepGhostitems) { - draggedStack.stackSize = 0; - } - return true; - } + if (NEEConfig.enableNEIDragDrop && draggedStack != null && gui instanceof AEBaseGui) { + Slot currentSlot = gui.getSlotAtPosition(mouseX, mouseY); + + if (currentSlot instanceof SlotFake) { + ItemStack slotStack = currentSlot.getStack(); + ItemStack copyStack = draggedStack.copy(); + boolean sendPacket = false; + int copySize = useStackSizeFromNEI ? copyStack.stackSize : draggedStackDefaultSize; + if (button == 0) { + copyStack.stackSize = NEIServerUtils.areStacksSameTypeCraftingWithNBT(slotStack, copyStack) + ? slotStack.stackSize + copySize + : copySize; + sendPacket = true; + } else if (button == 1) { + if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(slotStack, copyStack)) { + copyStack.stackSize = slotStack.stackSize; + } else { + copyStack.stackSize = slotStack == null ? 1 : copySize; } - if (button == 2) { + sendPacket = true; + } + + if (sendPacket) { + NEENetworkHandler.getInstance().sendToServer( + new PacketSlotStackChange(copyStack, Collections.singletonList(currentSlot.slotNumber))); + if (!NEEConfig.keepGhostitems) { draggedStack.stackSize = 0; } + return true; } } - } - return false; - } - @Override - public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { + if (button == 2) { + draggedStack.stackSize = 0; + } + } + return false; } @@ -253,69 +244,118 @@ public class GuiEventHandler implements INEIGuiHandler { @SubscribeEvent public boolean handleMouseWheelInput(GuiScrollEvent event) { Minecraft mc = Minecraft.getMinecraft(); - boolean isPatternTerm = isPatternTerm(mc.currentScreen); - boolean isInterface = event.guiScreen instanceof GuiInterface; - if (isPatternTerm || isInterface) { - Slot currentSlot = (event.guiScreen).getSlotAtPosition(event.mouseX, event.mouseY); - if (currentSlot instanceof SlotFake && currentSlot.getHasStack()) { - // try to change current itemstack to next ingredient; - if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.ingredient")) - && GuiUtils.isCraftingSlot(currentSlot)) { - handleRecipeIngredientChange(event.guiScreen, currentSlot, event.scrollAmount); - return true; - } else if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.count"))) { - NEENetworkHandler.getInstance() - .sendToServer(new PacketStackCountChange(currentSlot.slotNumber, event.scrollAmount)); - return true; - } + Slot currentSlot = getFakeSlotAtPosition((GuiContainer) mc.currentScreen, event.mouseX, event.mouseY); + + if (currentSlot != null) { + // try to change current itemstack to next ingredient; + if (NEIClientConfig.isKeyHashDown("nee.ingredient") && GuiUtils.isCraftingSlot(currentSlot)) { + handleRecipeIngredientChange(event.guiScreen, currentSlot, event.scrollAmount); + return true; + } else if (NEIClientConfig.isKeyHashDown("nee.count")) { + NEENetworkHandler.getInstance() + .sendToServer(new PacketStackCountChange(currentSlot.slotNumber, event.scrollAmount)); + return true; } } + return false; } - private static void handleRecipeIngredientChange(GuiContainer gui, Slot currentSlot, int dWheel) { - List craftingSlots = new ArrayList<>(); - int currentSlotIndex = currentSlot.getSlotIndex(); - PositionedStack currentIngredients = NEECraftingHandler.ingredients.get(INPUT_KEY + currentSlotIndex); - if (currentIngredients != null && currentIngredients.items.length > 1) { - int currentStackIndex = ItemUtils.getIngredientIndex(currentSlot.getStack(), currentIngredients); - if (currentStackIndex >= 0) { - for (int j = 0; j < Math.abs(dWheel); j++) { - currentStackIndex += (dWheel < 0) ? -1 : 1; - if (currentStackIndex >= currentIngredients.items.length) { - currentStackIndex = 0; - } else if (currentStackIndex < 0) { - currentStackIndex = currentIngredients.items.length - 1; - } + @Override + public List handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, + List currenttip) { + final Slot currentSlot = itemstack != null ? getFakeSlotAtPosition(gui, mousex, mousey) : null; - ItemStack currentStack = currentIngredients.items[currentStackIndex].copy(); - currentStack.stackSize = currentSlot.getStack().stackSize; + if (currentSlot != null) { + PositionedStack currentIngredients = NEEPatternTerminalHandler.ingredients + .get(INPUT_KEY + currentSlot.getSlotIndex()); + if (currentIngredients != null && currentIngredients.items.length > 1 + && currentIngredients.containsWithNBT(currentSlot.getStack())) { - if (NEEConfig.allowSynchronousSwitchIngredient) { - for (Slot slot : getCraftingSlots(gui)) { + if (this.acceptsFollowingTooltipLineHandler == null + || this.acceptsFollowingTooltipLineHandler.tooltipGUID != currentIngredients) { + this.acceptsFollowingTooltipLineHandler = AcceptsFollowingTooltipLineHandler.of( + currentIngredients, + currentIngredients.getFilteredPermutations(), + currentIngredients.item); + } - PositionedStack slotIngredients = NEECraftingHandler.ingredients - .get(INPUT_KEY + slot.getSlotIndex()); - - boolean areItemStackEqual = currentSlot.getHasStack() && slot.getHasStack() - && currentSlot.getStack().isItemEqual(slot.getStack()) - && ItemStack.areItemStackTagsEqual(currentSlot.getStack(), slot.getStack()); - - boolean areIngredientEqual = slotIngredients != null - && currentIngredients.contains(slotIngredients.items[0]); - - if (areItemStackEqual && areIngredientEqual) { - craftingSlots.add(slot.slotNumber); - } - } - } else { - craftingSlots.add(currentSlot.slotNumber); - } - NEENetworkHandler.getInstance() - .sendToServer(new PacketSlotStackChange(currentStack, craftingSlots)); + if (this.acceptsFollowingTooltipLineHandler != null) { + this.acceptsFollowingTooltipLineHandler.setActiveStack(currentIngredients.item); + currenttip.add( + GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(this.acceptsFollowingTooltipLineHandler)); } } } + + return currenttip; + } + + @Override + public Map handleHotkeys(GuiContainer gui, int mousex, int mousey, Map hotkeys) { + final Slot currentSlot = getFakeSlotAtPosition(gui, mousex, mousey); + + if (currentSlot != null) { + + if (this.acceptsFollowingTooltipLineHandler != null) { + hotkeys.put( + NEIClientConfig.getKeyName( + "nee.ingredient", + 0, + NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL), + I18n.format("neenergistics.gui.tooltip.ingredient.permutation")); + } + + hotkeys.put( + NEIClientConfig + .getKeyName("nee.count", 0, NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL), + I18n.format("neenergistics.gui.tooltip.ingredient.count")); + } + + return hotkeys; + } + + private Slot getFakeSlotAtPosition(GuiContainer gui, int mousex, int mousey) { + if (gui instanceof GuiInterface || isPatternTerm(gui)) { + final Slot currentSlot = gui.getSlotAtPosition(mousex, mousey); + if (currentSlot instanceof SlotFake && currentSlot.getHasStack()) { + return currentSlot; + } + } + + return null; + } + + private void handleRecipeIngredientChange(GuiContainer gui, Slot currentSlot, int dWheel) { + final int currentSlotIndex = currentSlot.getSlotIndex(); + final PositionedStack currentIngredients = NEEPatternTerminalHandler.ingredients + .get(INPUT_KEY + currentSlotIndex); + + if (currentIngredients != null && currentIngredients.items.length > 1) { + final List craftingSlots = new ArrayList<>(); + final List items = currentIngredients.getFilteredPermutations(); + final int currentStackIndex = ItemUtils.getPermutationIndex(currentSlot.getStack(), items); + final ItemStack nextStack = items.get((items.size() - dWheel + currentStackIndex) % items.size()); + final ItemStack currentStack = currentIngredients.item; + + if (NEEConfig.allowSynchronousSwitchIngredient) { + for (Slot slot : getCraftingSlots(gui)) { + final PositionedStack slotIngredients = NEEPatternTerminalHandler.ingredients + .get(INPUT_KEY + slot.getSlotIndex()); + + if (slotIngredients != null && slotIngredients.containsWithNBT(nextStack) + && NEIServerUtils.areStacksSameTypeCraftingWithNBT(slotIngredients.item, currentStack)) { + slotIngredients.setPermutationToRender(nextStack); + craftingSlots.add(slot.slotNumber); + } + } + } else { + currentIngredients.setPermutationToRender(nextStack); + craftingSlots.add(currentSlot.slotNumber); + } + + NEENetworkHandler.getInstance().sendToServer(new PacketSlotStackChange(nextStack, craftingSlots)); + } } @SuppressWarnings("unchecked") diff --git a/src/main/java/com/github/vfyjxf/nee/client/NEEContainerDrawHandler.java b/src/main/java/com/github/vfyjxf/nee/client/NEEContainerDrawHandler.java deleted file mode 100644 index feac40e..0000000 --- a/src/main/java/com/github/vfyjxf/nee/client/NEEContainerDrawHandler.java +++ /dev/null @@ -1,271 +0,0 @@ -package com.github.vfyjxf.nee.client; - -import java.awt.Color; -import java.awt.Point; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.resources.I18n; -import net.minecraft.inventory.Slot; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.client.event.GuiScreenEvent; - -import org.lwjgl.input.Keyboard; - -import com.github.vfyjxf.nee.config.NEEConfig; -import com.github.vfyjxf.nee.nei.NEECraftingHandler; -import com.github.vfyjxf.nee.nei.NEECraftingHelper; -import com.github.vfyjxf.nee.utils.GuiUtils; -import com.github.vfyjxf.nee.utils.Ingredient; -import com.github.vfyjxf.nee.utils.IngredientTracker; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.IRecipeHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.ReflectionHelper; - -/** - * Please note the difference between the GTNH NEI and the official NEI - */ -public class NEEContainerDrawHandler { - - public static NEEContainerDrawHandler instance = new NEEContainerDrawHandler(); - - private static final Color craftableColor = new Color(0.0f, 0.0f, 1.0f, 0.4f); - private static final Color missingColor = new Color(1.0f, 0.0f, 0.0f, 0.4f); - - public boolean isGtnhNei; - private final List overlayButtons = new ArrayList<>(); - private final Map trackerMap = new HashMap<>(); - private boolean isCraftingTerm; - private boolean isPatternTerm; - private int oldPage; - private int oldType; - - public Field overlayButtonsField; - public Method getRecipeIndicesMethod; - private boolean drawRequestTooltip; - private boolean drawMissingTooltip; - private boolean drawCraftableTooltip; - - public NEEContainerDrawHandler() { - // gtnh nei support - isGtnhNei = true; - try { - this.overlayButtonsField = GuiRecipe.class.getDeclaredField("overlayButtons"); - this.getRecipeIndicesMethod = GuiRecipe.class.getDeclaredMethod("getRecipeIndices"); - this.overlayButtonsField.setAccessible(true); - this.getRecipeIndicesMethod.setAccessible(true); - } catch (NoSuchMethodException | NoSuchFieldException e) { - isGtnhNei = false; - } - } - - @SubscribeEvent - public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) { - if (NEEConfig.drawHighlight && event.gui instanceof GuiRecipe) { - GuiRecipe guiRecipe = (GuiRecipe) event.gui; - this.isCraftingTerm = GuiUtils.isGuiCraftingTerm(guiRecipe.firstGui); - this.isPatternTerm = GuiUtils.isPatternTerm(guiRecipe.firstGui); - - if (this.isCraftingTerm || this.isPatternTerm) { - this.oldPage = guiRecipe.page; - this.oldType = guiRecipe.recipetype; - setOverlayButton(guiRecipe); - } - } - } - - @SubscribeEvent - public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) { - if (NEEConfig.drawHighlight && event.gui instanceof GuiRecipe) { - if (this.isCraftingTerm || this.isPatternTerm) { - GuiRecipe gui = (GuiRecipe) event.gui; - - IRecipeHandler currentHandler = (IRecipeHandler) gui.currenthandlers.get(gui.recipetype); - - if (NEECraftingHandler.isCraftingTableRecipe(currentHandler)) { - - if (this.trackerMap.isEmpty()) { - initIngredientTracker(gui); - } - - if (this.oldPage != gui.page) { - this.oldPage = gui.page; - setOverlayButton(gui); - initIngredientTracker(gui); - } - - if (this.oldType != gui.recipetype) { - this.oldType = gui.recipetype; - setOverlayButton(gui); - initIngredientTracker(gui); - } - - for (GuiButton button : overlayButtons) { - if (isMouseOverButton(button, event.mouseX, event.mouseY)) { - if (!trackerMap.isEmpty()) { - IngredientTracker tracker = trackerMap.get(button.id); - if (tracker != null) { - Point offset = gui.getRecipePosition(tracker.getRecipeIndex()); - for (int i = 0; i < tracker.getIngredients().size(); i++) { - Ingredient ingredient = tracker.getIngredients().get(i); - Slot slot = gui.slotcontainer - .getSlotWithStack(ingredient.getIngredient(), offset.x, offset.y); - if (slot != null) { - if (this.isCraftingTerm) { - - if (ingredient.isCraftable() && ingredient.requiresToCraft()) { - GuiDraw.drawRect( - slot.xDisplayPosition + gui.guiLeft, - slot.yDisplayPosition + gui.guiTop, - 16, - 16, - craftableColor.getRGB()); - this.drawRequestTooltip = true; - } - - if (ingredient.requiresToCraft() && !ingredient.isCraftable()) { - GuiDraw.drawRect( - slot.xDisplayPosition + gui.guiLeft, - slot.yDisplayPosition + gui.guiTop, - 16, - 16, - missingColor.getRGB()); - this.drawMissingTooltip = true; - } - - } else if (this.isPatternTerm) { - if (ingredient.isCraftable()) { - GuiDraw.drawRect( - slot.xDisplayPosition + gui.guiLeft, - slot.yDisplayPosition + gui.guiTop, - 16, - 16, - craftableColor.getRGB()); - this.drawCraftableTooltip = true; - } - } - } - } - - drawCraftingHelperTooltip((GuiRecipe) event.gui, event.mouseX, event.mouseY); - } - } - } - } - } - } - } - } - - private void setOverlayButton(GuiRecipe guiRecipe) { - // get all overlay buttons. - overlayButtons.clear(); - trackerMap.clear(); - List overlayButtonList = null; - - if (isGtnhNei) { - try { - overlayButtonList = new ArrayList<>( - Arrays.asList( - (GuiButton[]) NEEContainerDrawHandler.instance.overlayButtonsField.get(guiRecipe))); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - } else { - overlayButtonList = new ArrayList<>(); - overlayButtonList.add(ReflectionHelper.getPrivateValue(GuiRecipe.class, guiRecipe, "overlay1")); - overlayButtonList.add(ReflectionHelper.getPrivateValue(GuiRecipe.class, guiRecipe, "overlay2")); - } - - if (overlayButtonList != null) { - overlayButtons.addAll(overlayButtonList); - } - } - - private void initIngredientTracker(GuiRecipe gui) { - for (int i = 0; i < overlayButtons.size(); i++) { - GuiButton overlayButton = overlayButtons.get(i); - if (overlayButton.visible) { - IRecipeHandler handler = (IRecipeHandler) gui.currenthandlers.get(gui.recipetype); - int recipeIndex = -1; - if (isGtnhNei) { - try { - final int OVERLAY_BUTTON_ID_START = 4; - final List indices = (List) getRecipeIndicesMethod.invoke(gui); - final int refIndex = overlayButton.id - OVERLAY_BUTTON_ID_START; - - if (refIndex >= 0 && refIndex < indices.size()) { - recipeIndex = indices.get(refIndex); - } - } catch (IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); - } - } else { - recipeIndex = gui.page * handler.recipiesPerPage() + i; - } - - if (recipeIndex >= 0 && handler != null && recipeIndex < handler.numRecipes()) { - IngredientTracker tracker = this.isCraftingTerm - ? new IngredientTracker(gui.firstGui, handler, recipeIndex) - : new IngredientTracker(gui, handler, recipeIndex); - trackerMap.put(overlayButton.id, tracker); - } - } - } - } - - private void drawCraftingHelperTooltip(GuiRecipe guiRecipe, int mouseX, int mouseY) { - List tooltips = new ArrayList<>(); - if (this.isCraftingTerm) { - if (this.drawRequestTooltip) { - if (NEECraftingHelper.isIsPatternInterfaceExists()) { - tooltips.add( - String.format( - "%s" + EnumChatFormatting.GRAY - + " + " - + EnumChatFormatting.BLUE - + I18n.format("neenergistics.gui.tooltip.helper.crafting.text2"), - EnumChatFormatting.YELLOW - + Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview")))); - } else { - tooltips.add( - String.format( - "%s" + EnumChatFormatting.GRAY - + " + " - + EnumChatFormatting.BLUE - + I18n.format("neenergistics.gui.tooltip.helper.crafting.text1"), - EnumChatFormatting.YELLOW - + Keyboard.getKeyName(NEIClientConfig.getKeyBinding("nee.preview")))); - } - } - if (this.drawMissingTooltip) { - tooltips.add(EnumChatFormatting.RED + I18n.format("neenergistics.gui.tooltip.missing")); - } - } - if (this.drawCraftableTooltip && this.isPatternTerm) { - tooltips.add(EnumChatFormatting.BLUE + I18n.format("neenergistics.gui.tooltip.helper.pattern")); - } - // drawHoveringText - guiRecipe.func_146283_a(tooltips, mouseX, mouseY); - this.drawCraftableTooltip = false; - this.drawRequestTooltip = false; - this.drawMissingTooltip = false; - } - - private boolean isMouseOverButton(GuiButton button, int mouseX, int mouseY) { - return mouseX >= button.xPosition && mouseY >= button.yPosition - && mouseX < button.xPosition + button.width - && mouseY < button.yPosition + button.height; - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/client/gui/GuiCraftingAmount.java b/src/main/java/com/github/vfyjxf/nee/client/gui/GuiCraftingAmount.java deleted file mode 100644 index 7a48d36..0000000 --- a/src/main/java/com/github/vfyjxf/nee/client/gui/GuiCraftingAmount.java +++ /dev/null @@ -1,278 +0,0 @@ -package com.github.vfyjxf.nee.client.gui; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum; -import net.p455w0rd.wirelesscraftingterminal.reference.Reference; - -import com.github.vfyjxf.nee.container.ContainerCraftingAmount; -import com.github.vfyjxf.nee.network.NEENetworkHandler; -import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest; -import com.github.vfyjxf.nee.utils.GuiUtils; -import com.github.vfyjxf.nee.utils.ModIDs; - -import appeng.api.AEApi; -import appeng.api.definitions.IDefinitions; -import appeng.api.definitions.IParts; -import appeng.api.storage.ITerminalHost; -import appeng.client.gui.AEBaseGui; -import appeng.client.gui.widgets.GuiNumberBox; -import appeng.client.gui.widgets.GuiTabButton; -import appeng.container.AEBaseContainer; -import appeng.core.AEConfig; -import appeng.core.localization.GuiText; -import appeng.core.sync.GuiBridge; -import appeng.core.sync.network.NetworkHandler; -import appeng.core.sync.packets.PacketSwitchGuis; -import appeng.helpers.Reflected; -import appeng.parts.reporting.PartCraftingTerminal; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Optional; - -public class GuiCraftingAmount extends AEBaseGui { - - private GuiNumberBox amountToCraft; - private GuiTabButton originalGuiBtn; - - private GuiButton next; - - private GuiButton plus1; - private GuiButton plus10; - private GuiButton plus100; - private GuiButton plus1000; - private GuiButton minus1; - private GuiButton minus10; - private GuiButton minus100; - private GuiButton minus1000; - - private GuiBridge originalGui; - - private boolean isWirelessCrafting; - - @Reflected - public GuiCraftingAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) { - super(new ContainerCraftingAmount(inventoryPlayer, te)); - } - - @SuppressWarnings("unchecked") - @Override - public void initGui() { - super.initGui(); - - final int a = AEConfig.instance.craftItemsByStackAmounts(0); - final int b = AEConfig.instance.craftItemsByStackAmounts(1); - final int c = AEConfig.instance.craftItemsByStackAmounts(2); - final int d = AEConfig.instance.craftItemsByStackAmounts(3); - - this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a)); - this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b)); - this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c)); - this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d)); - - this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a)); - this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b)); - this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c)); - this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d)); - - this.buttonList.add( - this.next = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal())); - - ItemStack myIcon = null; - final Object target = ((AEBaseContainer) this.inventorySlots).getTarget(); - final IDefinitions definitions = AEApi.instance().definitions(); - final IParts parts = definitions.parts(); - - if (target instanceof PartCraftingTerminal) { - for (final ItemStack stack : parts.craftingTerminal().maybeStack(1).asSet()) { - myIcon = stack; - } - this.originalGui = GuiBridge.GUI_CRAFTING_TERMINAL; - } - if (Loader.isModLoaded(ModIDs.WCT) && GuiUtils.isWirelessTerminalGuiObject(target)) { - myIcon = new ItemStack(ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()); - this.isWirelessCrafting = true; - } - - if (this.originalGui != null && myIcon != null) { - this.buttonList.add( - this.originalGuiBtn = new GuiTabButton( - this.guiLeft + 154, - this.guiTop, - myIcon, - myIcon.getDisplayName(), - itemRender)); - } - if (this.isWirelessCrafting && myIcon != null) { - this.buttonList.add( - this.originalGuiBtn = new GuiTabButton( - this.guiLeft + 154, - this.guiTop, - myIcon, - myIcon.getDisplayName(), - itemRender)); - } - - this.amountToCraft = new GuiNumberBox( - this.fontRendererObj, - this.guiLeft + 62, - this.guiTop + 57, - 59, - this.fontRendererObj.FONT_HEIGHT, - Integer.class); - this.amountToCraft.setEnableBackgroundDrawing(false); - this.amountToCraft.setMaxStringLength(16); - this.amountToCraft.setTextColor(0xFFFFFF); - this.amountToCraft.setVisible(true); - this.amountToCraft.setFocused(true); - this.amountToCraft.setText("1"); - } - - @Override - public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) { - this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 4210752); - } - - @Override - public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) { - this.next.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal(); - - this.bindTexture("guis/craftAmt.png"); - this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize); - - try { - Long.parseLong(this.amountToCraft.getText()); - this.next.enabled = this.amountToCraft.getText().length() > 0; - } catch (final NumberFormatException e) { - this.next.enabled = false; - } - - this.amountToCraft.drawTextBox(); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float btn) { - super.drawScreen(mouseX, mouseY, btn); - } - - @Override - protected void keyTyped(final char character, final int key) { - if (!this.checkHotbarKeys(key)) { - if (key == 28) { - this.actionPerformed(this.next); - } - if ((key == 211 || key == 205 - || key == 203 - || key == 14 - || character == '-' - || Character.isDigit(character)) && this.amountToCraft.textboxKeyTyped(character, key)) { - try { - String out = this.amountToCraft.getText(); - - boolean fixed = false; - while (out.startsWith("0") && out.length() > 1) { - out = out.substring(1); - fixed = true; - } - - if (fixed) { - this.amountToCraft.setText(out); - } - - if (out.isEmpty()) { - out = "0"; - } - - final long result = Long.parseLong(out); - if (result < 0) { - this.amountToCraft.setText("1"); - } - } catch (final NumberFormatException e) { - // :P - } - } else { - super.keyTyped(character, key); - } - } - } - - @Override - protected void actionPerformed(final GuiButton btn) { - super.actionPerformed(btn); - - try { - - if (btn == this.originalGuiBtn) { - if (!this.isWirelessCrafting) { - NetworkHandler.instance.sendToServer(new PacketSwitchGuis(this.originalGui)); - } else if (Loader.isModLoaded(ModIDs.WCT)) { - openWirelessCraftingGui(); - } - } - - if (btn == this.next) { - NEENetworkHandler.getInstance().sendToServer( - new PacketCraftingRequest(Integer.parseInt(this.amountToCraft.getText()), isShiftKeyDown())); - } - } catch (final NumberFormatException e) { - // nope.. - this.amountToCraft.setText("1"); - } - - final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000; - final boolean isMinus = btn == this.minus1 || btn == this.minus10 - || btn == this.minus100 - || btn == this.minus1000; - - if (isPlus || isMinus) { - this.addQty(this.getQty(btn)); - } - } - - private void addQty(final int i) { - try { - String out = this.amountToCraft.getText(); - - boolean fixed = false; - while (out.startsWith("0") && out.length() > 1) { - out = out.substring(1); - fixed = true; - } - - if (fixed) { - this.amountToCraft.setText(out); - } - - if (out.isEmpty()) { - out = "0"; - } - - long result = Integer.parseInt(out); - - if (result == 1 && i > 1) { - result = 0; - } - - result += i; - if (result < 1) { - result = 1; - } - - out = Long.toString(result); - Integer.parseInt(out); - this.amountToCraft.setText(out); - } catch (final NumberFormatException e) { - // :P - } - } - - protected String getBackground() { - return "guis/craftAmt.png"; - } - - @Optional.Method(modid = ModIDs.WCT) - private void openWirelessCraftingGui() { - net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer( - new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis(Reference.GUI_WCT)); - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingAmount.java b/src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingAmount.java deleted file mode 100644 index 00cb624..0000000 --- a/src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingAmount.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.github.vfyjxf.nee.container; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import appeng.api.config.SecurityPermissions; -import appeng.api.networking.IGrid; -import appeng.api.networking.security.BaseActionSource; -import appeng.api.networking.security.IActionHost; -import appeng.api.networking.security.PlayerSource; -import appeng.container.AEBaseContainer; -import appeng.container.slot.SlotInaccessible; -import appeng.tile.inventory.AppEngInternalInventory; - -public class ContainerCraftingAmount extends AEBaseContainer { - - private final Slot resultSlot; - private ItemStack resultStack; - private NBTTagCompound recipe; - - public ContainerCraftingAmount(InventoryPlayer ip, Object anchor) { - super(ip, anchor); - this.resultSlot = new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, 34, 53); - this.addSlotToContainer(resultSlot); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - this.verifyPermissions(SecurityPermissions.CRAFT, false); - } - - public IGrid getGrid() { - final IActionHost h = ((IActionHost) this.getTarget()); - return h.getActionableNode().getGrid(); - } - - public World getWorld() { - return this.getPlayerInv().player.worldObj; - } - - public BaseActionSource getActionSrc() { - return new PlayerSource(this.getPlayerInv().player, (IActionHost) this.getTarget()); - } - - public NBTTagCompound getRecipe() { - return recipe; - } - - public Slot getResultSlot() { - return resultSlot; - } - - public ItemStack getResultStack() { - return resultStack; - } - - public void setResultStack(ItemStack resultStack) { - this.resultStack = resultStack; - } - - public void setRecipe(NBTTagCompound recipe) { - this.recipe = recipe; - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingConfirm.java b/src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingConfirm.java deleted file mode 100644 index a046c75..0000000 --- a/src/main/java/com/github/vfyjxf/nee/container/ContainerCraftingConfirm.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.github.vfyjxf.nee.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; - -import com.github.vfyjxf.nee.block.tile.TilePatternInterface; - -import appeng.api.storage.ITerminalHost; -import appeng.container.implementations.ContainerCraftConfirm; -import appeng.util.Platform; - -public class ContainerCraftingConfirm extends ContainerCraftConfirm { - - private TilePatternInterface tile; - private int patternIndex; - private boolean hasWorkCommitted = false; - - public ContainerCraftingConfirm(InventoryPlayer ip, ITerminalHost te) { - super(ip, te); - } - - @Override - public void startJob() { - if (Platform.isServer()) { - hasWorkCommitted = true; - } - super.startJob(); - } - - @Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - if (Platform.isServer() && tile != null && !hasWorkCommitted) { - this.tile.getPatternInventory().setInventorySlotContents(patternIndex, null); - this.tile.updateCraftingList(); - } - } - - public void setTile(TilePatternInterface tile) { - this.tile = tile; - } - - public void setPatternIndex(int patternIndex) { - this.patternIndex = patternIndex; - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/container/ContainerPatternInterface.java b/src/main/java/com/github/vfyjxf/nee/container/ContainerPatternInterface.java index 3482575..ff89b2a 100644 --- a/src/main/java/com/github/vfyjxf/nee/container/ContainerPatternInterface.java +++ b/src/main/java/com/github/vfyjxf/nee/container/ContainerPatternInterface.java @@ -27,7 +27,6 @@ import appeng.util.Platform; public class ContainerPatternInterface extends AEBaseContainer implements IAEAppEngInventory { - private final InventoryPlayer playerInventory; private final AppEngInternalInventory recipeInv; private final AppEngInternalInventory patterns; private final SlotRestrictedInput[] patternSlots = new SlotRestrictedInput[9]; @@ -38,7 +37,6 @@ public class ContainerPatternInterface extends AEBaseContainer implements IAEApp public ContainerPatternInterface(InventoryPlayer playerInventory, TilePatternInterface tile) { super(playerInventory, tile); - this.playerInventory = playerInventory; this.recipeInv = tile.getGirdInventory(); this.patterns = tile.getPatternInventory(); diff --git a/src/main/java/com/github/vfyjxf/nee/container/WCTContainerCraftingConfirm.java b/src/main/java/com/github/vfyjxf/nee/container/WCTContainerCraftingConfirm.java deleted file mode 100644 index c2a5f14..0000000 --- a/src/main/java/com/github/vfyjxf/nee/container/WCTContainerCraftingConfirm.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.github.vfyjxf.nee.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; - -import com.github.vfyjxf.nee.block.tile.TilePatternInterface; - -import appeng.api.storage.ITerminalHost; -import appeng.container.implementations.ContainerCraftConfirm; -import appeng.util.Platform; - -public class WCTContainerCraftingConfirm extends ContainerCraftConfirm { - - private TilePatternInterface tile; - private int patternIndex; - private boolean hasWorkCommitted = false; - - public WCTContainerCraftingConfirm(InventoryPlayer ip, ITerminalHost te) { - super(ip, te); - } - - @Override - public void startJob() { - if (Platform.isServer()) { - hasWorkCommitted = true; - } - super.startJob(); - } - - @Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) { - super.onContainerClosed(par1EntityPlayer); - if (Platform.isServer() && tile != null && !hasWorkCommitted) { - this.tile.getPatternInventory().setInventorySlotContents(patternIndex, null); - this.tile.updateCraftingList(); - } - } - - public void setTile(TilePatternInterface tile) { - this.tile = tile; - } - - public void setPatternIndex(int patternIndex) { - this.patternIndex = patternIndex; - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java deleted file mode 100644 index 75518f2..0000000 --- a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java +++ /dev/null @@ -1,321 +0,0 @@ -package com.github.vfyjxf.nee.nei; - -import static com.github.vfyjxf.nee.processor.RecipeProcessor.NULL_IDENTIFIER; -import static com.github.vfyjxf.nee.utils.GuiUtils.isPatternTerm; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.oredict.OreDictionary; - -import com.github.vfyjxf.nee.config.ItemCombination; -import com.github.vfyjxf.nee.config.NEEConfig; -import com.github.vfyjxf.nee.network.NEENetworkHandler; -import com.github.vfyjxf.nee.network.packet.PacketArcaneRecipe; -import com.github.vfyjxf.nee.network.packet.PacketExtremeRecipe; -import com.github.vfyjxf.nee.network.packet.PacketNEIPatternRecipe; -import com.github.vfyjxf.nee.processor.IRecipeProcessor; -import com.github.vfyjxf.nee.processor.RecipeProcessor; -import com.github.vfyjxf.nee.utils.ItemUtils; -import com.github.vfyjxf.nee.utils.ModIDs; -import com.glodblock.github.nei.FluidPatternTerminalRecipeTransferHandler; - -import appeng.util.Platform; -import codechicken.nei.PositionedStack; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.recipe.IRecipeHandler; -import codechicken.nei.recipe.TemplateRecipeHandler; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Optional; - -/** - * @author vfyjxf - */ -public class NEECraftingHandler implements IOverlayHandler { - - public static final String INPUT_KEY = "#"; - public static final String OUTPUT_KEY = "Outputs"; - public static Map ingredients = new HashMap<>(); - - public static final NEECraftingHandler INSTANCE = new NEECraftingHandler(); - private static Class knowledgeInscriberClz; - private static Class itemAspectClz; - private static Class guiExtremeAutoCrafterClz; - - static { - try { - knowledgeInscriberClz = Class.forName("thaumicenergistics.client.gui.GuiKnowledgeInscriber"); - } catch (ClassNotFoundException ignored) {} - try { - itemAspectClz = Class.forName("com.djgiannuzz.thaumcraftneiplugin.items.ItemAspect"); - } catch (ClassNotFoundException ignored) {} - try { - guiExtremeAutoCrafterClz = Class - .forName("wanion.avaritiaddons.block.extremeautocrafter.GuiExtremeAutoCrafter"); - } catch (ClassNotFoundException ignored) {} - } - - public static boolean isCraftingTableRecipe(IRecipeHandler recipe) { - if (recipe instanceof TemplateRecipeHandler) { - TemplateRecipeHandler templateRecipeHandler = (TemplateRecipeHandler) recipe; - String overlayIdentifier = templateRecipeHandler.getOverlayIdentifier(); - return "crafting".equals(overlayIdentifier) || "crafting2x2".equals(overlayIdentifier); - } else { - return false; - } - } - - @Optional.Method(modid = ModIDs.FC) - private void fluidCraftOverlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) { - FluidPatternTerminalRecipeTransferHandler.INSTANCE.overlayRecipe(firstGui, recipe, recipeIndex, shift); - } - - @Override - public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) { - if (isPatternTerm(firstGui)) { - NEENetworkHandler.getInstance().sendToServer(packRecipe(recipe, recipeIndex)); - if (Loader.isModLoaded(ModIDs.FC)) fluidCraftOverlayRecipe(firstGui, recipe, recipeIndex, shift); - } else { - knowledgeInscriberHandler(firstGui, recipe, recipeIndex); - extremeAutoCrafterHandler(firstGui, recipe, recipeIndex); - } - } - - private PacketNEIPatternRecipe packRecipe(IRecipeHandler recipe, int recipeIndex) { - if (isCraftingTableRecipe(recipe)) { - return packCraftingTableRecipe(recipe, recipeIndex); - } else { - return packProcessRecipe(recipe, recipeIndex); - } - } - - private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int recipeIndex) { - final NBTTagCompound recipeInputs = new NBTTagCompound(); - NBTTagCompound recipeOutputs = new NBTTagCompound(); - String identifier = recipe instanceof TemplateRecipeHandler ? recipe.getOverlayIdentifier() : NULL_IDENTIFIER; - if (identifier == null) { - identifier = NULL_IDENTIFIER; - } - int inputIndex = 0; - int outputIndex = 0; - // get all recipe inputs and other stacks,use first item - for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) { - if (processor.getAllOverlayIdentifier().contains(identifier)) { - List inputs = processor.getRecipeInput(recipe, recipeIndex, identifier); - List outputs = processor.getRecipeOutput(recipe, recipeIndex, identifier); - String recipeProcessorId = processor.getRecipeProcessorId(); - List mergedInputs = new ArrayList<>(); - - if (!inputs.isEmpty() && !outputs.isEmpty()) { - NEECraftingHandler.ingredients.clear(); - for (PositionedStack positionedStack : inputs) { - ItemStack currentStack = positionedStack.items[0]; - boolean find = false; - ItemCombination currentValue = ItemCombination.valueOf(NEEConfig.itemCombinationMode); - if (currentValue != ItemCombination.DISABLED - && processor.mergeStacks(recipe, recipeIndex, identifier)) { - boolean isWhitelist = currentValue == ItemCombination.WHITELIST - && Arrays.asList(NEEConfig.itemCombinationWhitelist).contains(identifier); - if (currentValue == ItemCombination.ENABLED || isWhitelist) { - for (PositionedStack storedStack : mergedInputs) { - ItemStack firstStack = storedStack.items[0]; - boolean areItemStackEqual = firstStack.isItemEqual(currentStack) - && ItemStack.areItemStackTagsEqual(firstStack, currentStack); - if (areItemStackEqual && (firstStack.stackSize + currentStack.stackSize) - <= firstStack.getMaxStackSize()) { - find = true; - storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize; - } - } - } - } - if (!find) { - mergedInputs.add(positionedStack.copy()); - } - } - for (PositionedStack positionedStack : mergedInputs) { - ItemStack currentStack = positionedStack.items[0]; - ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); - - if (preferModItem != null) { - currentStack = preferModItem; - currentStack.stackSize = positionedStack.items[0].stackSize; - } - - for (ItemStack stack : positionedStack.items) { - if (Platform.isRecipePrioritized(stack) - || ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) { - currentStack = stack.copy(); - currentStack.stackSize = positionedStack.items[0].stackSize; - break; - } - } - if (ItemUtils.isInBlackList(currentStack, recipeProcessorId, identifier)) { - continue; - } - - if (currentStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - currentStack.setItemDamage(0); - } - if (currentStack.stackSize < 1) { - currentStack.stackSize = 1; - } - - recipeInputs.setTag( - "#" + inputIndex, - ItemUtils.writeItemStackToNBT(currentStack, new NBTTagCompound())); - NEECraftingHandler.ingredients.put(INPUT_KEY + inputIndex, positionedStack); - inputIndex++; - } - - for (PositionedStack positionedStack : outputs) { - if (outputIndex >= 4 || positionedStack == null || positionedStack.item == null) { - continue; - } - - ItemStack outputStack = positionedStack.item.copy(); - if (outputStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - outputStack.setItemDamage(0); - } - if (outputStack.stackSize < 1) { - outputStack.stackSize = 1; - } - - recipeOutputs.setTag( - OUTPUT_KEY + outputIndex, - ItemUtils.writeItemStackToNBT(outputStack, new NBTTagCompound())); - outputIndex++; - } - break; - } - } - } - return new PacketNEIPatternRecipe(recipeInputs, recipeOutputs); - } - - private PacketNEIPatternRecipe packCraftingTableRecipe(IRecipeHandler recipe, int recipeIndex) { - final NBTTagCompound recipeInputs = new NBTTagCompound(); - final List ingredients = recipe.getIngredientStacks(recipeIndex); - NEECraftingHandler.ingredients.clear(); - for (final PositionedStack positionedStack : ingredients) { - final int col = (positionedStack.relx - 25) / 18; - final int row = (positionedStack.rely - 6) / 18; - int slotIndex = col + row * 3; - if (positionedStack.items != null && positionedStack.items.length > 0) { - final ItemStack[] currentStackList = positionedStack.items; - ItemStack stack = positionedStack.items[0]; - - ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); - if (preferModItem != null) { - stack = preferModItem; - } - - for (ItemStack currentStack : currentStackList) { - if (Platform.isRecipePrioritized(currentStack) || ItemUtils.isPreferItems(currentStack)) { - stack = currentStack.copy(); - } - } - - ItemUtils.transformGTTool(stack); - - if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - stack.setItemDamage(0); - } - - recipeInputs.setTag("#" + slotIndex, ItemUtils.writeItemStackToNBT(stack, new NBTTagCompound())); - NEECraftingHandler.ingredients.put(INPUT_KEY + slotIndex, positionedStack); - } - } - return new PacketNEIPatternRecipe(recipeInputs, null); - } - - private void knowledgeInscriberHandler(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { - if (knowledgeInscriberClz != null && knowledgeInscriberClz.isInstance(firstGui)) { - NEENetworkHandler.getInstance().sendToServer(packetArcaneRecipe(recipe, recipeIndex)); - } - } - - private PacketArcaneRecipe packetArcaneRecipe(IRecipeHandler recipe, int recipeIndex) { - final NBTTagCompound recipeInputs = new NBTTagCompound(); - List ingredients = recipe.getIngredientStacks(recipeIndex); - if (itemAspectClz != null) { - ingredients.removeIf(positionedStack -> itemAspectClz.isInstance(positionedStack.item.getItem())); - } - for (PositionedStack positionedStack : ingredients) { - if (positionedStack.items != null && positionedStack.items.length > 0) { - int slotIndex = getSlotIndex(positionedStack.relx * 100 + positionedStack.rely); - final ItemStack[] currentStackList = positionedStack.items; - ItemStack stack = positionedStack.item; - for (ItemStack currentStack : currentStackList) { - if (Platform.isRecipePrioritized(currentStack)) { - stack = currentStack.copy(); - } - } - recipeInputs.setTag("#" + slotIndex, ItemUtils.writeItemStackToNBT(stack, new NBTTagCompound())); - } - } - return new PacketArcaneRecipe(recipeInputs); - } - - private void extremeAutoCrafterHandler(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { - if (guiExtremeAutoCrafterClz != null && guiExtremeAutoCrafterClz.isInstance(firstGui)) { - NEENetworkHandler.getInstance().sendToServer(packetExtremeRecipe(recipe, recipeIndex)); - } - } - - private PacketExtremeRecipe packetExtremeRecipe(IRecipeHandler recipe, int recipeIndex) { - NBTTagCompound recipeInputs = new NBTTagCompound(); - List ingredients = recipe.getIngredientStacks(recipeIndex); - for (PositionedStack positionedStack : ingredients) { - int col = (positionedStack.relx - 3) / 18; - int row = (positionedStack.rely - 3) / 18; - if (positionedStack.rely == 129) { - col = (positionedStack.relx - 2) / 18; - } - int slotIndex = col + row * 9; - ItemStack currentStack = positionedStack.items[0]; - ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); - if (preferModItem != null) { - currentStack = preferModItem; - } - - for (ItemStack stack : positionedStack.items) { - if (ItemUtils.isPreferItems(stack)) { - currentStack = stack.copy(); - } - } - recipeInputs.setTag("#" + slotIndex, ItemUtils.writeItemStackToNBT(currentStack, new NBTTagCompound())); - } - return new PacketExtremeRecipe(recipeInputs); - } - - private int getSlotIndex(int xy) { - switch (xy) { - case 7533: - return 1; - case 10333: - return 2; - case 4960: - return 3; - case 7660: - return 4; - case 10360: - return 5; - case 4987: - return 6; - case 7687: - return 7; - case 10387: - return 8; - case 4832: - default: - return 0; - } - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHelper.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHelper.java deleted file mode 100644 index 067de5c..0000000 --- a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHelper.java +++ /dev/null @@ -1,332 +0,0 @@ -package com.github.vfyjxf.nee.nei; - -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY; -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY; -import static com.github.vfyjxf.nee.utils.GuiUtils.isGuiCraftingTerm; -import static com.github.vfyjxf.nee.utils.GuiUtils.isPatternTerm; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.oredict.OreDictionary; - -import org.lwjgl.input.Keyboard; - -import com.github.vfyjxf.nee.NotEnoughEnergistics; -import com.github.vfyjxf.nee.client.NEEContainerDrawHandler; -import com.github.vfyjxf.nee.config.NEEConfig; -import com.github.vfyjxf.nee.network.NEENetworkHandler; -import com.github.vfyjxf.nee.network.packet.PacketOpenCraftAmount; -import com.github.vfyjxf.nee.network.packet.PacketValueConfigServer; -import com.github.vfyjxf.nee.utils.GuiUtils; -import com.github.vfyjxf.nee.utils.IngredientTracker; -import com.github.vfyjxf.nee.utils.ItemUtils; -import com.github.vfyjxf.nee.utils.ModIDs; - -import appeng.client.gui.implementations.GuiCraftingTerm; -import appeng.container.slot.SlotCraftingMatrix; -import appeng.container.slot.SlotFakeCraftingMatrix; -import appeng.core.AELog; -import appeng.core.sync.AppEngPacket; -import appeng.core.sync.network.NetworkHandler; -import appeng.core.sync.packets.PacketNEIRecipe; -import appeng.util.Platform; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.PositionedStack; -import codechicken.nei.api.IOverlayHandler; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.IRecipeHandler; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.ReflectionHelper; -import io.netty.buffer.ByteBuf; - -public class NEECraftingHelper implements IOverlayHandler { - - public static final NEECraftingHelper INSTANCE = new NEECraftingHelper(); - public static IngredientTracker tracker = null; - public static boolean noPreview = false; - - private static boolean isPatternInterfaceExists = false; - - public static final int RECIPE_LENGTH = 9; - - @Override - public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) { - if (GuiUtils.isGuiCraftingTerm(firstGui) && NEECraftingHandler.isCraftingTableRecipe(recipe)) { - boolean doCraftingHelp = Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.preview")) - || Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.nopreview")); - noPreview = Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.nopreview")); - if (doCraftingHelp) { - - if (isPatternInterfaceExists) { - NEENetworkHandler.getInstance() - .sendToServer(new PacketOpenCraftAmount(packCraftingRecipe(recipe, recipeIndex))); - isPatternInterfaceExists = false; - } else { - tracker = new IngredientTracker(firstGui, recipe, recipeIndex); - if (!tracker.getRequireStacks().isEmpty()) { - tracker.requestNextIngredient(); - } else { - moveItems(firstGui, recipe, recipeIndex); - } - } - - } else { - moveItems(firstGui, recipe, recipeIndex); - } - } - } - - private NBTTagCompound packCraftingRecipe(IRecipeHandler recipeHandler, int recipeIndex) { - final NBTTagCompound recipe = new NBTTagCompound(); - final List ingredients = recipeHandler.getIngredientStacks(recipeIndex); - for (final PositionedStack positionedStack : ingredients) { - final int col = (positionedStack.relx - 25) / 18; - final int row = (positionedStack.rely - 6) / 18; - int slotIndex = col + row * 3; - if (positionedStack.items != null && positionedStack.items.length > 0) { - final ItemStack[] currentStackList = positionedStack.items; - ItemStack stack = positionedStack.items[0]; - - ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); - if (preferModItem != null) { - stack = preferModItem; - } - - for (ItemStack currentStack : currentStackList) { - if (Platform.isRecipePrioritized(currentStack) || ItemUtils.isPreferItems(currentStack)) { - stack = currentStack.copy(); - } - } - - if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - stack.setItemDamage(0); - } - - recipe.setTag(INPUT_KEY + slotIndex, stack.writeToNBT(new NBTTagCompound())); - } - } - - PositionedStack resultStack = recipeHandler.getResultStack(recipeIndex); - if (resultStack.item != null) { - recipe.setTag(OUTPUT_KEY, resultStack.item.writeToNBT(new NBTTagCompound())); - } - return recipe; - } - - /** - * Copied from GTNewHorizons/Applied-Energistics-2-Unofficial - */ - private void moveItems(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { - try { - final List ingredients = recipe.getIngredientStacks(recipeIndex); - if (firstGui instanceof GuiCraftingTerm) { - PacketNEIRecipe packet = new PacketNEIRecipe(packIngredients(firstGui, ingredients, false)); - // don't use gtnh ae2's method; - int packetSize = getPacketSize(packet); - if (packetSize >= 32 * 1024) { - AELog.warn( - "Recipe for " + recipe.getRecipeName() - + " has too many variants, reduced version will be used"); - packet = new PacketNEIRecipe(packIngredients(firstGui, ingredients, true)); - } - if (packetSize >= 0) { - NetworkHandler.instance.sendToServer(packet); - } else { - NotEnoughEnergistics.logger.error("Can't get packet size!"); - } - } else if (GuiUtils.isGuiWirelessCrafting(firstGui)) { - moveItemsForWirelessCrafting(firstGui, ingredients); - } - } catch (final Exception | Error ignored) {} - } - - /** - * Copied from GTNewHorizons/Applied-Energistics-2-Unofficial - */ - private boolean testSize(final NBTTagCompound recipe) throws IOException { - final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - final DataOutputStream outputStream = new DataOutputStream(bytes); - CompressedStreamTools.writeCompressed(recipe, outputStream); - return bytes.size() > 3 * 1024; - } - - /** - * Copied from GTNewHorizons/Applied-Energistics-2-Unofficial - */ - @SuppressWarnings("unchecked") - private NBTTagCompound packIngredients(GuiContainer gui, List ingredients, boolean limited) - throws IOException { - final NBTTagCompound recipe = new NBTTagCompound(); - for (final PositionedStack positionedStack : ingredients) { - final int col = (positionedStack.relx - 25) / 18; - final int row = (positionedStack.rely - 6) / 18; - if (positionedStack.items != null && positionedStack.items.length > 0) { - for (final Slot slot : (List) gui.inventorySlots.inventorySlots) { - if (isCraftingMatrixSlot(gui, slot)) { - if (slot.getSlotIndex() == col + row * 3) { - final NBTTagList tags = new NBTTagList(); - final List list = new LinkedList<>(); - - // prefer pure crystals. - for (int x = 0; x < positionedStack.items.length; x++) { - if (Platform.isRecipePrioritized(positionedStack.items[x])) { - list.add(0, positionedStack.items[x]); - } else { - list.add(positionedStack.items[x]); - } - } - - for (final ItemStack is : list) { - final NBTTagCompound tag = new NBTTagCompound(); - is.writeToNBT(tag); - tags.appendTag(tag); - if (limited) { - final NBTTagCompound test = new NBTTagCompound(); - test.setTag("#" + slot.getSlotIndex(), tags); - if (testSize(test)) { - break; - } - } - } - - recipe.setTag("#" + slot.getSlotIndex(), tags); - break; - } - } - } - } - } - return recipe; - } - - private boolean isCraftingMatrixSlot(GuiContainer gui, Slot slot) { - if (gui instanceof GuiCraftingTerm) { - return slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix; - } else if (GuiUtils.isGuiWirelessCrafting(gui)) { - return slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix; - } - return false; - } - - private int getPacketSize(AppEngPacket packet) { - try { - ByteBuf p = (ByteBuf) ReflectionHelper.findField(AppEngPacket.class, "p").get(packet); - return p.array().length; - } catch (IllegalAccessException e) { - return -1; - } - } - - @Optional.Method(modid = ModIDs.WCT) - private void moveItemsForWirelessCrafting(GuiContainer firstGui, List ingredients) { - try { - net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer( - new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe( - packIngredients(firstGui, ingredients, false))); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @SubscribeEvent - public void onActionPerformedEventPre(GuiScreenEvent.ActionPerformedEvent.Pre event) { - if (NEEConfig.noShift) { - // make nei's transfer system doesn't require presses shift - if (event.gui instanceof GuiRecipe) { - GuiRecipe guiRecipe = (GuiRecipe) event.gui; - List overlayButtons = null; - final int OVERLAY_BUTTON_ID_START = 4; - boolean isGtnhNei = true; - try { - Field overlayButtonsField = GuiRecipe.class.getDeclaredField("overlayButtons"); - overlayButtonsField.setAccessible(true); - overlayButtons = new ArrayList<>(Arrays.asList((GuiButton[]) overlayButtonsField.get(guiRecipe))); - } catch (IllegalAccessException | NoSuchFieldException e) { - isGtnhNei = false; - } - if (!isGtnhNei) { - overlayButtons = new ArrayList<>(); - GuiButton overlay1 = ReflectionHelper.getPrivateValue(GuiRecipe.class, guiRecipe, "overlay1"); - GuiButton overlay2 = ReflectionHelper.getPrivateValue(GuiRecipe.class, guiRecipe, "overlay2"); - overlayButtons.add(overlay1); - overlayButtons.add(overlay2); - } - if (event.button.id >= OVERLAY_BUTTON_ID_START - && event.button.id < OVERLAY_BUTTON_ID_START + overlayButtons.size()) { - boolean isPatternTerm = isPatternTerm(guiRecipe.firstGui); - boolean isCraftingTerm = isGuiCraftingTerm(guiRecipe.firstGui); - if (isCraftingTerm || isPatternTerm) { - IRecipeHandler handler = (IRecipeHandler) guiRecipe.currenthandlers.get(guiRecipe.recipetype); - int recipeIndex = -1; - if (isGtnhNei) { - try { - final List indices = (List) NEEContainerDrawHandler.instance.getRecipeIndicesMethod - .invoke(guiRecipe); - final int refIndex = event.button.id - OVERLAY_BUTTON_ID_START; - - if (refIndex >= 0 && refIndex < indices.size()) { - recipeIndex = indices.get(refIndex); - } - } catch (IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); - } - } else { - int recipesPerPage = 2; - recipeIndex = guiRecipe.page * recipesPerPage + event.button.id - OVERLAY_BUTTON_ID_START; - } - - if (handler != null && recipeIndex >= 0 && recipeIndex < handler.numRecipes()) { - final IOverlayHandler overlayHandler = handler - .getOverlayHandler(guiRecipe.firstGui, recipeIndex); - Minecraft.getMinecraft().displayGuiScreen(guiRecipe.firstGui); - overlayHandler.overlayRecipe( - guiRecipe.firstGui, - (IRecipeHandler) guiRecipe.currenthandlers.get(guiRecipe.recipetype), - recipeIndex, - NEIClientUtils.shiftKey()); - event.setCanceled(true); - } - } - } - } - } - } - - @SubscribeEvent - public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) { - if (event.gui instanceof GuiRecipe) { - GuiRecipe guiRecipe = (GuiRecipe) event.gui; - GuiContainer firstGui = guiRecipe.firstGui; - if (GuiUtils.isGuiCraftingTerm(firstGui)) { - NEENetworkHandler.getInstance().sendToServer(new PacketValueConfigServer("PatternInterface.check")); - } - } - } - - public static void setIsPatternInterfaceExists(boolean isPatternInterfaceExists) { - NEECraftingHelper.isPatternInterfaceExists = isPatternInterfaceExists; - } - - public static boolean isIsPatternInterfaceExists() { - return isPatternInterfaceExists; - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingPreviewHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingPreviewHandler.java new file mode 100644 index 0000000..3421020 --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingPreviewHandler.java @@ -0,0 +1,406 @@ +package com.github.vfyjxf.nee.nei; + +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.oredict.OreDictionary; + +import com.github.vfyjxf.nee.network.NEENetworkHandler; +import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest; +import com.github.vfyjxf.nee.utils.GuiUtils; +import com.github.vfyjxf.nee.utils.Ingredient; +import com.github.vfyjxf.nee.utils.IngredientTracker; +import com.github.vfyjxf.nee.utils.ItemUtils; +import com.github.vfyjxf.nee.utils.ModIDs; +import com.glodblock.github.client.gui.GuiFluidCraftAmount; +import com.glodblock.github.client.gui.base.FCGuiAmount; + +import appeng.api.storage.data.IAEItemStack; +import appeng.client.gui.implementations.GuiAmount; +import appeng.client.gui.implementations.GuiCraftAmount; +import appeng.client.gui.implementations.GuiCraftConfirm; +import appeng.container.AEBaseContainer; +import appeng.container.ContainerNull; +import appeng.core.sync.network.NetworkHandler; +import appeng.core.sync.packets.PacketInventoryAction; +import appeng.helpers.InventoryAction; +import appeng.util.Platform; +import appeng.util.item.AEItemStack; +import codechicken.nei.NEIClientConfig; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.IRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.ReflectionHelper; +import thaumicenergistics.common.network.packet.server.Packet_S_ArcaneCraftingTerminal; + +public class NEECraftingPreviewHandler { + + public static final NEECraftingPreviewHandler instance = new NEECraftingPreviewHandler(); + + private boolean isPatternInterfaceExists = false; + + private NBTTagCompound patternCompound = null; + private IngredientTracker tracker = null; + private boolean isAutoStart = false; + private int resultStackSize = 0; + private String modID = ""; + + private NEECraftingPreviewHandler() {} + + public boolean handle(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { + final PositionedStack pStack = recipe.getResultStack(recipeIndex); + this.isAutoStart = NEIClientConfig.isKeyHashDown("nee.nopreview"); + this.modID = getModID(firstGui.inventorySlots); + this.resultStackSize = 0; + this.patternCompound = null; + this.tracker = null; + + if ((this.isAutoStart || NEIClientConfig.isKeyHashDown("nee.preview")) && !this.modID.isEmpty()) { + firstGui.mc.displayGuiScreen(firstGui); + + if (pStack != null) { + this.resultStackSize = pStack.item.stackSize; + } + + if (pStack != null && existsRecipeResult(firstGui, pStack)) { + + if (this.isAutoStart) { + final PacketCraftingRequest craftingRequest = new PacketCraftingRequest( + this.modID, + PacketCraftingRequest.COMMAND_OPEN_CRAFT_CONFIRM, + pStack.item.writeToNBT(new NBTTagCompound()), + pStack.item.stackSize, + true); + NEENetworkHandler.getInstance().sendToServer(craftingRequest); + } else { + openCraftAmount(firstGui, pStack.item); + } + + return true; + } else if (pStack != null && this.isPatternInterfaceExists && isCraftingTableRecipe(recipe)) { + this.patternCompound = getPatternStack(recipe, recipeIndex, Minecraft.getMinecraft().theWorld); + + if (this.isAutoStart) { + final PacketCraftingRequest craftingRequest = new PacketCraftingRequest( + this.modID, + PacketCraftingRequest.COMMAND_CREATE_PATTERN, + this.patternCompound, + pStack.item.stackSize, + true); + NEENetworkHandler.getInstance().sendToServer(craftingRequest); + } else { + openCraftAmount(firstGui, pStack.item); + } + + return true; + } else { + + this.tracker = new IngredientTracker(firstGui, recipe, recipeIndex); + + if (this.tracker.hasNext()) { + + if (this.isAutoStart) { + requestNextIngredient(); + } else if (pStack != null) { + openCraftAmount(firstGui, pStack.item); + } else { + PositionedStack otherStack = null; + + for (PositionedStack positionedStack : recipe.getOtherStacks(recipeIndex)) { + otherStack = positionedStack; + break; + } + + if (otherStack != null) { + this.resultStackSize = otherStack.item.stackSize; + openCraftAmount(firstGui, otherStack.item); + } else { + return false; + } + } + + return true; + } else { + this.tracker = null; + return false; + } + + } + + } + + return false; + } + + private void openCraftAmount(GuiContainer firstGui, ItemStack itemstack) { + final IAEItemStack aeItemStack = AEItemStack.create(itemstack); + + if (this.modID.equals(ModIDs.ThE)) { + Packet_S_ArcaneCraftingTerminal.sendAutoCraft(Minecraft.getMinecraft().thePlayer, aeItemStack); + } else if (this.modID.equals(ModIDs.FC)) { + ((AEBaseContainer) firstGui.inventorySlots).setTargetStack(aeItemStack); + com.glodblock.github.network.CPacketInventoryAction packet = new com.glodblock.github.network.CPacketInventoryAction( + InventoryAction.AUTO_CRAFT, + 0, + 0); + com.glodblock.github.FluidCraft.proxy.netHandler.sendToServer(packet); + } else if (this.modID.equals(ModIDs.WCT)) { + ((AEBaseContainer) firstGui.inventorySlots).setTargetStack(aeItemStack); + net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction packet = new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction( + InventoryAction.AUTO_CRAFT, + 0, + 0); + net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer(packet); + } else if (this.modID.equals("AE")) { + ((AEBaseContainer) firstGui.inventorySlots).setTargetStack(aeItemStack); + NetworkHandler.instance.sendToServer(new PacketInventoryAction(InventoryAction.AUTO_CRAFT, 0, 0)); + } + + } + + @SubscribeEvent + public void onGuiCraftConfirmOpen(GuiOpenEvent event) { + final GuiScreen old = Minecraft.getMinecraft().currentScreen; + + if (this.patternCompound != null && old instanceof GuiCraftConfirm) { + this.patternCompound = null; + } + + if (this.tracker != null && old instanceof GuiCraftConfirm) { + if (old != null && this.tracker.hasNext()) { + requestNextIngredient(); + } else { + this.tracker = null; + } + } + } + + @SubscribeEvent + public void onCraftConfirmActionPerformed(GuiScreenEvent.ActionPerformedEvent.Pre event) { + + if ((this.tracker != null || this.patternCompound != null) && event.gui instanceof GuiContainer gui) { + final int craftAmount = getCraftAmount(gui, event.button); + + if (craftAmount == -1) { + return; + } + + if (this.tracker != null) { + final int craftMultiplier = (int) Math.ceil((1f * craftAmount) / this.resultStackSize); + this.isAutoStart = this.isAutoStart || GuiScreen.isShiftKeyDown(); + + for (Ingredient ingr : this.tracker.getIngredients()) { + ingr.setRequireCount(ingr.getRequireCount() * craftMultiplier); + } + + this.tracker.calculateIngredients(); + + requestNextIngredient(); + event.setCanceled(true); + } else if (this.patternCompound != null) { + PacketCraftingRequest craftingRequest = new PacketCraftingRequest( + this.modID, + PacketCraftingRequest.COMMAND_CREATE_PATTERN, + this.patternCompound, + craftAmount, + GuiScreen.isShiftKeyDown()); + NEENetworkHandler.getInstance().sendToServer(craftingRequest); + event.setCanceled(true); + } + } + } + + @SubscribeEvent + public void onCraftConfirmActionPerformed(GuiScreenEvent.ActionPerformedEvent.Post event) { + + if ((this.tracker != null || this.patternCompound != null) && event.gui instanceof GuiCraftConfirm guiConfirm + && getCancelButton(guiConfirm) == event.button) { + + if (this.patternCompound != null) { + PacketCraftingRequest craftingRequest = new PacketCraftingRequest( + this.modID, + PacketCraftingRequest.COMMAND_REMOVE_PATTERN, + this.patternCompound, + 0, + false); + NEENetworkHandler.getInstance().sendToServer(craftingRequest); + } + + this.patternCompound = null; + this.tracker = null; + } + } + + private static GuiButton getCancelButton(GuiCraftConfirm gui) { + return ReflectionHelper.getPrivateValue(GuiCraftConfirm.class, gui, "cancel"); + } + + private static int getCraftAmount(GuiContainer screen, GuiButton button) { + + try { + if (Loader.isModLoaded(ModIDs.FC) && screen instanceof GuiFluidCraftAmount gui) { + + if (ReflectionHelper.getPrivateValue(FCGuiAmount.class, gui, "submit") == button) { + return (int) ReflectionHelper.findMethod(FCGuiAmount.class, gui, new String[] { "getAmount" }) + .invoke(gui); + } + + } else if (screen instanceof GuiCraftAmount gui) { + + if (ReflectionHelper.getPrivateValue(GuiAmount.class, gui, "nextBtn") == button) { + return (int) ReflectionHelper.findMethod(GuiAmount.class, gui, new String[] { "getAmount" }) + .invoke(gui); + } + + } + } catch (Exception ex) { + return 1; + } + + return -1; + } + + private static String getModID(Container container) { + + if (Loader.isModLoaded(ModIDs.ThE) + && container.getClass().getName().startsWith("thaumicenergistics.common.container")) { + return ModIDs.ThE; + } else if (Loader.isModLoaded(ModIDs.FC) + && container.getClass().getName().startsWith("com.glodblock.github.client.gui.container")) { + return ModIDs.FC; + } else + if (Loader.isModLoaded(ModIDs.WCT) && container.getClass().getName() + .startsWith("net.p455w0rd.wirelesscraftingterminal.common.container")) { + return ModIDs.WCT; + } else + if (container instanceof AEBaseContainer) { + return "AE"; + } + + return ""; + } + + private void requestNextIngredient() { + final ItemStack stack = this.tracker.getNextIngredient(); + + if (stack != null) { + PacketCraftingRequest craftingRequest = new PacketCraftingRequest( + this.modID, + PacketCraftingRequest.COMMAND_OPEN_CRAFT_CONFIRM, + stack.writeToNBT(new NBTTagCompound()), + stack.stackSize, + this.isAutoStart); + NEENetworkHandler.getInstance().sendToServer(craftingRequest); + } + } + + private boolean isCraftingTableRecipe(IRecipeHandler recipe) { + if (recipe instanceof TemplateRecipeHandler templateRecipeHandler) { + String overlayIdentifier = templateRecipeHandler.getOverlayIdentifier(); + return "crafting".equals(overlayIdentifier) || "crafting2x2".equals(overlayIdentifier); + } else { + return false; + } + } + + private NBTTagCompound getPatternStack(IRecipeHandler recipeHandler, int recipeIndex, World world) { + final InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3); + final List ingredients = recipeHandler.getIngredientStacks(recipeIndex); + + for (final PositionedStack positionedStack : ingredients) { + final int col = (positionedStack.relx - 25) / 18; + final int row = (positionedStack.rely - 6) / 18; + final int slotIndex = col + row * 3; + + if (positionedStack.items != null && positionedStack.items.length > 0) { + final ItemStack[] currentStackList = positionedStack.items; + ItemStack stack = positionedStack.items[0]; + + final ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); + + if (preferModItem != null) { + stack = preferModItem; + } + + for (ItemStack currentStack : currentStackList) { + if (Platform.isRecipePrioritized(currentStack) || ItemUtils.isPreferItems(currentStack)) { + stack = currentStack.copy(); + } + } + + if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + stack.setItemDamage(0); + } + + ic.setInventorySlotContents(slotIndex, stack); + } else { + ic.setInventorySlotContents(slotIndex, null); + } + } + + final ItemStack result = CraftingManager.getInstance().findMatchingRecipe(ic, world); + + if (result != null) { + final NBTTagCompound patternValue = new NBTTagCompound(); + final NBTTagList tagIn = new NBTTagList(); + + for (int slotIndex = 0; slotIndex < ic.getSizeInventory(); slotIndex++) { + final ItemStack itemStack = ic.getStackInSlot(slotIndex); + + if (itemStack != null) { + tagIn.appendTag(itemStack.writeToNBT(new NBTTagCompound())); + } else { + tagIn.appendTag(new NBTTagCompound()); + } + } + + patternValue.setTag("in", tagIn); + patternValue.setTag("out", result.writeToNBT(new NBTTagCompound())); + patternValue.setBoolean("crafting", true); + patternValue.setBoolean("substitute", false); + + return patternValue; + } + + return null; + } + + public void setIsPatternInterfaceExists(boolean isPatternInterfaceExists) { + this.isPatternInterfaceExists = isPatternInterfaceExists; + } + + public boolean canCraftRecipeResult(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { + final PositionedStack pStack = recipe.getResultStack(recipeIndex); + + if (pStack == null) { + return false; + } + + if (this.isPatternInterfaceExists && isCraftingTableRecipe(recipe)) { + return true; + } + + return existsRecipeResult(firstGui, pStack); + } + + private boolean existsRecipeResult(GuiContainer firstGui, PositionedStack pStack) { + return pStack != null && !GuiUtils + .getStorageStacks(firstGui, aestack -> aestack.isCraftable() && aestack.isSameType(pStack.item)) + .isEmpty(); + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingTerminalHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingTerminalHandler.java new file mode 100644 index 0000000..444849e --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingTerminalHandler.java @@ -0,0 +1,191 @@ +package com.github.vfyjxf.nee.nei; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal; + +import com.github.vfyjxf.nee.NotEnoughEnergistics; +import com.github.vfyjxf.nee.nei.NEETerminalOverlayButton.NEEItemOverlayState; +import com.github.vfyjxf.nee.utils.Ingredient; +import com.github.vfyjxf.nee.utils.IngredientTracker; +import com.github.vfyjxf.nee.utils.ModIDs; + +import appeng.container.slot.SlotCraftingMatrix; +import appeng.container.slot.SlotFakeCraftingMatrix; +import appeng.core.AELog; +import appeng.core.sync.AppEngPacket; +import appeng.core.sync.network.NetworkHandler; +import appeng.core.sync.packets.PacketNEIRecipe; +import appeng.util.Platform; +import codechicken.nei.PositionedStack; +import codechicken.nei.api.IOverlayHandler; +import codechicken.nei.recipe.GuiOverlayButton.ItemOverlayState; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiRecipeButton; +import codechicken.nei.recipe.IRecipeHandler; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.ReflectionHelper; +import io.netty.buffer.ByteBuf; + +public class NEECraftingTerminalHandler implements IOverlayHandler { + + public static final NEECraftingTerminalHandler instance = new NEECraftingTerminalHandler(); + + private NEECraftingTerminalHandler() {} + + /** + * Copied from GTNewHorizons/Applied-Energistics-2-Unofficialr + */ + @Override + public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) { + try { + final List ingredients = recipe.getIngredientStacks(recipeIndex); + + if (Loader.isModLoaded(ModIDs.WCT) && firstGui instanceof GuiWirelessCraftingTerminal) { + moveItemsForWirelessCrafting(firstGui, ingredients); + } else { + PacketNEIRecipe packet = new PacketNEIRecipe(packIngredients(firstGui, ingredients, false)); + // don't use gtnh ae2's method; + int packetSize = getPacketSize(packet); + if (packetSize >= 32 * 1024) { + AELog.warn( + "Recipe for " + recipe.getRecipeName() + + " has too many variants, reduced version will be used"); + packet = new PacketNEIRecipe(packIngredients(firstGui, ingredients, true)); + } + + if (packetSize >= 0) { + NetworkHandler.instance.sendToServer(packet); + } else { + NotEnoughEnergistics.logger.error("Can't get packet size!"); + } + } + } catch (final Exception | Error ignored) {} + } + + @Override + public boolean canFillCraftingGrid(GuiContainer firstGui, IRecipeHandler handler, int recipeIndex) { + return presenceOverlay(firstGui, handler, recipeIndex).stream().allMatch(state -> state.isPresent()); + } + + /** + * Copied from GTNewHorizons/Applied-Energistics-2-Unofficial + */ + private boolean testSize(final NBTTagCompound recipe) throws IOException { + final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + final DataOutputStream outputStream = new DataOutputStream(bytes); + CompressedStreamTools.writeCompressed(recipe, outputStream); + return bytes.size() > 3 * 1024; + } + + @Override + public List presenceOverlay(GuiContainer firstGui, IRecipeHandler handler, int recipeIndex) { + final IngredientTracker tracker = new IngredientTracker(firstGui, handler, recipeIndex); + final List itemPresenceSlots = new ArrayList<>(); + + for (Ingredient ingredient : tracker.getIngredients()) { + itemPresenceSlots.add(new NEEItemOverlayState(ingredient, true)); + } + + return itemPresenceSlots; + } + + /** + * Copied from GTNewHorizons/Applied-Energistics-2-Unofficial + */ + @SuppressWarnings("unchecked") + private NBTTagCompound packIngredients(GuiContainer gui, List ingredients, boolean limited) + throws IOException { + final NBTTagCompound recipe = new NBTTagCompound(); + + for (final PositionedStack positionedStack : ingredients) { + if (positionedStack.items != null && positionedStack.items.length > 0) { + final int col = (positionedStack.relx - 25) / 18; + final int row = (positionedStack.rely - 6) / 18; + for (final Slot slot : (List) gui.inventorySlots.inventorySlots) { + if (isCraftingMatrixSlot(gui, slot) && slot.getSlotIndex() == col + row * 3) { + final NBTTagList tags = new NBTTagList(); + final List list = new LinkedList<>(); + + // prefer pure crystals. + for (ItemStack stack : positionedStack.getFilteredPermutations()) { + stack = stack.copy(); + if (Platform.isRecipePrioritized(stack)) { + list.add(0, stack); + } else { + list.add(stack); + } + } + + for (final ItemStack is : list) { + tags.appendTag(is.writeToNBT(new NBTTagCompound())); + + if (limited) { + final NBTTagCompound test = new NBTTagCompound(); + test.setTag("#" + slot.getSlotIndex(), tags); + if (testSize(test)) { + break; + } + } + } + + recipe.setTag("#" + slot.getSlotIndex(), tags); + break; + } + } + } + } + + return recipe; + } + + private boolean isCraftingMatrixSlot(GuiContainer gui, Slot slot) { + return slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix; + } + + private int getPacketSize(AppEngPacket packet) { + try { + ByteBuf p = (ByteBuf) ReflectionHelper.findField(AppEngPacket.class, "p").get(packet); + return p.array().length; + } catch (IllegalAccessException e) { + return -1; + } + } + + @Optional.Method(modid = ModIDs.WCT) + private void moveItemsForWirelessCrafting(GuiContainer firstGui, List ingredients) { + try { + net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler.instance.sendToServer( + new net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe( + packIngredients(firstGui, ingredients, false))); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @SubscribeEvent + public void onActionPerformedEventPost(GuiRecipeButton.UpdateRecipeButtonsEvent.Post event) { + if (event.gui instanceof GuiRecipe guiRecipe && isGuiCraftingTerm(guiRecipe)) { + NEETerminalOverlayButton.updateRecipeButtons(guiRecipe, event.buttonList); + } + } + + public static boolean isGuiCraftingTerm(GuiRecipe gui) { + return gui.firstGui != null + && NEECraftingTerminalHandler.class.isInstance(gui.getHandler().getOverlayHandler(gui.firstGui, 0)); + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEEExtremeAutoCrafterHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEEExtremeAutoCrafterHandler.java new file mode 100644 index 0000000..97655eb --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEEExtremeAutoCrafterHandler.java @@ -0,0 +1,83 @@ +package com.github.vfyjxf.nee.nei; + +import java.util.List; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import com.github.vfyjxf.nee.config.NEEConfig; +import com.github.vfyjxf.nee.network.NEENetworkHandler; +import com.github.vfyjxf.nee.network.packet.PacketExtremeRecipe; +import com.github.vfyjxf.nee.utils.ItemUtils; + +import codechicken.nei.PositionedStack; +import codechicken.nei.api.IOverlayHandler; +import codechicken.nei.recipe.GuiOverlayButton; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiRecipeButton; +import codechicken.nei.recipe.IRecipeHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +/** + * @author vfyjxf + */ +public class NEEExtremeAutoCrafterHandler implements IOverlayHandler { + + public static final NEEExtremeAutoCrafterHandler instance = new NEEExtremeAutoCrafterHandler(); + + private NEEExtremeAutoCrafterHandler() {} + + @Override + public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) { + NEENetworkHandler.getInstance().sendToServer(packetExtremeRecipe(recipe, recipeIndex)); + } + + private PacketExtremeRecipe packetExtremeRecipe(IRecipeHandler recipe, int recipeIndex) { + NBTTagCompound recipeInputs = new NBTTagCompound(); + List ingredients = recipe.getIngredientStacks(recipeIndex); + + for (PositionedStack positionedStack : ingredients) { + int col = (positionedStack.relx - 3) / 18; + int row = (positionedStack.rely - 3) / 18; + + if (positionedStack.rely == 129) { + col = (positionedStack.relx - 2) / 18; + } + + int slotIndex = col + row * 9; + ItemStack currentStack = positionedStack.item; + ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); + + if (preferModItem != null) { + currentStack = preferModItem; + } + + for (ItemStack stack : positionedStack.items) { + if (ItemUtils.isPreferItems(stack)) { + currentStack = stack.copy(); + } + } + + recipeInputs.setTag("#" + slotIndex, ItemUtils.writeItemStackToNBT(currentStack, currentStack.stackSize)); + } + + return new PacketExtremeRecipe(recipeInputs); + } + + @SubscribeEvent + public void onActionPerformedEventPost(GuiRecipeButton.UpdateRecipeButtonsEvent.Post event) { + if (NEEConfig.noShift && event.gui instanceof GuiRecipe guiRecipe && isGuiExtremeTerm(guiRecipe)) { + for (int i = 0; i < event.buttonList.size(); i++) { + if (event.buttonList.get(i) instanceof GuiOverlayButton btn) { + btn.setRequireShiftForOverlayRecipe(false); + } + } + } + } + + private boolean isGuiExtremeTerm(GuiRecipe gui) { + return gui.firstGui != null && this.getClass().isInstance(gui.getHandler().getOverlayHandler(gui.firstGui, 0)); + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEEKnowledgeInscriberHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEEKnowledgeInscriberHandler.java new file mode 100644 index 0000000..672f868 --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEEKnowledgeInscriberHandler.java @@ -0,0 +1,184 @@ +package com.github.vfyjxf.nee.nei; + +import java.util.List; +import java.util.stream.Collectors; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import com.github.vfyjxf.nee.config.NEEConfig; +import com.github.vfyjxf.nee.network.NEENetworkHandler; +import com.github.vfyjxf.nee.network.packet.PacketArcaneRecipe; +import com.github.vfyjxf.nee.utils.Ingredient; +import com.github.vfyjxf.nee.utils.IngredientTracker; +import com.github.vfyjxf.nee.utils.ItemUtils; +import com.github.vfyjxf.nee.utils.ModIDs; + +import appeng.util.Platform; +import codechicken.nei.ItemsTooltipLineHandler; +import codechicken.nei.NEIClientUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.api.IOverlayHandler; +import codechicken.nei.recipe.GuiOverlayButton; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiRecipeButton; +import codechicken.nei.recipe.IRecipeHandler; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +/** + * @author vfyjxf + */ +public class NEEKnowledgeInscriberHandler implements IOverlayHandler { + + public class NEEArcaneOverlayButton extends NEETerminalOverlayButton { + + public NEEArcaneOverlayButton(GuiOverlayButton button) { + super(button.firstGui, button.handlerRef, button.xPosition, button.yPosition); + } + + @Override + protected List ingredientsOverlay() { + List ingredients = this.handlerRef.handler + .getIngredientStacks(this.handlerRef.recipeIndex); + + if (this.itemPresenceCache.size() != ingredients.size()) { + this.itemPresenceCache.clear(); + + final IngredientTracker tracker = new IngredientTracker( + firstGui, + this.handlerRef.handler, + this.handlerRef.recipeIndex); + + for (Ingredient ingredient : tracker.getIngredients()) { + this.itemPresenceCache.add(new NEEItemOverlayState(ingredient, true)); + } + + List items = this.itemPresenceCache.stream().filter(state -> !state.isPresent()) + .map(state -> state.getSlot().item).collect(Collectors.toList()); + + if (!items.isEmpty()) { + this.missedMaterialsTooltipLineHandler = new ItemsTooltipLineHandler( + NEIClientUtils.translate("recipe.overlay.missing"), + items, + true, + Integer.MAX_VALUE); + } else { + this.missedMaterialsTooltipLineHandler = null; + } + } + + return this.itemPresenceCache; + } + + } + + public static final NEEKnowledgeInscriberHandler instance = new NEEKnowledgeInscriberHandler(); + + private Class knowledgeInscriberClz; + private Class itemAspectClz; + + private NEEKnowledgeInscriberHandler() { + + try { + // "Knowledge Inscriber" + knowledgeInscriberClz = Class.forName("thaumicenergistics.client.gui.GuiKnowledgeInscriber"); + } catch (ClassNotFoundException ignored) {} + + try { + itemAspectClz = Class.forName("com.djgiannuzz.thaumcraftneiplugin.items.ItemAspect"); + } catch (ClassNotFoundException ignored) {} + + } + + @Override + public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) { + if (knowledgeInscriberClz != null && knowledgeInscriberClz.isInstance(firstGui)) { + NEENetworkHandler.getInstance().sendToServer(packetArcaneRecipe(recipe, recipeIndex)); + } + } + + private PacketArcaneRecipe packetArcaneRecipe(IRecipeHandler recipe, int recipeIndex) { + final NBTTagCompound recipeInputs = new NBTTagCompound(); + final List ingredients = recipe.getIngredientStacks(recipeIndex); + + if (itemAspectClz != null) { + ingredients.removeIf(positionedStack -> itemAspectClz.isInstance(positionedStack.item.getItem())); + } + + for (PositionedStack positionedStack : ingredients) { + if (positionedStack.items != null && positionedStack.items.length > 0) { + final int slotIndex = getSlotIndex(positionedStack.relx * 100 + positionedStack.rely); + final ItemStack[] currentStackList = positionedStack.items; + ItemStack stack = positionedStack.item; + + for (ItemStack currentStack : currentStackList) { + if (Platform.isRecipePrioritized(currentStack)) { + stack = currentStack.copy(); + } + } + + recipeInputs.setTag("#" + slotIndex, ItemUtils.writeItemStackToNBT(stack, stack.stackSize)); + } + } + + return new PacketArcaneRecipe(recipeInputs); + } + + private int getSlotIndex(int xy) { + switch (xy) { + case 7533: + return 1; + case 10333: + return 2; + case 4960: + return 3; + case 7660: + return 4; + case 10360: + return 5; + case 4987: + return 6; + case 7687: + return 7; + case 10387: + return 8; + case 4832: + default: + return 0; + } + } + + @SubscribeEvent + public void onActionPerformedEventPost(GuiRecipeButton.UpdateRecipeButtonsEvent.Post event) { + + if (NEEConfig.noShift && event.gui instanceof GuiRecipe guiRecipe) { + + if (isGuiArcaneCraftingTerm(guiRecipe)) { + for (int i = 0; i < event.buttonList.size(); i++) { + if (event.buttonList.get(i) instanceof GuiOverlayButton btn) { + event.buttonList.set(i, new NEEArcaneOverlayButton(btn)); + } + } + } else if (isGuiKnowledgeInscriber(guiRecipe)) { + for (int i = 0; i < event.buttonList.size(); i++) { + if (event.buttonList.get(i) instanceof GuiOverlayButton btn) { + btn.setRequireShiftForOverlayRecipe(false); + } + } + } + } + + } + + private boolean isGuiKnowledgeInscriber(GuiRecipe gui) { + return gui.firstGui != null && this.getClass().isInstance(gui.getHandler().getOverlayHandler(gui.firstGui, 0)); + } + + private boolean isGuiArcaneCraftingTerm(GuiRecipe gui) { + return Loader.isModLoaded(ModIDs.ThE) + && gui.firstGui instanceof thaumicenergistics.client.gui.GuiArcaneCraftingTerminal; + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEEPatternTerminalHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEEPatternTerminalHandler.java new file mode 100644 index 0000000..926b52b --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEEPatternTerminalHandler.java @@ -0,0 +1,294 @@ +package com.github.vfyjxf.nee.nei; + +import static com.github.vfyjxf.nee.processor.RecipeProcessor.NULL_IDENTIFIER; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; + +import com.github.vfyjxf.nee.config.ItemCombination; +import com.github.vfyjxf.nee.config.NEEConfig; +import com.github.vfyjxf.nee.nei.NEETerminalOverlayButton.NEEItemOverlayState; +import com.github.vfyjxf.nee.network.NEENetworkHandler; +import com.github.vfyjxf.nee.network.packet.PacketNEIPatternRecipe; +import com.github.vfyjxf.nee.processor.IRecipeProcessor; +import com.github.vfyjxf.nee.processor.RecipeProcessor; +import com.github.vfyjxf.nee.utils.GuiUtils; +import com.github.vfyjxf.nee.utils.Ingredient; +import com.github.vfyjxf.nee.utils.IngredientTracker; +import com.github.vfyjxf.nee.utils.ItemUtils; +import com.github.vfyjxf.nee.utils.ModIDs; +import com.glodblock.github.nei.FluidPatternTerminalRecipeTransferHandler; + +import appeng.util.Platform; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.api.IOverlayHandler; +import codechicken.nei.recipe.GuiOverlayButton.ItemOverlayState; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiRecipeButton; +import codechicken.nei.recipe.IRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +/** + * @author vfyjxf + */ +public class NEEPatternTerminalHandler implements IOverlayHandler { + + public static final String INPUT_KEY = "#"; + public static final String OUTPUT_KEY = "Outputs"; + + // Add the function of mouse wheel to switch materials + public static Map ingredients = new HashMap<>(); + + public static final NEEPatternTerminalHandler instance = new NEEPatternTerminalHandler(); + + private NEEPatternTerminalHandler() {} + + @Override + public void overlayRecipe(GuiContainer gui, IRecipeHandler handler, int recipeIndex, boolean shift) { + transferRecipe(gui, handler, recipeIndex, 1); + } + + @Override + public int transferRecipe(GuiContainer gui, IRecipeHandler handler, int recipeIndex, int multiplier) { + multiplier = Math.max(1, multiplier); + + NEENetworkHandler.getInstance().sendToServer(packRecipe(handler, recipeIndex, multiplier)); + + if (Loader.isModLoaded(ModIDs.FC) + && (GuiUtils.isFluidCraftPatternTermEx(gui) || GuiUtils.isFluidCraftPatternTerm(gui))) { + fluidCraftOverlayRecipe(gui, handler, recipeIndex); + } + + return 0; + } + + @Override + public List presenceOverlay(GuiContainer firstGui, IRecipeHandler handler, int recipeIndex) { + final IngredientTracker tracker = new IngredientTracker(firstGui, handler, recipeIndex); + final List itemPresenceSlots = new ArrayList<>(); + + for (Ingredient ingredient : tracker.getIngredients()) { + itemPresenceSlots.add(new NEEItemOverlayState(ingredient, false)); + } + + return itemPresenceSlots; + } + + @Optional.Method(modid = ModIDs.FC) + private void fluidCraftOverlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { + FluidPatternTerminalRecipeTransferHandler.INSTANCE.overlayRecipe(firstGui, recipe, recipeIndex, true); + } + + private PacketNEIPatternRecipe packRecipe(IRecipeHandler recipe, int recipeIndex, int multiplier) { + if (isCraftingTableRecipe(recipe)) { + return packCraftingTableRecipe(recipe, recipeIndex); + } else { + return packProcessRecipe(recipe, recipeIndex, (int) multiplier); + } + } + + private boolean isCraftingTableRecipe(IRecipeHandler recipe) { + if (recipe instanceof TemplateRecipeHandler templateRecipeHandler) { + String overlayIdentifier = templateRecipeHandler.getOverlayIdentifier(); + return "crafting".equals(overlayIdentifier) || "crafting2x2".equals(overlayIdentifier); + } else { + return false; + } + } + + private PacketNEIPatternRecipe packProcessRecipe(IRecipeHandler recipe, int recipeIndex, int multiplier) { + final NBTTagCompound recipeInputs = new NBTTagCompound(); + final NBTTagCompound recipeOutputs = new NBTTagCompound(); + String identifier = recipe instanceof TemplateRecipeHandler ? recipe.getOverlayIdentifier() : NULL_IDENTIFIER; + if (identifier == null) { + identifier = NULL_IDENTIFIER; + } + int inputIndex = 0; + int outputIndex = 0; + + // get all recipe inputs and other stacks,use first item + for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) { + if (processor.getAllOverlayIdentifier().contains(identifier)) { + final List inputs = processor.getRecipeInput(recipe, recipeIndex, identifier); + final List outputs = processor.getRecipeOutput(recipe, recipeIndex, identifier); + final String recipeProcessorId = processor.getRecipeProcessorId(); + + if (!inputs.isEmpty() && !outputs.isEmpty()) { + final List mergedInputs = getMergedInputs( + inputs, + processor, + recipe, + recipeIndex, + identifier); + + NEEPatternTerminalHandler.ingredients.clear(); + + for (PositionedStack positionedStack : mergedInputs) { + ItemStack currentStack = positionedStack.getFilteredPermutations().get(0); + ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); + int stackSize = currentStack.stackSize; + + if (preferModItem != null) { + currentStack = preferModItem; + currentStack.stackSize = stackSize; + } + + for (ItemStack stack : positionedStack.items) { + if (Platform.isRecipePrioritized(stack) + || ItemUtils.isPreferItems(stack, recipeProcessorId, identifier)) { + currentStack = stack.copy(); + currentStack.stackSize = stackSize; + break; + } + } + + if (ItemUtils.isInBlackList(currentStack, recipeProcessorId, identifier)) { + continue; + } + + if (currentStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + currentStack.setItemDamage(0); + } + + if (currentStack.stackSize < 1) { + currentStack.stackSize = 1; + } + + recipeInputs.setTag( + INPUT_KEY + inputIndex, + ItemUtils.writeItemStackToNBT(currentStack, currentStack.stackSize * multiplier)); + NEEPatternTerminalHandler.ingredients.put(INPUT_KEY + inputIndex, positionedStack); + inputIndex++; + } + + for (PositionedStack positionedStack : outputs) { + if (outputIndex >= 4 || positionedStack == null || positionedStack.item == null) { + continue; + } + + ItemStack outputStack = positionedStack.item.copy(); + + if (outputStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + outputStack.setItemDamage(0); + } + + if (outputStack.stackSize < 1) { + outputStack.stackSize = 1; + } + + recipeOutputs.setTag( + OUTPUT_KEY + outputIndex, + ItemUtils.writeItemStackToNBT(outputStack, outputStack.stackSize * multiplier)); + outputIndex++; + } + + break; + } + } + } + + return new PacketNEIPatternRecipe(recipeInputs, recipeOutputs); + } + + private List getMergedInputs(List inputs, IRecipeProcessor processor, + IRecipeHandler recipe, int recipeIndex, String identifier) { + List mergedInputs = new ArrayList<>(); + + for (PositionedStack positionedStack : inputs) { + ItemStack currentStack = positionedStack.getFilteredPermutations().get(0); + ItemCombination currentValue = ItemCombination.valueOf(NEEConfig.itemCombinationMode); + boolean find = false; + + if (currentValue != ItemCombination.DISABLED && processor.mergeStacks(recipe, recipeIndex, identifier)) { + boolean isWhitelist = currentValue == ItemCombination.WHITELIST + && Arrays.asList(NEEConfig.itemCombinationWhitelist).contains(identifier); + + if (currentValue == ItemCombination.ENABLED || isWhitelist) { + for (PositionedStack storedStack : mergedInputs) { + + ItemStack firstStack = storedStack.getFilteredPermutations().get(0); + boolean areItemStackEqual = NEIServerUtils + .areStacksSameTypeCraftingWithNBT(firstStack, currentStack); + + if (areItemStackEqual + && (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) { + storedStack.items[0].stackSize = firstStack.stackSize + currentStack.stackSize; + find = true; + } + } + } + } + + if (!find) { + mergedInputs.add(positionedStack.copy()); + } + } + + return mergedInputs; + } + + private PacketNEIPatternRecipe packCraftingTableRecipe(IRecipeHandler recipe, int recipeIndex) { + final List ingredients = recipe.getIngredientStacks(recipeIndex); + final NBTTagCompound recipeInputs = new NBTTagCompound(); + NEEPatternTerminalHandler.ingredients.clear(); + + for (PositionedStack positionedStack : ingredients) { + final int col = (positionedStack.relx - 25) / 18; + final int row = (positionedStack.rely - 6) / 18; + int slotIndex = col + row * 3; + + if (positionedStack.items != null && positionedStack.items.length > 0) { + positionedStack = positionedStack.copy(); + ItemStack stack = positionedStack.getFilteredPermutations().get(0); + + ItemStack preferModItem = ItemUtils.getPreferModItem(positionedStack.items); + if (preferModItem != null) { + stack = preferModItem; + } + + for (ItemStack currentStack : positionedStack.items) { + if (Platform.isRecipePrioritized(currentStack) || ItemUtils.isPreferItems(currentStack)) { + stack = currentStack.copy(); + } + } + + ItemUtils.transformGTTool(stack); + + if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) { + stack.setItemDamage(0); + } + + positionedStack.item = stack; + recipeInputs.setTag(INPUT_KEY + slotIndex, ItemUtils.writeItemStackToNBT(stack, stack.stackSize)); + NEEPatternTerminalHandler.ingredients.put(INPUT_KEY + slotIndex, positionedStack); + } + + } + + return new PacketNEIPatternRecipe(recipeInputs, null); + } + + @SubscribeEvent + public void onActionPerformedEventPost(GuiRecipeButton.UpdateRecipeButtonsEvent.Post event) { + if (event.gui instanceof GuiRecipe guiRecipe && isGuiPatternTerm(guiRecipe)) { + NEETerminalOverlayButton.updateRecipeButtons(guiRecipe, event.buttonList); + } + } + + private boolean isGuiPatternTerm(GuiRecipe gui) { + return gui.firstGui != null && this.getClass().isInstance(gui.getHandler().getOverlayHandler(gui.firstGui, 0)); + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEETerminalBookmarkContainerHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEETerminalBookmarkContainerHandler.java new file mode 100644 index 0000000..574a8fe --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEETerminalBookmarkContainerHandler.java @@ -0,0 +1,43 @@ +package com.github.vfyjxf.nee.nei; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import com.github.vfyjxf.nee.network.NEENetworkHandler; +import com.github.vfyjxf.nee.network.packet.PacketNEIBookmark; +import com.github.vfyjxf.nee.utils.GuiUtils; + +import codechicken.nei.api.IBookmarkContainerHandler; + +public class NEETerminalBookmarkContainerHandler implements IBookmarkContainerHandler { + + public static final NEETerminalBookmarkContainerHandler instance = new NEETerminalBookmarkContainerHandler(); + + private NEETerminalBookmarkContainerHandler() {} + + @Override + public List getStorageStacks(GuiContainer guiContainer) { + return GuiUtils.getStorageStacks(guiContainer, stack -> stack.getStackSize() > 0).stream() + .map(stack -> stack.getItemStack().copy()).collect(Collectors.toList()); + } + + @Override + public void pullBookmarkItemsFromContainer(GuiContainer guiContainer, ArrayList bookmarkItems) { + final NBTTagCompound nbtBookmarkItems = new NBTTagCompound(); + + for (int i = 0; i < bookmarkItems.size(); i++) { + nbtBookmarkItems.setTag("#" + i, packBookmarkItem(bookmarkItems.get(i))); + } + + NEENetworkHandler.getInstance().sendToServer(new PacketNEIBookmark(nbtBookmarkItems)); + } + + private NBTTagCompound packBookmarkItem(ItemStack bookmarkItem) { + return bookmarkItem.writeToNBT(new NBTTagCompound()); + } +} diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEETerminalOverlayButton.java b/src/main/java/com/github/vfyjxf/nee/nei/NEETerminalOverlayButton.java new file mode 100644 index 0000000..ddb1f26 --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEETerminalOverlayButton.java @@ -0,0 +1,151 @@ +package com.github.vfyjxf.nee.nei; + +import java.util.List; +import java.util.Map; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; + +import org.lwjgl.opengl.GL11; + +import com.github.vfyjxf.nee.config.NEEConfig; +import com.github.vfyjxf.nee.utils.Ingredient; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.Image; +import codechicken.nei.LayoutManager; +import codechicken.nei.NEIClientConfig; +import codechicken.nei.drawable.DrawableBuilder; +import codechicken.nei.recipe.GuiOverlayButton; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.GuiRecipeButton; +import codechicken.nei.recipe.RecipeHandlerRef; +import codechicken.nei.util.NEIMouseUtils; + +public class NEETerminalOverlayButton extends GuiOverlayButton { + + public static class NEEItemOverlayState extends ItemOverlayState { + + private static final Image crossIcon = new DrawableBuilder( + "neenergistics:textures/gui/states.png", + 16, + 36, + 8, + 8).build(); + + private static final Image checkIcon = new DrawableBuilder( + "neenergistics:textures/gui/states.png", + 24, + 36, + 8, + 8).build(); + + protected Ingredient ingredient; + protected boolean isCraftingTerm = true; + + public NEEItemOverlayState(Ingredient ingredient, boolean isCraftingTerm) { + super(ingredient.getIngredient(), !ingredient.requiresToCraft()); + this.ingredient = ingredient; + this.isCraftingTerm = isCraftingTerm; + } + + public Ingredient getIngredient() { + return this.ingredient; + } + + public boolean isCraftingTerm() { + return this.isCraftingTerm; + } + + public void setIsCraftingTerm(boolean isCraftingTerm) { + this.isCraftingTerm = isCraftingTerm; + } + + public void draw(ItemOverlayFormat format) { + final boolean doCraftingHelp = NEIClientConfig.isKeyHashDown("nee.nopreview") + || NEIClientConfig.isKeyHashDown("nee.preview"); + + if (this.ingredient.isCraftable() + && (!this.isCraftingTerm || doCraftingHelp && this.ingredient.requiresToCraft())) { + final Image icon = this.isPresent ? checkIcon : crossIcon; + + if (format == ItemOverlayFormat.BACKGROUND) { + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GuiDraw.drawRect(this.slot.relx, this.slot.rely, 16, 16, 0x660000AA); + GL11.glPopAttrib(); + } else { + LayoutManager.drawIcon(this.slot.relx + 16 - icon.width, this.slot.rely + 16 - icon.height, icon); + } + + } else { + super.draw(format); + } + } + } + + public NEETerminalOverlayButton(GuiContainer firstGui, RecipeHandlerRef handlerRef, int xPosition, int yPosition) { + super(firstGui, handlerRef, xPosition, yPosition); + if (NEEConfig.noShift) { + setRequireShiftForOverlayRecipe(false); + } + } + + public NEETerminalOverlayButton(GuiOverlayButton button) { + this(button.firstGui, button.handlerRef, button.xPosition, button.yPosition); + } + + @Override + public void mouseReleased(int mousex, int mousey) { + if (this.firstGui != null && !NEECraftingPreviewHandler.instance + .handle(this.firstGui, this.handlerRef.handler, this.handlerRef.recipeIndex)) { + super.mouseReleased(mousex, mousey); + } + } + + @Override + public Map handleHotkeys(GuiContainer gui, int mousex, int mousey, Map hotkeys) { + hotkeys = super.handleHotkeys(gui, mousex, mousey, hotkeys); + + if (ingredientsOverlay().stream().allMatch( + state -> state.isPresent() + || state instanceof NEEItemOverlayState overlayState && showCraftingHotkeys(overlayState))) { + + if (NEECraftingPreviewHandler.instance + .canCraftRecipeResult(gui, this.handlerRef.handler, handlerRef.recipeIndex)) { + hotkeys.put( + NEIClientConfig.getKeyName("nee.preview", 0, NEIMouseUtils.MOUSE_BTN_LMB), + I18n.format("neenergistics.gui.tooltip.crafting.preview.result")); + + hotkeys.put( + NEIClientConfig.getKeyName("nee.nopreview", 0, NEIMouseUtils.MOUSE_BTN_LMB), + I18n.format("neenergistics.gui.tooltip.crafting.nopreview.result")); + } else { + hotkeys.put( + NEIClientConfig.getKeyName("nee.preview", 0, NEIMouseUtils.MOUSE_BTN_LMB), + I18n.format("neenergistics.gui.tooltip.crafting.preview")); + + hotkeys.put( + NEIClientConfig.getKeyName("nee.nopreview", 0, NEIMouseUtils.MOUSE_BTN_LMB), + I18n.format("neenergistics.gui.tooltip.crafting.nopreview")); + } + + } + + return hotkeys; + } + + private static boolean showCraftingHotkeys(NEEItemOverlayState button) { + return button.getIngredient().isCraftable() || !button.getIngredient().requiresToCraft(); + } + + public static void updateRecipeButtons(GuiRecipe guiRecipe, List buttonList) { + for (int i = 0; i < buttonList.size(); i++) { + if (buttonList.get(i) instanceof GuiOverlayButton btn) { + buttonList.set(i, new NEETerminalOverlayButton(btn)); + } + } + } + +} diff --git a/src/main/java/com/github/vfyjxf/nee/network/NEEGuiHandler.java b/src/main/java/com/github/vfyjxf/nee/network/NEEGuiHandler.java index 22a8938..4a9a176 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/NEEGuiHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/network/NEEGuiHandler.java @@ -8,104 +8,31 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler; -import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils; -import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject; import com.github.vfyjxf.nee.block.tile.TilePatternInterface; -import com.github.vfyjxf.nee.client.gui.GuiCraftingAmount; import com.github.vfyjxf.nee.client.gui.GuiPatternInterface; -import com.github.vfyjxf.nee.container.ContainerCraftingAmount; -import com.github.vfyjxf.nee.container.ContainerCraftingConfirm; import com.github.vfyjxf.nee.container.ContainerPatternInterface; -import com.github.vfyjxf.nee.container.WCTContainerCraftingConfirm; -import com.github.vfyjxf.nee.utils.ModIDs; -import appeng.api.AEApi; -import appeng.api.implementations.guiobjects.IPortableCell; -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.storage.ITerminalHost; -import appeng.client.gui.implementations.GuiCraftConfirm; -import appeng.container.AEBaseContainer; -import appeng.container.ContainerOpenContext; -import appeng.parts.reporting.PartCraftingTerminal; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.IGuiHandler; public class NEEGuiHandler implements IGuiHandler { - public static final int CRAFTING_AMOUNT_ID = 0; - public static final int CRAFTING_CONFIRM_ID = 1; - public static final int PATTERN_INTERFACE_ID = 2; - public static final int CRAFTING_CONFIRM_WIRELESS_ID = 3; - public static final int CRAFTING_AMOUNT_WIRELESS_ID = 4; + public static final int PATTERN_INTERFACE_ID = 0; @Nullable @Override public Object getServerGuiElement(int ordinal, EntityPlayer player, World world, int x, int y, int z) { final int guiId = ordinal >> 4; - if (guiId != CRAFTING_AMOUNT_WIRELESS_ID && guiId != CRAFTING_CONFIRM_WIRELESS_ID) { - final ForgeDirection side = ForgeDirection.getOrientation(ordinal & 7); - TileEntity tile = world.getTileEntity(x, y, z); - if (side != ForgeDirection.UNKNOWN) { - if (tile instanceof IPartHost) { - IPartHost partHost = (IPartHost) tile; - IPart part = partHost.getPart(side); - switch (guiId) { - case CRAFTING_AMOUNT_ID: - if (part instanceof PartCraftingTerminal) { - return updateGui( - new ContainerCraftingAmount(player.inventory, part), - world, - x, - y, - z, - side, - part); - } - return null; - case CRAFTING_CONFIRM_ID: - if (part instanceof PartCraftingTerminal) { - return updateGui( - new ContainerCraftingConfirm(player.inventory, (ITerminalHost) part), - world, - x, - y, - z, - side, - part); - } - return null; - default: - break; - } - } - } else { - if (tile != null) { - if (guiId == PATTERN_INTERFACE_ID) { - if (tile instanceof TilePatternInterface) { - return new ContainerPatternInterface(player.inventory, (TilePatternInterface) tile); - } - } - } + if (guiId == PATTERN_INTERFACE_ID) { + final TileEntity tile = world.getTileEntity(x, y, z); + + if (tile instanceof TilePatternInterface pattern) { + return new ContainerPatternInterface(player.inventory, pattern); } - } else if (Loader.isModLoaded(ModIDs.WCT)) { - final IPortableCell wirelessTerminal = getWirelessTerminalGui(player, world, x, y, z); - if (wirelessTerminal != null) { - if (guiId == CRAFTING_AMOUNT_WIRELESS_ID) { - return new ContainerCraftingAmount(player.inventory, wirelessTerminal); - } else { - return new WCTContainerCraftingConfirm(player.inventory, wirelessTerminal); - } - - } else { - return null; - } } + return null; } @@ -113,87 +40,19 @@ public class NEEGuiHandler implements IGuiHandler { @Override public Object getClientGuiElement(int ordinal, EntityPlayer player, World world, int x, int y, int z) { final int guiId = ordinal >> 4; - if (guiId != CRAFTING_AMOUNT_WIRELESS_ID && guiId != CRAFTING_CONFIRM_WIRELESS_ID) { - final ForgeDirection side = ForgeDirection.getOrientation(ordinal & 7); - TileEntity tile = world.getTileEntity(x, y, z); - if (side != ForgeDirection.UNKNOWN) { - if (tile instanceof IPartHost) { - IPartHost partHost = (IPartHost) tile; - IPart part = partHost.getPart(side); - switch (guiId) { - case CRAFTING_AMOUNT_ID: - if (part instanceof PartCraftingTerminal) { - return updateGui( - new GuiCraftingAmount(player.inventory, (ITerminalHost) part), - world, - x, - y, - z, - side, - part); - } - return null; - case CRAFTING_CONFIRM_ID: - if (part instanceof PartCraftingTerminal) { - return updateGui( - new GuiCraftConfirm(player.inventory, (ITerminalHost) part), - world, - x, - y, - z, - side, - part); - } - return null; - default: - break; - } - } + if (guiId == PATTERN_INTERFACE_ID) { + final TileEntity tile = world.getTileEntity(x, y, z); - } else { - if (tile != null) { - if (guiId == PATTERN_INTERFACE_ID) { - if (tile instanceof TilePatternInterface) { - return new GuiPatternInterface(player.inventory, (TilePatternInterface) tile); - } - } - } + if (tile instanceof TilePatternInterface pattern) { + return new GuiPatternInterface(player.inventory, pattern); } - } else if (Loader.isModLoaded(ModIDs.WCT)) { - final IPortableCell wirelessTerminal = getWirelessTerminalGui(player, world, x, y, z); - - if (wirelessTerminal != null) { - if (guiId == CRAFTING_AMOUNT_WIRELESS_ID) { - return new GuiCraftingAmount(player.inventory, wirelessTerminal); - } else { - return new net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm( - player.inventory, - wirelessTerminal); - } - - } else { - return null; - } } + return null; } - private Object updateGui(Object newContainer, final World w, final int x, final int y, final int z, - final ForgeDirection side, final IPart part) { - if (newContainer instanceof AEBaseContainer) { - final AEBaseContainer bc = (AEBaseContainer) newContainer; - bc.setOpenContext(new ContainerOpenContext(part)); - bc.getOpenContext().setWorld(w); - bc.getOpenContext().setX(x); - bc.getOpenContext().setY(y); - bc.getOpenContext().setZ(z); - bc.getOpenContext().setSide(side); - } - return newContainer; - } - public static void openGui(EntityPlayer player, int ID, TileEntity tile, ForgeDirection side) { int x = tile.xCoord; int y = tile.yCoord; @@ -201,27 +60,11 @@ public class NEEGuiHandler implements IGuiHandler { player.openGui(instance, ID << 4 | (side.ordinal()), tile.getWorldObj(), x, y, z); } - public static void openGui(EntityPlayer player, int ID, World world) { + public static void openGui(EntityPlayer player, int ID) { int x = (int) player.posX; int y = (int) player.posY; int z = (int) player.posZ; - player.openGui(instance, (ID << 4), world, x, y, z); + player.openGui(instance, (ID << 4), player.worldObj, x, y, z); } - @Optional.Method(modid = ModIDs.WCT) - private WirelessTerminalGuiObject getWirelessTerminalGui(EntityPlayer player, World world, int x, int y, int z) { - final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless() - .getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory)); - if (wh != null) { - return new WirelessTerminalGuiObject( - wh, - RandomUtils.getWirelessTerm(player.inventory), - player, - world, - x, - y, - z); - } - return null; - } } diff --git a/src/main/java/com/github/vfyjxf/nee/network/NEENetworkHandler.java b/src/main/java/com/github/vfyjxf/nee/network/NEENetworkHandler.java index 76e5c45..b698d64 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/NEENetworkHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/network/NEENetworkHandler.java @@ -4,10 +4,9 @@ import com.github.vfyjxf.nee.NotEnoughEnergistics; import com.github.vfyjxf.nee.network.packet.PacketArcaneRecipe; import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest; import com.github.vfyjxf.nee.network.packet.PacketExtremeRecipe; +import com.github.vfyjxf.nee.network.packet.PacketNEIBookmark; import com.github.vfyjxf.nee.network.packet.PacketNEIPatternRecipe; -import com.github.vfyjxf.nee.network.packet.PacketOpenCraftAmount; import com.github.vfyjxf.nee.network.packet.PacketOpenGui; -import com.github.vfyjxf.nee.network.packet.PacketSetRecipe; import com.github.vfyjxf.nee.network.packet.PacketSlotStackChange; import com.github.vfyjxf.nee.network.packet.PacketStackCountChange; import com.github.vfyjxf.nee.network.packet.PacketValueConfigClient; @@ -25,6 +24,10 @@ public class NEENetworkHandler { return packId++; } + private NEENetworkHandler() { + throw new IllegalStateException("Utility class"); + } + public static SimpleNetworkWrapper getInstance() { return INSTANCE; } @@ -52,13 +55,8 @@ public class NEENetworkHandler { PacketCraftingRequest.class, nextId(), Side.SERVER); - INSTANCE.registerMessage( - PacketOpenCraftAmount.Handler.class, - PacketOpenCraftAmount.class, - nextId(), - Side.SERVER); + INSTANCE.registerMessage(PacketNEIBookmark.Handler.class, PacketNEIBookmark.class, nextId(), Side.SERVER); INSTANCE.registerMessage(PacketOpenGui.Handler.class, PacketOpenGui.class, nextId(), Side.SERVER); - INSTANCE.registerMessage(PacketSetRecipe.Handler.class, PacketSetRecipe.class, nextId(), Side.SERVER); INSTANCE.registerMessage( PacketValueConfigServer.Handler.class, PacketValueConfigServer.class, diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketArcaneRecipe.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketArcaneRecipe.java index 7393455..41eef67 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketArcaneRecipe.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketArcaneRecipe.java @@ -16,6 +16,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.ReflectionHelper; import io.netty.buffer.ByteBuf; +import thaumicenergistics.client.gui.GuiArcaneCraftingTerminal; import thaumicenergistics.common.container.ContainerKnowledgeInscriber; /** @@ -68,7 +69,30 @@ public class PacketArcaneRecipe implements IMessage { } container.onCraftMatrixChanged(craftMatrix[0].inventory); } + } else if (container.inventorySlots instanceof GuiArcaneCraftingTerminal) { + ItemStack[] recipeInput = new ItemStack[9]; + NBTTagCompound currentStack; + for (int i = 0; i < recipeInput.length; i++) { + currentStack = (NBTTagCompound) message.input.getTag("#" + i); + recipeInput[i] = currentStack == null ? null : ItemUtils.loadItemStackFromNBT(currentStack); + } + Field craftingSlots = ReflectionHelper.findField(GuiArcaneCraftingTerminal.class, "craftingSlots"); + SlotFakeCraftingMatrix[] craftMatrix = this + .getCraftingSlots(craftingSlots, (GuiArcaneCraftingTerminal) container.inventorySlots); + + if (craftMatrix != null && message.input != null) { + for (int i = 0; i < recipeInput.length; i++) { + ItemStack currentItem = null; + if (recipeInput[i] != null) { + currentItem = recipeInput[i].copy(); + } + craftMatrix[i].putStack(currentItem); + } + container.onCraftMatrixChanged(craftMatrix[0].inventory); + } + } + return null; } @@ -80,5 +104,14 @@ public class PacketArcaneRecipe implements IMessage { } return null; } + + private SlotFakeCraftingMatrix[] getCraftingSlots(Field field, GuiArcaneCraftingTerminal container) { + try { + return (SlotFakeCraftingMatrix[]) field.get(container); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } } } diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketCraftingRequest.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketCraftingRequest.java index a4f2816..fce979a 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketCraftingRequest.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketCraftingRequest.java @@ -1,120 +1,115 @@ package com.github.vfyjxf.nee.network.packet; -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY; -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY; -import static com.github.vfyjxf.nee.nei.NEECraftingHelper.RECIPE_LENGTH; - -import java.io.IOException; +import java.util.Objects; import java.util.concurrent.Future; +import java.util.function.Consumer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler; -import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal; -import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject; import net.p455w0rd.wirelesscraftingterminal.reference.Reference; -import org.apache.commons.lang3.tuple.Pair; - import com.github.vfyjxf.nee.block.tile.TilePatternInterface; -import com.github.vfyjxf.nee.container.ContainerCraftingAmount; -import com.github.vfyjxf.nee.container.ContainerCraftingConfirm; -import com.github.vfyjxf.nee.container.WCTContainerCraftingConfirm; -import com.github.vfyjxf.nee.network.NEEGuiHandler; import com.github.vfyjxf.nee.utils.GuiUtils; import com.github.vfyjxf.nee.utils.ModIDs; -import com.google.common.base.Optional; +import com.glodblock.github.inventory.InventoryHandler; +import com.glodblock.github.inventory.gui.GuiType; +import com.glodblock.github.inventory.item.IWirelessTerminal; +import com.glodblock.github.util.BlockPos; import appeng.api.AEApi; +import appeng.api.config.CraftingMode; import appeng.api.config.SecurityPermissions; import appeng.api.networking.IGrid; -import appeng.api.networking.IGridHost; import appeng.api.networking.IGridNode; import appeng.api.networking.crafting.ICraftingGrid; import appeng.api.networking.crafting.ICraftingJob; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.networking.security.IActionHost; import appeng.api.networking.security.ISecurityGrid; +import appeng.api.networking.security.PlayerSource; import appeng.api.networking.storage.IStorageGrid; import appeng.api.storage.IMEMonitor; import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; import appeng.container.AEBaseContainer; -import appeng.container.ContainerNull; import appeng.container.ContainerOpenContext; import appeng.container.implementations.ContainerCraftConfirm; -import appeng.container.implementations.ContainerCraftingTerm; import appeng.core.AELog; import appeng.core.sync.GuiBridge; +import appeng.me.cache.CraftingGridCache; +import appeng.tile.inventory.AppEngInternalInventory; import appeng.util.Platform; -import appeng.util.item.AEItemStack; import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; +import thaumicenergistics.common.ThEGuiHandler; +import thaumicenergistics.common.container.ContainerPartArcaneCraftingTerminal; public class PacketCraftingRequest implements IMessage { - private IAEItemStack requireToCraftStack; + public static int COMMAND_CREATE_PATTERN = 0; + public static int COMMAND_REMOVE_PATTERN = 1; + public static int COMMAND_OPEN_CRAFT_CONFIRM = 2; + + private String modID = ""; + private int command = 3; + private NBTTagCompound compound; private boolean isAutoStart; private int craftAmount; public PacketCraftingRequest() {} - public PacketCraftingRequest(IAEItemStack requireToCraftStack, boolean isAutoStart) { - this.requireToCraftStack = requireToCraftStack; - this.isAutoStart = isAutoStart; - } - - public PacketCraftingRequest(int craftAmount, boolean isAutoStart) { + public PacketCraftingRequest(String modID, int command, NBTTagCompound compound, int craftAmount, + boolean isAutoStart) { + this.modID = modID; + this.command = command; + this.compound = compound; this.craftAmount = craftAmount; this.isAutoStart = isAutoStart; } - public IAEItemStack getRequireToCraftStack() { - return requireToCraftStack; + public boolean isAutoStart() { + return this.isAutoStart; } - public boolean isAutoStart() { - return isAutoStart; + public void setIsAutoStart(boolean isAutoStart) { + this.isAutoStart = isAutoStart; } public int getCraftAmount() { - return craftAmount; + return Math.max(1, this.craftAmount); + } + + public void setCraftAmount(int craftAmount) { + this.craftAmount = craftAmount; + } + + public void getModID(String modID) { + this.modID = modID; } @Override public void fromBytes(ByteBuf buf) { - if (buf.readBoolean()) { - try { - this.requireToCraftStack = AEItemStack.loadItemStackFromPacket(buf); - } catch (IOException e) { - e.printStackTrace(); - } - } + this.modID = ByteBufUtils.readUTF8String(buf); + this.command = buf.readInt(); + this.compound = ByteBufUtils.readTag(buf); this.isAutoStart = buf.readBoolean(); this.craftAmount = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { - if (this.requireToCraftStack != null) { - try { - buf.writeBoolean(true); - this.requireToCraftStack.writeToPacket(buf); - } catch (IOException e) { - e.printStackTrace(); - } - } else { - buf.writeBoolean(false); - } + ByteBufUtils.writeUTF8String(buf, this.modID); + buf.writeInt(this.command); + ByteBufUtils.writeTag(buf, this.compound); buf.writeBoolean(this.isAutoStart); buf.writeInt(this.craftAmount); } @@ -123,260 +118,249 @@ public class PacketCraftingRequest implements IMessage { @Override public IMessage onMessage(PacketCraftingRequest message, MessageContext ctx) { - EntityPlayerMP player = ctx.getServerHandler().playerEntity; - Container container = player.openContainer; + final EntityPlayerMP player = ctx.getServerHandler().playerEntity; + final Container container = player.openContainer; + final IGrid grid = GuiUtils.getGrid(container); - if (GuiUtils.isWirelessCraftingTermContainer(container)) { - message.handlerWirelessCraftingRequest((ContainerWirelessCraftingTerminal) container, message, player); - } else if (container instanceof AEBaseContainer) { - AEBaseContainer baseContainer = (AEBaseContainer) container; - Object target = baseContainer.getTarget(); - if (target instanceof IGridHost) { - final IGridHost gh = (IGridHost) target; - final IGridNode gn = gh.getGridNode(ForgeDirection.UNKNOWN); - if (gn != null) { - final IGrid grid = gn.getGrid(); - if (grid != null) { - final ISecurityGrid security = grid.getCache(ISecurityGrid.class); - if (security != null && security.hasPermission(player, SecurityPermissions.CRAFT)) { - if (container instanceof ContainerCraftingTerm) { - message.handlerCraftingTermRequest( - (ContainerCraftingTerm) container, - message, - grid, - player); - } + if (grid == null) { + return null; + } - if (container instanceof ContainerCraftingAmount) { - message.handlerCraftingAmountRequest( - (ContainerCraftingAmount) container, - message, - grid, - player); - } - } - } + final ISecurityGrid security = grid.getCache(ISecurityGrid.class); + + if (security == null || !security.hasPermission(player, SecurityPermissions.CRAFT)) { + return null; + } + + if (message.command == COMMAND_REMOVE_PATTERN) { + final ItemStack resultStack = ItemStack.loadItemStackFromNBT(message.compound.getCompoundTag("out")); + + if (resultStack != null) { + removeRecipePattern(grid, resultStack, message.compound, player); + container.detectAndSendChanges(); + } + + } else { + + if (message.command == COMMAND_OPEN_CRAFT_CONFIRM) { + final IStorageGrid inv = grid.getCache(IStorageGrid.class); + final ItemStack resultStack = ItemStack.loadItemStackFromNBT(message.compound); + final IAEItemStack requireToCraftStack = getrequireToCraftStack( + inv.getItemInventory(), + resultStack); + + if (requireToCraftStack != null) { + requireToCraftStack.setStackSize(message.getCraftAmount()); + message.openCraftConfirm(container, grid, requireToCraftStack, player); } + } else if (message.command == COMMAND_CREATE_PATTERN) { + final IStorageGrid inv = grid.getCache(IStorageGrid.class); + final ItemStack resultStack = ItemStack + .loadItemStackFromNBT(message.compound.getCompoundTag("out")); + createRecipePattern(grid, resultStack, message.compound, player); + final IAEItemStack requireToCraftStack = getrequireToCraftStack( + inv.getItemInventory(), + resultStack); + + if (requireToCraftStack != null) { + requireToCraftStack.setStackSize(message.getCraftAmount()); + message.openCraftConfirm(container, grid, requireToCraftStack, player); + } + + } + + } + + return null; + } + + /* + * For some reason,the output from jei is different from the actual one, so apply ItemStack.isItemEqual to + * match. + */ + private IAEItemStack getrequireToCraftStack(IMEMonitor storage, ItemStack resultStack) { + + if (resultStack == null) { + return null; + } + + for (IAEItemStack aeStack : storage.getStorageList()) { + if (resultStack.isItemEqual(aeStack.getItemStack()) && aeStack.isCraftable()) { + return aeStack.copy(); } } return null; } + + private boolean createRecipePattern(IGrid grid, ItemStack resultStack, NBTTagCompound patternValue, + EntityPlayer player) { + ItemStack patternStack = AEApi.instance().definitions().items().encodedPattern().maybeStack(1).orNull(); + + if (patternStack == null) { + return false; + } + + for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) { + if (gridNode.getMachine() instanceof TilePatternInterface tpi) { + if (tpi.getProxy().isActive() && tpi.canPutPattern(resultStack)) { + patternStack = patternStack.copy(); + patternStack.setTagCompound(patternValue); + tpi.putPattern(patternStack); + return true; + } + } + } + + return false; + } + + private void removeRecipePattern(IGrid grid, ItemStack resultStack, NBTTagCompound patternValue, + EntityPlayer player) { + + for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) { + if (gridNode.getMachine() instanceof TilePatternInterface tpi) { + final AppEngInternalInventory inventory = tpi.getPatternInventory(); + + for (int slotIndex = 0; slotIndex < inventory.getSizeInventory(); slotIndex++) { + final ItemStack patternStack = inventory.getStackInSlot(slotIndex); + + if (patternStack != null && patternValue.equals(patternStack.getTagCompound())) { + inventory.setInventorySlotContents(slotIndex, null); + tpi.updateCraftingList(); + return; + } + } + + } + } + + } + } - private void handlerCraftingTermRequest(ContainerCraftingTerm container, PacketCraftingRequest message, IGrid grid, + public void openCraftConfirm(Container container, IGrid grid, IAEItemStack requireToCraftStack, EntityPlayerMP player) { - if (message.getRequireToCraftStack() != null) { - Future futureJob = null; - try { - final ICraftingGrid cg = grid.getCache(ICraftingGrid.class); - futureJob = cg.beginCraftingJob( + + if (Loader.isModLoaded(ModIDs.ThE) && this.modID.equals(ModIDs.ThE) + && container instanceof ContainerPartArcaneCraftingTerminal cpact) { + openTHContainerCraftConfirm(grid, requireToCraftStack, (IActionHost) cpact.terminal, player); + } else if (container instanceof AEBaseContainer baseContainer) { + if (Loader.isModLoaded(ModIDs.ThE) && this.modID.equals(ModIDs.ThE)) { + openTHContainerCraftConfirm(grid, requireToCraftStack, (IActionHost) baseContainer.getTarget(), player); + } else if (Loader.isModLoaded(ModIDs.FC) && this.modID.equals(ModIDs.FC)) { + openFCContainerCraftConfirm(baseContainer, grid, requireToCraftStack, player); + } else if (Loader.isModLoaded(ModIDs.WCT) && this.modID.equals(ModIDs.WCT)) { + openWCTContainerCraftConfirm(baseContainer, grid, requireToCraftStack, player); + } else { + openAEContainerCraftConfirm(baseContainer, grid, requireToCraftStack, player); + } + } + + } + + private void openContainerCraftConfirm(IGrid grid, IAEItemStack requireToCraftStack, EntityPlayerMP player, + BaseActionSource actionSource, Consumer> consumer) { + Future futureJob = null; + + try { + final ICraftingGrid cg = grid.getCache(ICraftingGrid.class); + + if (cg instanceof CraftingGridCache cgc) { + futureJob = cgc.beginCraftingJob( player.worldObj, grid, - container.getActionSource(), - message.getRequireToCraftStack(), + actionSource, + requireToCraftStack, + CraftingMode.STANDARD, null); - - final ContainerOpenContext context = container.getOpenContext(); - if (context != null) { - final TileEntity te = context.getTile(); - Platform.openGUI(player, te, container.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM); - if (player.openContainer instanceof ContainerCraftConfirm) { - final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer; - ccc.setItemToCraft(message.getRequireToCraftStack()); - ccc.setJob(futureJob); - ccc.setAutoStart(message.isAutoStart()); - } - } - } catch (final Throwable e) { - if (futureJob != null) { - futureJob.cancel(true); - } - AELog.debug(e); + } else { + futureJob = cg.beginCraftingJob(player.worldObj, grid, actionSource, requireToCraftStack, null); } + + consumer.accept(futureJob); + + if (player.openContainer instanceof ContainerCraftConfirm ccc) { + ccc.setItemToCraft(requireToCraftStack); + ccc.setJob(futureJob); + ccc.setAutoStart(this.isAutoStart); + ccc.detectAndSendChanges(); + } + + } catch (final Throwable e) { + if (futureJob != null) { + futureJob.cancel(true); + } + AELog.debug(e); } + } - private void handlerCraftingAmountRequest(ContainerCraftingAmount container, PacketCraftingRequest message, - IGrid grid, EntityPlayerMP player) { - if (container.getResultStack() != null) { + private void openAEContainerCraftConfirm(AEBaseContainer baseContainer, IGrid grid, + IAEItemStack requireToCraftStack, EntityPlayerMP player) { - Pair pair = setRecipe(grid, container.getRecipe(), player); - if (pair != null) { - final IStorageGrid inv = grid.getCache(IStorageGrid.class); - final IMEMonitor storage = inv.getItemInventory(); - final IItemList all = storage.getStorageList(); - ItemStack resultStack = container.getResultStack().copy(); - IAEItemStack result = null; - /* - * For some reason,the output from jei is different from the actual one, so apply ItemStack.isItemEqual - * to match. - */ - for (IAEItemStack aeStack : all) { - if (resultStack.isItemEqual(aeStack.getItemStack()) && aeStack.isCraftable()) { - result = aeStack.copy(); - break; - } - } + openContainerCraftConfirm(grid, requireToCraftStack, player, baseContainer.getActionSource(), job -> { + final ContainerOpenContext openContext = baseContainer.getOpenContext(); + Platform.openGUI(player, openContext.getTile(), openContext.getSide(), GuiBridge.GUI_CRAFTING_CONFIRM); + }); - if (result != null) { - result.setStackSize(message.getCraftAmount()); - Future futureJob = null; - try { - final ICraftingGrid cg = grid.getCache(ICraftingGrid.class); - futureJob = cg - .beginCraftingJob(player.worldObj, grid, container.getActionSource(), result, null); - - final ContainerOpenContext context = container.getOpenContext(); - if (context != null) { - final TileEntity te = context.getTile(); - NEEGuiHandler.openGui(player, NEEGuiHandler.CRAFTING_CONFIRM_ID, te, context.getSide()); - if (player.openContainer instanceof ContainerCraftingConfirm) { - final ContainerCraftingConfirm ccc = (ContainerCraftingConfirm) player.openContainer; - ccc.setItemToCraft(result); - ccc.setAutoStart(message.isAutoStart()); - ccc.setJob(futureJob); - ccc.setTile(pair.getLeft()); - ccc.setPatternIndex(pair.getRight()); - ccc.detectAndSendChanges(); - } - } else if (Loader.isModLoaded(ModIDs.WCT)) { - - NEEGuiHandler.openGui(player, NEEGuiHandler.CRAFTING_CONFIRM_WIRELESS_ID, player.worldObj); - - if (player.openContainer instanceof WCTContainerCraftingConfirm) { - final WCTContainerCraftingConfirm ccc = (WCTContainerCraftingConfirm) player.openContainer; - ccc.setItemToCraft(result); - ccc.setJob(futureJob); - ccc.setAutoStart(message.isAutoStart()); - ccc.setTile(pair.getLeft()); - ccc.setPatternIndex(pair.getRight()); - ccc.detectAndSendChanges(); - } - } - } catch (final Throwable e) { - if (futureJob != null) { - futureJob.cancel(true); - } - AELog.debug(e); - } - } - } - } } - private void handlerWirelessCraftingRequest(ContainerWirelessCraftingTerminal container, - PacketCraftingRequest message, EntityPlayerMP player) { - Object target = container.getTarget(); - if (target instanceof WirelessTerminalGuiObject) { - IGrid grid = ((WirelessTerminalGuiObject) target).getTargetGrid(); - if (grid != null) { - final ISecurityGrid security = grid.getCache(ISecurityGrid.class); - if (security != null && security.hasPermission(player, SecurityPermissions.CRAFT) - && message.getRequireToCraftStack() != null) { - Future futureJob = null; - try { - final ICraftingGrid cg = grid.getCache(ICraftingGrid.class); - futureJob = cg.beginCraftingJob( - player.worldObj, - grid, - container.getActionSource(), - message.getRequireToCraftStack(), - null); + @Optional.Method(modid = ModIDs.ThE) + private void openTHContainerCraftConfirm(IGrid grid, IAEItemStack requireToCraftStack, IActionHost host, + EntityPlayerMP player) { - int x = (int) player.posX; - int y = (int) player.posY; - int z = (int) player.posZ; + openContainerCraftConfirm( + grid, + requireToCraftStack, + player, + new PlayerSource(player, host), + job -> { + ThEGuiHandler.launchGui(ThEGuiHandler.AUTO_CRAFTING_CONFIRM, player, player.worldObj, 0, 0, 0); + }); - WCTGuiHandler.launchGui(Reference.GUI_CRAFT_CONFIRM, player, player.worldObj, x, y, z); - - if (player.openContainer instanceof net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm) { - final net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm ccc = (net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm) player.openContainer; - ccc.setItemToCraft(message.getRequireToCraftStack()); - ccc.setJob(futureJob); - ccc.setAutoStart(message.isAutoStart()); - } - } catch (final Throwable e) { - if (futureJob != null) { - futureJob.cancel(true); - } - AELog.debug(e); - } - } - } - } } - private Pair setRecipe(IGrid grid, NBTTagCompound recipe, EntityPlayer player) { + @Optional.Method(modid = ModIDs.FC) + private void openFCContainerCraftConfirm(AEBaseContainer baseContainer, IGrid grid, + IAEItemStack requireToCraftStack, EntityPlayerMP player) { - for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) { + openContainerCraftConfirm(grid, requireToCraftStack, player, baseContainer.getActionSource(), job -> { + final ContainerOpenContext openContext = baseContainer.getOpenContext(); + final TileEntity tileEntity = openContext.getTile(); - if (gridNode.getMachine() instanceof TilePatternInterface) { - - TilePatternInterface tpi = (TilePatternInterface) gridNode.getMachine(); - NBTTagCompound currentTag = recipe.getCompoundTag(OUTPUT_KEY); - ItemStack result = currentTag == null ? null : ItemStack.loadItemStackFromNBT(currentTag); - - if (tpi.getProxy().isActive() && tpi.canPutPattern(result)) { - - ItemStack patternStack = getPatternStack(player, recipe); - - if (patternStack != null) { - - int patternIndex = tpi.putPattern(patternStack); - if (patternIndex >= 0) { - return Pair.of(tpi, patternIndex); - } - } - } + if (tileEntity != null) { + InventoryHandler.openGui( + player, + player.worldObj, + new BlockPos(tileEntity), + Objects.requireNonNull(openContext.getSide()), + GuiType.FLUID_CRAFTING_CONFIRM); + } else if (baseContainer.getTarget() instanceof IWirelessTerminal wireless) { + InventoryHandler.openGui( + player, + player.worldObj, + new BlockPos(wireless.getInventorySlot(), 0, 0), + Objects.requireNonNull(openContext.getSide()), + GuiType.FLUID_CRAFTING_CONFIRM_ITEM); } - } - return null; + + }); + } - private ItemStack getPatternStack(EntityPlayer player, NBTTagCompound recipe) { - ItemStack[] recipeInputs = new ItemStack[RECIPE_LENGTH]; - NBTTagCompound currentStack; - for (int i = 0; i < recipeInputs.length; i++) { - currentStack = recipe.getCompoundTag(INPUT_KEY + i); - recipeInputs[i] = currentStack == null ? null : ItemStack.loadItemStackFromNBT(currentStack); - } - InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3); - for (int i = 0; i < RECIPE_LENGTH; i++) { - ic.setInventorySlotContents(i, recipeInputs[i]); - } + @Optional.Method(modid = ModIDs.WCT) + private void openWCTContainerCraftConfirm(AEBaseContainer baseContainer, IGrid grid, + IAEItemStack requireToCraftStack, EntityPlayerMP player) { - ItemStack result = CraftingManager.getInstance().findMatchingRecipe(ic, player.worldObj); - if (result != null) { - ItemStack patternStack = null; - Optional maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1); - if (maybePattern.isPresent()) { - patternStack = maybePattern.get(); - } - if (patternStack != null) { - final NBTTagCompound patternValue = new NBTTagCompound(); - final NBTTagList tagIn = new NBTTagList(); - for (ItemStack stack : recipeInputs) { - tagIn.appendTag(crateItemTag(stack)); - } - patternValue.setTag("in", tagIn); - patternValue.setTag("out", result.writeToNBT(new NBTTagCompound())); - patternValue.setBoolean("crafting", true); - patternValue.setBoolean("substitute", false); + openContainerCraftConfirm(grid, requireToCraftStack, player, baseContainer.getActionSource(), job -> { + final int x = (int) player.posX; + final int y = (int) player.posY; + final int z = (int) player.posZ; - patternStack.setTagCompound(patternValue); - return patternStack; - } - } + WCTGuiHandler.launchGui(Reference.GUI_CRAFT_CONFIRM, player, player.worldObj, x, y, z); + }); - return null; } - private NBTTagCompound crateItemTag(ItemStack itemStack) { - NBTTagCompound tag = new NBTTagCompound(); - if (itemStack != null) { - itemStack.writeToNBT(tag); - } - return tag; - } } diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIBookmark.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIBookmark.java new file mode 100644 index 0000000..de20f20 --- /dev/null +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIBookmark.java @@ -0,0 +1,142 @@ +package com.github.vfyjxf.nee.network.packet; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +import com.github.vfyjxf.nee.utils.ItemUtils; +import com.github.vfyjxf.nee.utils.ModIDs; + +import appeng.api.networking.IGrid; +import appeng.api.networking.energy.IEnergyGrid; +import appeng.api.networking.energy.IEnergySource; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.networking.security.PlayerSource; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.data.IAEItemStack; +import appeng.container.implementations.ContainerMEMonitorable; +import appeng.util.InventoryAdaptor; +import appeng.util.Platform; +import appeng.util.item.AEItemStack; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.network.ByteBufUtils; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.relauncher.ReflectionHelper; +import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException; +import io.netty.buffer.ByteBuf; +import thaumicenergistics.common.container.ContainerPartArcaneCraftingTerminal; + +public class PacketNEIBookmark implements IMessage { + + private NBTTagCompound bookmarkItems; + + public PacketNEIBookmark() {} + + public PacketNEIBookmark(NBTTagCompound bookmarkItems) { + this.bookmarkItems = bookmarkItems; + } + + @Override + public void fromBytes(ByteBuf buf) { + this.bookmarkItems = ByteBufUtils.readTag(buf); + } + + @Override + public void toBytes(ByteBuf buf) { + ByteBufUtils.writeTag(buf, this.bookmarkItems); + } + + public static final class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(PacketNEIBookmark message, MessageContext ctx) { + final EntityPlayerMP player = ctx.getServerHandler().playerEntity; + final Container container = player.openContainer; + + if (message.bookmarkItems == null) { + return null; + } + + if (container instanceof ContainerMEMonitorable monitorable) { + final IMEMonitor monitor = monitorable.getMonitor(); + if (monitor != null) { + final IEnergySource energy = monitorable.getPowerSource(); + final BaseActionSource actionSource = monitorable.getActionSource(); + + for (Object key : message.bookmarkItems.func_150296_c()) { + final ItemStack bookmarkItem = ItemUtils + .loadItemStackFromNBT(message.bookmarkItems.getCompoundTag((String) key)); + bookmarkItem.stackSize = getFreeStackSize(player, bookmarkItem); + + if (bookmarkItem.stackSize > 0) { + final AEItemStack requestStack = AEItemStack.create(bookmarkItem); + final IAEItemStack extractedStack = Platform + .poweredExtraction(energy, monitor, requestStack, actionSource); + + if (extractedStack != null) { + InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN) + .addItems(extractedStack.getItemStack()); + } + } + } + } + + } else if (Loader.isModLoaded(ModIDs.ThE) && container instanceof ContainerPartArcaneCraftingTerminal act) { + final IMEMonitor monitor = getMonitor(container); + final IGrid grid = act.getHostGrid(); + if (grid == null || monitor == null) return null; + final IEnergyGrid energy = grid.getCache(IEnergyGrid.class); + final BaseActionSource actionSource = new PlayerSource(player, act.terminal); + + for (Object key : message.bookmarkItems.func_150296_c()) { + final ItemStack bookmarkItem = ItemUtils + .loadItemStackFromNBT(message.bookmarkItems.getCompoundTag((String) key)); + bookmarkItem.stackSize = getFreeStackSize(player, bookmarkItem); + + if (bookmarkItem.stackSize > 0) { + final AEItemStack requestStack = AEItemStack.create(bookmarkItem); + final IAEItemStack extractedStack = Platform + .poweredExtraction(energy, monitor, requestStack, actionSource); + + if (extractedStack != null) { + InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN) + .addItems(extractedStack.getItemStack()); + } + } + } + + } + + return null; + } + + private int getFreeStackSize(EntityPlayer player, ItemStack itemStack) { + int freeStackSize = 0; + + for (ItemStack slotStack : player.inventory.mainInventory) { + if (slotStack == null) { // Empty slot, stack fits completely + freeStackSize += itemStack.getMaxStackSize(); + } else if (slotStack.isItemEqual(itemStack)) { + freeStackSize += itemStack.getMaxStackSize() - slotStack.stackSize; + } + } + + return Math.min(itemStack.stackSize, freeStackSize); + } + + private IMEMonitor getMonitor(Container container) { + + try { + return (IMEMonitor) ReflectionHelper.findField(container.getClass(), "monitor") + .get(container); + } catch (UnableToFindFieldException | IllegalAccessException e) {} + + return null; + } + } +} diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java index e27140d..6cbf6df 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketNEIPatternRecipe.java @@ -1,6 +1,7 @@ package com.github.vfyjxf.nee.network.packet; -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY; +import static com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler.INPUT_KEY; +import static com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler.OUTPUT_KEY; import javax.annotation.Nonnull; @@ -13,7 +14,6 @@ import net.minecraft.nbt.NBTTagCompound; import com.github.vfyjxf.nee.utils.ItemUtils; import com.github.vfyjxf.nee.utils.ModIDs; import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal; -import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx; import appeng.api.networking.IGrid; import appeng.api.networking.IGridNode; @@ -21,10 +21,8 @@ import appeng.api.networking.security.ISecurityGrid; import appeng.api.networking.storage.IStorageGrid; import appeng.container.AEBaseContainer; import appeng.container.implementations.ContainerPatternTerm; -import appeng.container.implementations.ContainerPatternTermEx; import appeng.helpers.IContainerCraftingPacket; import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -68,50 +66,53 @@ public class PacketNEIPatternRecipe implements IMessage { public IMessage onMessage(PacketNEIPatternRecipe message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().playerEntity; Container container = player.openContainer; - if (container instanceof ContainerPatternTerm && message.output == null) { - ((ContainerPatternTerm) container).getPatternTerminal().setCraftingRecipe(true); - message.craftingTableRecipeHandler((ContainerPatternTerm) container, message); - } else if (container instanceof ContainerPatternTerm) { - ((ContainerPatternTerm) container).getPatternTerminal().setCraftingRecipe(false); - message.processRecipeHandler((ContainerPatternTerm) container, message); - } else if (container instanceof ContainerPatternTermEx && message.output != null) { - ((ContainerPatternTermEx) container).getPatternTerminal().setInverted(false); - message.processRecipeHandler((ContainerPatternTermEx) container, message); + + if (message.input != null && container instanceof AEBaseContainer + && container instanceof IContainerCraftingPacket) { + AEBaseContainer baseContainer = (AEBaseContainer) container; + setCraftingRecipe(baseContainer, message.output == null); + + if (message.output == null) { + craftingRecipe(baseContainer, message); + } else { + processRecipe(baseContainer, message); + } } - if (Loader.isModLoaded(ModIDs.FC)) addFluidCraftSupport(message, ctx); + return null; } - @Optional.Method(modid = ModIDs.FC) - private void addFluidCraftSupport(PacketNEIPatternRecipe message, MessageContext ctx) { - EntityPlayerMP player = ctx.getServerHandler().playerEntity; - Container container = player.openContainer; - if (container instanceof ContainerFluidPatternTerminal && message.output == null) { - ((ContainerFluidPatternTerminal) container).getPatternTerminal().setCraftingRecipe(true); - message.craftingTableRecipeHandler((ContainerFluidPatternTerminal) container, message); - } else if (container instanceof ContainerFluidPatternTerminal) { - ((ContainerFluidPatternTerminal) container).getPatternTerminal().setCraftingRecipe(false); - message.processRecipeHandler((ContainerFluidPatternTerminal) container, message); - } else if (container instanceof ContainerFluidPatternTerminalEx) { - message.processRecipeHandler((ContainerFluidPatternTerminalEx) container, message); + private void setCraftingRecipe(AEBaseContainer container, boolean craftingMode) { + + if (container instanceof ContainerPatternTerm cpt) { + cpt.getPatternTerminal().setCraftingRecipe(craftingMode); + } else if (Loader.isModLoaded(ModIDs.FC) && container instanceof ContainerFluidPatternTerminal cfpt) { + cfpt.getPatternTerminal().setCraftingRecipe(craftingMode); } - } - } - private void craftingTableRecipeHandler(AEBaseContainer container, PacketNEIPatternRecipe message) { - ItemStack[] recipeInput = new ItemStack[9]; - NBTTagCompound currentStack; - - for (int i = 0; i < recipeInput.length; i++) { - currentStack = (NBTTagCompound) message.input.getTag("#" + i); - recipeInput[i] = currentStack == null ? null : ItemUtils.loadItemStackFromNBT(currentStack); } - final IContainerCraftingPacket cct = (IContainerCraftingPacket) container; - final IGridNode node = cct.getNetworkNode(); + private ItemStack[] getMatrix(NBTTagCompound items, String prefix, int size) { + ItemStack[] matrix = new ItemStack[size]; + + for (int i = 0; i < size; i++) { + NBTTagCompound currentStack = (NBTTagCompound) items.getTag(prefix + i); + matrix[i] = currentStack == null ? null : ItemUtils.loadItemStackFromNBT(currentStack); + } + + return matrix; + } + + private void craftingRecipe(AEBaseContainer container, PacketNEIPatternRecipe message) { + final IContainerCraftingPacket cct = (IContainerCraftingPacket) container; + final IGridNode node = cct.getNetworkNode(); + + if (node == null) { + return; + } - if (node != null) { final IGrid grid = node.getGrid(); + if (grid == null) { return; } @@ -120,62 +121,53 @@ public class PacketNEIPatternRecipe implements IMessage { final ISecurityGrid security = grid.getCache(ISecurityGrid.class); final IInventory craftMatrix = cct.getInventoryByName("crafting"); - if (inv != null && message.input != null && security != null) { - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { - ItemStack currentItem = null; - if (recipeInput[i] != null) { - currentItem = recipeInput[i].copy(); - } - craftMatrix.setInventorySlotContents(i, currentItem); + if (inv != null && craftMatrix != null && security != null) { + final ItemStack[] recipeInput = getMatrix(message.input, INPUT_KEY, craftMatrix.getSizeInventory()); + + for (int i = 0; i < recipeInput.length; i++) { + craftMatrix.setInventorySlotContents(i, recipeInput[i]); } + container.onCraftMatrixChanged(craftMatrix); } } - } - private void processRecipeHandler(AEBaseContainer container, PacketNEIPatternRecipe message) { - final IContainerCraftingPacket cct = (IContainerCraftingPacket) container; - final IGridNode node = cct.getNetworkNode(); + private void processRecipe(AEBaseContainer container, PacketNEIPatternRecipe message) { + final IContainerCraftingPacket cct = (IContainerCraftingPacket) container; + final IGridNode node = cct.getNetworkNode(); + + if (node == null) { + return; + } - if (node != null) { final IGrid grid = node.getGrid(); + if (grid == null) { return; } + final IStorageGrid inv = grid.getCache(IStorageGrid.class); final ISecurityGrid security = grid.getCache(ISecurityGrid.class); final IInventory craftMatrix = cct.getInventoryByName("crafting"); final IInventory outputMatrix = cct.getInventoryByName("output"); - ItemStack[] recipeInput = new ItemStack[craftMatrix.getSizeInventory()]; - ItemStack[] recipeOutput = new ItemStack[outputMatrix.getSizeInventory()]; - for (int i = 0; i < recipeInput.length; i++) { - NBTTagCompound currentStack = (NBTTagCompound) message.input.getTag("#" + i); - recipeInput[i] = currentStack == null ? null : ItemUtils.loadItemStackFromNBT(currentStack); - } + if (inv != null && craftMatrix != null && outputMatrix != null && security != null) { + final ItemStack[] recipeInput = getMatrix(message.input, INPUT_KEY, craftMatrix.getSizeInventory()); + final ItemStack[] recipeOutput = getMatrix(message.output, OUTPUT_KEY, outputMatrix.getSizeInventory()); - for (int i = 0; i < recipeOutput.length; i++) { - NBTTagCompound currentStack = (NBTTagCompound) message.output.getTag(OUTPUT_KEY + i); - recipeOutput[i] = currentStack == null ? null : ItemUtils.loadItemStackFromNBT(currentStack); - } - if (inv != null && message.input != null && security != null) { - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { - ItemStack currentItem = null; - if (recipeInput[i] != null) { - currentItem = recipeInput[i].copy(); - } - craftMatrix.setInventorySlotContents(i, currentItem); + for (int i = 0; i < recipeInput.length; i++) { + craftMatrix.setInventorySlotContents(i, recipeInput[i]); } - for (int i = 0; i < outputMatrix.getSizeInventory(); i++) { - ItemStack currentItem = null; - if (recipeOutput[i] != null) { - currentItem = recipeOutput[i].copy(); - } - outputMatrix.setInventorySlotContents(i, currentItem); + for (int i = 0; i < recipeOutput.length; i++) { + outputMatrix.setInventorySlotContents(i, recipeOutput[i]); } + container.onCraftMatrixChanged(craftMatrix); + container.onCraftMatrixChanged(outputMatrix); } } + } + } diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenCraftAmount.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenCraftAmount.java deleted file mode 100644 index 4a74171..0000000 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenCraftAmount.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.github.vfyjxf.nee.network.packet; - -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY; -import static com.github.vfyjxf.nee.network.NEEGuiHandler.CRAFTING_AMOUNT_ID; -import static com.github.vfyjxf.nee.network.NEEGuiHandler.CRAFTING_AMOUNT_WIRELESS_ID; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import com.github.vfyjxf.nee.container.ContainerCraftingAmount; -import com.github.vfyjxf.nee.network.NEEGuiHandler; -import com.github.vfyjxf.nee.utils.GuiUtils; - -import appeng.container.ContainerOpenContext; -import appeng.container.implementations.ContainerCraftingTerm; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import io.netty.buffer.ByteBuf; - -public class PacketOpenCraftAmount implements IMessage { - - private NBTTagCompound recipe; - - public PacketOpenCraftAmount() {} - - public PacketOpenCraftAmount(NBTTagCompound recipe) { - this.recipe = recipe; - } - - @Override - public void fromBytes(ByteBuf buf) { - this.recipe = ByteBufUtils.readTag(buf); - } - - @Override - public void toBytes(ByteBuf buf) { - ByteBufUtils.writeTag(buf, this.recipe); - } - - public static final class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(PacketOpenCraftAmount message, MessageContext ctx) { - EntityPlayerMP player = ctx.getServerHandler().playerEntity; - Container container = player.openContainer; - if (container instanceof ContainerCraftingTerm) { - final ContainerOpenContext context = ((ContainerCraftingTerm) container).getOpenContext(); - if (context != null) { - final TileEntity tile = context.getTile(); - - NEEGuiHandler.openGui(player, CRAFTING_AMOUNT_ID, tile, context.getSide()); - - if (player.openContainer instanceof ContainerCraftingAmount) { - ContainerCraftingAmount cca = (ContainerCraftingAmount) player.openContainer; - if (message.recipe != null) { - NBTTagCompound tag = message.recipe.getCompoundTag(OUTPUT_KEY); - ItemStack result = tag == null ? null : ItemStack.loadItemStackFromNBT(tag); - if (result != null) { - cca.setResultStack(result); - cca.getResultSlot().putStack(result); - cca.setRecipe(message.recipe); - } - } - cca.detectAndSendChanges(); - } - } - } else if (GuiUtils.isWirelessCraftingTermContainer(container)) { - - NEEGuiHandler.openGui(player, CRAFTING_AMOUNT_WIRELESS_ID, player.worldObj); - - if (player.openContainer instanceof ContainerCraftingAmount) { - ContainerCraftingAmount cca = (ContainerCraftingAmount) player.openContainer; - if (message.recipe != null) { - NBTTagCompound tag = message.recipe.getCompoundTag(OUTPUT_KEY); - ItemStack result = tag == null ? null : ItemStack.loadItemStackFromNBT(tag); - cca.setResultStack(result); - cca.getResultSlot().putStack(result); - cca.setRecipe(message.recipe); - } - cca.detectAndSendChanges(); - } - } - return null; - } - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenGui.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenGui.java index d19528a..a7da96b 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenGui.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketOpenGui.java @@ -1,7 +1,6 @@ package com.github.vfyjxf.nee.network.packet; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Container; import net.minecraft.tileentity.TileEntity; import com.github.vfyjxf.nee.network.NEEGuiHandler; @@ -37,15 +36,16 @@ public class PacketOpenGui implements IMessage { @Override public IMessage onMessage(PacketOpenGui message, MessageContext ctx) { - EntityPlayerMP player = ctx.getServerHandler().playerEntity; - Container container = player.openContainer; - if (container instanceof AEBaseContainer) { - final ContainerOpenContext context = ((AEBaseContainer) container).getOpenContext(); + final EntityPlayerMP player = ctx.getServerHandler().playerEntity; + + if (player.openContainer instanceof AEBaseContainer baseContainer) { + final ContainerOpenContext context = baseContainer.getOpenContext(); if (context != null) { final TileEntity tile = context.getTile(); NEEGuiHandler.openGui(player, message.guiId, tile, context.getSide()); } } + return null; } } diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketSetRecipe.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketSetRecipe.java deleted file mode 100644 index 28b703b..0000000 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketSetRecipe.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.github.vfyjxf.nee.network.packet; - -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.INPUT_KEY; -import static com.github.vfyjxf.nee.nei.NEECraftingHandler.OUTPUT_KEY; -import static com.github.vfyjxf.nee.nei.NEECraftingHelper.RECIPE_LENGTH; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import com.github.vfyjxf.nee.block.tile.TilePatternInterface; -import com.google.common.base.Optional; - -import appeng.api.AEApi; -import appeng.api.networking.IGrid; -import appeng.api.networking.IGridNode; -import appeng.api.networking.security.IActionHost; -import appeng.container.AEBaseContainer; -import appeng.container.ContainerNull; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import io.netty.buffer.ByteBuf; - -public class PacketSetRecipe implements IMessage { - - private NBTTagCompound recipe; - - public PacketSetRecipe() {} - - public PacketSetRecipe(NBTTagCompound recipe) { - this.recipe = recipe; - } - - @Override - public void fromBytes(ByteBuf buf) { - this.recipe = ByteBufUtils.readTag(buf); - } - - @Override - public void toBytes(ByteBuf buf) { - ByteBufUtils.writeTag(buf, this.recipe); - } - - public static final class Handler implements IMessageHandler { - - @Override - public IMessage onMessage(PacketSetRecipe message, MessageContext ctx) { - EntityPlayerMP player = ctx.getServerHandler().playerEntity; - Container container = player.openContainer; - - if (container instanceof AEBaseContainer) { - AEBaseContainer aeContainer = (AEBaseContainer) container; - IGrid grid = message.getNetwork(aeContainer); - if (grid != null) { - for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) { - - if (gridNode.getMachine() instanceof TilePatternInterface) { - - TilePatternInterface tpi = (TilePatternInterface) gridNode.getMachine(); - NBTTagCompound currentTag = message.recipe.getCompoundTag(OUTPUT_KEY); - ItemStack result = currentTag == null ? null : ItemStack.loadItemStackFromNBT(currentTag); - - if (tpi.getProxy().isActive() && tpi.canPutPattern(result)) { - - ItemStack patternStack = message.getPatternStack(player, message.recipe); - - if (patternStack != null) { - - // if (tpi.putPattern(patternStack)) { - // return null; - // } - } - } - } - } - } - } - - return null; - } - } - - private IGrid getNetwork(AEBaseContainer container) { - if (container.getTarget() instanceof IActionHost) { - IActionHost ah = (IActionHost) container.getTarget(); - IGridNode gn = ah.getActionableNode(); - return gn.getGrid(); - } - return null; - } - - private ItemStack getPatternStack(EntityPlayer player, NBTTagCompound recipe) { - ItemStack[] recipeInputs = new ItemStack[RECIPE_LENGTH]; - NBTTagCompound currentStack; - for (int i = 0; i < recipeInputs.length; i++) { - currentStack = recipe.getCompoundTag(INPUT_KEY + i); - recipeInputs[i] = currentStack == null ? null : ItemStack.loadItemStackFromNBT(currentStack); - } - InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3); - for (int i = 0; i < RECIPE_LENGTH; i++) { - ic.setInventorySlotContents(i, recipeInputs[i]); - } - - ItemStack result = CraftingManager.getInstance().findMatchingRecipe(ic, player.worldObj); - if (result != null) { - ItemStack patternStack = null; - Optional maybePattern = AEApi.instance().definitions().items().encodedPattern().maybeStack(1); - if (maybePattern.isPresent()) { - patternStack = maybePattern.get(); - } - if (patternStack != null) { - final NBTTagCompound patternValue = new NBTTagCompound(); - final NBTTagList tagIn = new NBTTagList(); - for (ItemStack stack : recipeInputs) { - tagIn.appendTag(crateItemTag(stack)); - } - patternValue.setTag("in", tagIn); - patternValue.setTag("out", result.writeToNBT(new NBTTagCompound())); - patternValue.setBoolean("crafting", true); - patternValue.setBoolean("substitute", false); - - patternStack.setTagCompound(patternValue); - return patternStack; - } - } - - return null; - } - - private NBTTagCompound crateItemTag(ItemStack itemStack) { - NBTTagCompound tag = new NBTTagCompound(); - if (itemStack != null) { - itemStack.writeToNBT(tag); - } - return tag; - } -} diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketSlotStackChange.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketSlotStackChange.java index c0888f0..bc3da7b 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketSlotStackChange.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketSlotStackChange.java @@ -6,10 +6,12 @@ import java.util.List; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import com.github.vfyjxf.nee.utils.GuiUtils; import com.github.vfyjxf.nee.utils.ItemUtils; +import com.glodblock.github.common.item.ItemFluidPacket; +import codechicken.nei.recipe.StackInfo; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -52,7 +54,7 @@ public class PacketSlotStackChange implements IMessage { @Override public void toBytes(ByteBuf buf) { - ByteBufUtils.writeTag(buf, ItemUtils.writeItemStackToNBT(this.stack, new NBTTagCompound())); + ByteBufUtils.writeTag(buf, ItemUtils.writeItemStackToNBT(this.stack, this.stack.stackSize)); buf.writeInt(this.craftingSlots.size()); for (Integer craftingSlot : this.craftingSlots) { buf.writeInt(craftingSlot); @@ -66,6 +68,12 @@ public class PacketSlotStackChange implements IMessage { Container container = ctx.getServerHandler().playerEntity.openContainer; ItemStack nextStack = message.getStack(); if (nextStack != null) { + + if (GuiUtils.isFluidCraftPatternContainer(container) + && StackInfo.itemStackToNBT(nextStack).hasKey("gtFluidName")) { + nextStack = ItemFluidPacket.newStack(StackInfo.getFluid(nextStack)); + } + for (Integer craftingSlot : message.getCraftingSlots()) { Slot currentSlot = container.getSlot(craftingSlot); if (currentSlot != null) { diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketStackCountChange.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketStackCountChange.java index 0a4c839..f41a53b 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketStackCountChange.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketStackCountChange.java @@ -4,9 +4,14 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import com.github.vfyjxf.nee.utils.GuiUtils; +import com.glodblock.github.common.item.ItemFluidPacket; import appeng.container.AEBaseContainer; import appeng.container.implementations.ContainerPatternTerm; +import codechicken.nei.recipe.StackInfo; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -66,15 +71,19 @@ public class PacketStackCountChange implements IMessage { } Slot currentSlot = container.getSlot(message.getSlotIndex()); - for (int i = 0; i < Math.abs(message.getChangeCount()); i++) { - int currentStackSize = message.getChangeCount() > 0 ? currentSlot.getStack().stackSize + 1 - : currentSlot.getStack().stackSize - 1; - if (currentStackSize > 0) { - ItemStack nextStack = currentSlot.getStack().copy(); - nextStack.stackSize = currentStackSize; - currentSlot.putStack(nextStack); + + if (currentSlot.getHasStack()) { + ItemStack stack = currentSlot.getStack(); + + if (GuiUtils.isFluidCraftPatternContainer(container) + && StackInfo.itemStackToNBT(stack).hasKey("gtFluidName")) { + FluidStack fluid = StackInfo.getFluid(stack); + fluid.amount = Math.max(1, fluid.amount + message.getChangeCount()); + currentSlot.putStack(ItemFluidPacket.newStack(fluid)); } else { - break; + stack = stack.copy(); + stack.stackSize = Math.max(1, stack.stackSize + message.getChangeCount()); + currentSlot.putStack(stack); } } } diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigClient.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigClient.java index 15542a5..48b33ef 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigClient.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigClient.java @@ -3,8 +3,7 @@ package com.github.vfyjxf.nee.network.packet; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import com.github.vfyjxf.nee.nei.NEECraftingHelper; -import com.github.vfyjxf.nee.utils.GuiUtils; +import com.github.vfyjxf.nee.nei.NEECraftingPreviewHandler; import codechicken.nei.recipe.GuiRecipe; import cpw.mods.fml.common.FMLCommonHandler; @@ -22,30 +21,30 @@ import io.netty.buffer.ByteBuf; public class PacketValueConfigClient implements IMessage { private String name; - private String value; + private boolean value; public PacketValueConfigClient() {} - public PacketValueConfigClient(String name, String value) { + public PacketValueConfigClient(String name, boolean value) { this.name = name; this.value = value; } public PacketValueConfigClient(String name) { this.name = name; - this.value = ""; + this.value = false; } @Override public void fromBytes(ByteBuf buf) { this.name = ByteBufUtils.readUTF8String(buf); - this.value = ByteBufUtils.readUTF8String(buf); + this.value = buf.readBoolean(); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, this.name); - ByteBufUtils.writeUTF8String(buf, this.value); + buf.writeBoolean(this.value); } public static final class Handler implements IMessageHandler { @@ -60,15 +59,10 @@ public class PacketValueConfigClient implements IMessage { @SideOnly(Side.CLIENT) private void handMessage(PacketValueConfigClient message, MessageContext ctx) { - GuiScreen gui = Minecraft.getMinecraft().currentScreen; - if ("PatternInterface.check".equals(message.name)) { - if (gui instanceof GuiRecipe) { - GuiRecipe guiRecipe = (GuiRecipe) gui; - if (GuiUtils.isGuiCraftingTerm(guiRecipe.firstGui)) { - boolean value = Boolean.parseBoolean(message.value); - NEECraftingHelper.setIsPatternInterfaceExists(value); - } - } + final GuiScreen gui = Minecraft.getMinecraft().currentScreen; + + if ("PatternInterface.check".equals(message.name) && gui instanceof GuiRecipe) { + NEECraftingPreviewHandler.instance.setIsPatternInterfaceExists(message.value); } } } diff --git a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigServer.java b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigServer.java index ca99bfa..ffda5d8 100644 --- a/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigServer.java +++ b/src/main/java/com/github/vfyjxf/nee/network/packet/PacketValueConfigServer.java @@ -3,17 +3,13 @@ package com.github.vfyjxf.nee.network.packet; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; -import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal; -import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject; import com.github.vfyjxf.nee.block.tile.TilePatternInterface; import com.github.vfyjxf.nee.container.ContainerPatternInterface; -import com.github.vfyjxf.nee.network.NEENetworkHandler; +import com.github.vfyjxf.nee.utils.GuiUtils; import appeng.api.networking.IGrid; import appeng.api.networking.IGridNode; -import appeng.api.networking.security.IActionHost; -import appeng.container.AEBaseContainer; import appeng.container.slot.SlotRestrictedInput; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -75,44 +71,23 @@ public class PacketValueConfigServer implements IMessage { tile.updateCraftingList(); } } else if ("PatternInterface.check".equals(message.name)) { - if (container instanceof AEBaseContainer) { - IGrid grid = message.getNetwork((AEBaseContainer) container); - if (grid != null) { + final IGrid grid = GuiUtils.getGrid(container); - for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) { + if (grid != null) { - if (gridNode.getMachine() instanceof TilePatternInterface) { - NEENetworkHandler.getInstance() - .sendTo(new PacketValueConfigClient("PatternInterface.check", "true"), player); - return null; - } + for (IGridNode gridNode : grid.getMachines(TilePatternInterface.class)) { + if (gridNode.getMachine() instanceof TilePatternInterface) { + return new PacketValueConfigClient("PatternInterface.check", true); } - - NEENetworkHandler.getInstance() - .sendTo(new PacketValueConfigClient("PatternInterface.check", "false"), player); } + + return new PacketValueConfigClient("PatternInterface.check", false); } } return null; } + } - private IGrid getNetwork(AEBaseContainer container) { - if (container.getTarget() instanceof IActionHost) { - IActionHost ah = (IActionHost) container.getTarget(); - IGridNode gn = ah.getActionableNode(); - return gn.getGrid(); - } - return null; - } - - private IGrid getNetwork(ContainerWirelessCraftingTerminal container) { - - if (container.getTarget() instanceof WirelessTerminalGuiObject) { - return ((WirelessTerminalGuiObject) container.getTarget()).getTargetGrid(); - } - - return null; - } } diff --git a/src/main/java/com/github/vfyjxf/nee/proxy/ClientProxy.java b/src/main/java/com/github/vfyjxf/nee/proxy/ClientProxy.java index 86574f0..673e2a1 100644 --- a/src/main/java/com/github/vfyjxf/nee/proxy/ClientProxy.java +++ b/src/main/java/com/github/vfyjxf/nee/proxy/ClientProxy.java @@ -5,9 +5,11 @@ import net.minecraftforge.common.MinecraftForge; import com.github.vfyjxf.nee.NEECommands; import com.github.vfyjxf.nee.client.GuiEventHandler; -import com.github.vfyjxf.nee.client.NEEContainerDrawHandler; -import com.github.vfyjxf.nee.config.NEEConfig; -import com.github.vfyjxf.nee.nei.NEECraftingHelper; +import com.github.vfyjxf.nee.nei.NEECraftingPreviewHandler; +import com.github.vfyjxf.nee.nei.NEECraftingTerminalHandler; +import com.github.vfyjxf.nee.nei.NEEExtremeAutoCrafterHandler; +import com.github.vfyjxf.nee.nei.NEEKnowledgeInscriberHandler; +import com.github.vfyjxf.nee.nei.NEEPatternTerminalHandler; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -20,11 +22,10 @@ public class ClientProxy extends CommonProxy { ClientCommandHandler.instance.registerCommand(new NEECommands()); FMLCommonHandler.instance().bus().register(GuiEventHandler.instance); MinecraftForge.EVENT_BUS.register(GuiEventHandler.instance); - if (NEEConfig.noShift) { - MinecraftForge.EVENT_BUS.register(NEECraftingHelper.INSTANCE); - } - if (NEEConfig.drawHighlight) { - MinecraftForge.EVENT_BUS.register(NEEContainerDrawHandler.instance); - } + MinecraftForge.EVENT_BUS.register(NEECraftingTerminalHandler.instance); + MinecraftForge.EVENT_BUS.register(NEEPatternTerminalHandler.instance); + MinecraftForge.EVENT_BUS.register(NEEExtremeAutoCrafterHandler.instance); + MinecraftForge.EVENT_BUS.register(NEEKnowledgeInscriberHandler.instance); + MinecraftForge.EVENT_BUS.register(NEECraftingPreviewHandler.instance); } } diff --git a/src/main/java/com/github/vfyjxf/nee/utils/GuiUtils.java b/src/main/java/com/github/vfyjxf/nee/utils/GuiUtils.java index dd49977..3f42af6 100644 --- a/src/main/java/com/github/vfyjxf/nee/utils/GuiUtils.java +++ b/src/main/java/com/github/vfyjxf/nee/utils/GuiUtils.java @@ -1,63 +1,46 @@ package com.github.vfyjxf.nee.utils; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Predicate; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; +import net.minecraftforge.common.util.ForgeDirection; -import com.github.vfyjxf.nee.container.WCTContainerCraftingConfirm; import com.glodblock.github.client.gui.GuiFluidPatternTerminal; import com.glodblock.github.client.gui.GuiFluidPatternTerminalEx; import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal; import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx; -import appeng.client.gui.implementations.GuiCraftConfirm; -import appeng.client.gui.implementations.GuiCraftingTerm; +import appeng.api.networking.IGrid; +import appeng.api.networking.IGridHost; +import appeng.api.networking.IGridNode; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; import appeng.client.gui.implementations.GuiPatternTerm; import appeng.client.gui.implementations.GuiPatternTermEx; +import appeng.client.me.ItemRepo; +import appeng.container.AEBaseContainer; import appeng.container.implementations.ContainerPatternTerm; import appeng.container.implementations.ContainerPatternTermEx; import appeng.helpers.IContainerCraftingPacket; import cpw.mods.fml.common.Loader; +import cpw.mods.fml.relauncher.ReflectionHelper; +import cpw.mods.fml.relauncher.ReflectionHelper.UnableToFindFieldException; +import thaumicenergistics.common.container.ContainerPartArcaneCraftingTerminal; /** * @author vfyjxf */ public class GuiUtils { - private static final boolean isWirelessCraftingTerminalModLoaded = Loader.isModLoaded(ModIDs.WCT); private static final boolean isFluidCraftModloaded = Loader.isModLoaded(ModIDs.FC); - public static boolean isGuiWirelessCrafting(GuiScreen gui) { - if (!isWirelessCraftingTerminalModLoaded) return false; - return gui instanceof net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal; - } - - public static boolean isWirelessCraftingTermContainer(Container container) { - if (!isWirelessCraftingTerminalModLoaded) return false; - return container instanceof net.p455w0rd.wirelesscraftingterminal.common.container.ContainerWirelessCraftingTerminal; - } - - public static boolean isContainerWirelessCraftingConfirm(Container container) { - if (!isWirelessCraftingTerminalModLoaded) return false; - return container instanceof net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm; - } - - public static boolean isWirelessGuiCraftConfirm(GuiScreen gui) { - if (!isWirelessCraftingTerminalModLoaded) return false; - return gui instanceof net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm; - } - - public static boolean isWCTContainerCraftingConfirm(Container container) { - return container instanceof WCTContainerCraftingConfirm; - } - - public static boolean isWirelessTerminalGuiObject(Object guiObj) { - if (!isWirelessCraftingTerminalModLoaded) return false; - return guiObj instanceof net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject; - } - public static boolean isCraftingSlot(Slot slot) { if (slot == null) { return false; @@ -71,18 +54,14 @@ public class GuiUtils { return craftMatrix.equals(slot.inventory); } - public static boolean isPatternContainer(Container container) { - if (isFluidCraftModloaded) { - return container instanceof ContainerPatternTerm || container instanceof ContainerPatternTermEx - || container instanceof ContainerFluidPatternTerminal - || container instanceof ContainerFluidPatternTerminalEx; - } else { - return container instanceof ContainerPatternTerm || container instanceof ContainerPatternTermEx; - } + public static boolean isFluidCraftPatternContainer(Container container) { + return isFluidCraftModloaded && (container instanceof ContainerFluidPatternTerminal + || container instanceof ContainerFluidPatternTerminalEx); } - public static boolean isGuiCraftingTerm(GuiScreen guiScreen) { - return guiScreen instanceof GuiCraftingTerm || isGuiWirelessCrafting(guiScreen); + public static boolean isPatternContainer(Container container) { + return container instanceof ContainerPatternTerm || container instanceof ContainerPatternTermEx + || isFluidCraftPatternContainer(container); } public static boolean isFluidCraftPatternTermEx(GuiScreen guiScreen) { @@ -90,21 +69,92 @@ public class GuiUtils { } public static boolean isFluidCraftPatternTerm(GuiScreen guiScreen) { - return isFluidCraftModloaded - && (guiScreen instanceof GuiFluidPatternTerminal || guiScreen instanceof GuiFluidPatternTerminalEx); + return isFluidCraftModloaded && guiScreen instanceof GuiFluidPatternTerminal; } public static boolean isPatternTerm(GuiScreen guiScreen) { - if (isFluidCraftModloaded) { - return guiScreen instanceof GuiPatternTerm || guiScreen instanceof GuiPatternTermEx - || guiScreen instanceof GuiFluidPatternTerminal - || guiScreen instanceof GuiFluidPatternTerminalEx; - } else { - return guiScreen instanceof GuiPatternTerm || guiScreen instanceof GuiPatternTermEx; - } + return guiScreen instanceof GuiPatternTerm || guiScreen instanceof GuiPatternTermEx + || isFluidCraftModloaded && (guiScreen instanceof GuiFluidPatternTerminal + || guiScreen instanceof GuiFluidPatternTerminalEx); } - public static boolean isGuiCraftConfirm(GuiScreen gui) { - return gui instanceof GuiCraftConfirm || isWirelessGuiCraftConfirm(gui); + public static ItemRepo getItemRepo(GuiContainer termGui) { + Class clazz = termGui.getClass(); + ItemRepo repo = null; + + while (repo == null && clazz != null) { + try { + repo = (ItemRepo) ReflectionHelper.findField(clazz, "repo").get(termGui); + } catch (UnableToFindFieldException | IllegalAccessException e) { + clazz = clazz.getSuperclass(); + } + } + + return repo; } + + public static List getStorageStacks(GuiContainer termGui, Predicate predicate) { + final List storageStacks = new ArrayList<>(); + + if (termGui != null) { + final ItemRepo repo = GuiUtils.getItemRepo(termGui); + + if (repo != null) { + + try { + @SuppressWarnings("unchecked") + final IItemList list = (IItemList) ReflectionHelper + .findField(ItemRepo.class, "list").get(repo); + + for (IAEItemStack stack : list) { + if (predicate.test(stack)) { + storageStacks.add(stack.copy()); + } + } + + } catch (Exception e) {} + + try { + final IAEItemStack[] pins = (IAEItemStack[]) ReflectionHelper.findField(ItemRepo.class, "pins") + .get(repo); + + for (int i = 0; i < pins.length; i++) { + final IAEItemStack stack = pins[i]; + if (stack != null && predicate.test(stack)) { + storageStacks.add(stack.copy()); + } + } + + } catch (Exception e) {} + + } + } + + return storageStacks; + } + + public static IGrid getGrid(Container container) { + + if (Loader.isModLoaded(ModIDs.ThE) && container instanceof ContainerPartArcaneCraftingTerminal act) { + final IGridNode gridNode = act.terminal.getGridNode(ForgeDirection.UNKNOWN); + + if (gridNode == null) { + return null; + } + + return gridNode.getGrid(); + } else if (container instanceof AEBaseContainer baseContainer + && baseContainer.getTarget() instanceof IGridHost gridHost) { + final IGridNode gridNode = gridHost.getGridNode(ForgeDirection.UNKNOWN); + + if (gridNode == null) { + return null; + } + + return gridNode.getGrid(); + } + + return null; + } + } diff --git a/src/main/java/com/github/vfyjxf/nee/utils/IngredientTracker.java b/src/main/java/com/github/vfyjxf/nee/utils/IngredientTracker.java index 433cd3f..ea2dff5 100644 --- a/src/main/java/com/github/vfyjxf/nee/utils/IngredientTracker.java +++ b/src/main/java/com/github/vfyjxf/nee/utils/IngredientTracker.java @@ -1,8 +1,5 @@ package com.github.vfyjxf.nee.utils; -import static com.github.vfyjxf.nee.nei.NEECraftingHelper.noPreview; -import static com.github.vfyjxf.nee.utils.GuiUtils.isFluidCraftPatternTerm; - import java.util.ArrayList; import java.util.List; @@ -10,22 +7,12 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal; import com.github.vfyjxf.nee.config.NEEConfig; -import com.github.vfyjxf.nee.network.NEENetworkHandler; -import com.github.vfyjxf.nee.network.packet.PacketCraftingRequest; -import com.glodblock.github.client.gui.base.FCGuiMonitor; import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IItemList; -import appeng.client.gui.implementations.GuiMEMonitorable; -import appeng.client.me.ItemRepo; -import appeng.util.item.AEItemStack; import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.IRecipeHandler; -import cpw.mods.fml.relauncher.ReflectionHelper; public class IngredientTracker { @@ -35,20 +22,16 @@ public class IngredientTracker { private final int recipeIndex; private int currentIndex = 0; - /** - * For {@link com.github.vfyjxf.nee.nei.NEECraftingHelper} - */ public IngredientTracker(GuiContainer termGui, IRecipeHandler recipe, int recipeIndex) { this.termGui = termGui; this.recipeIndex = recipeIndex; for (PositionedStack requiredIngredient : recipe.getIngredientStacks(recipeIndex)) { - Ingredient ingredient = new Ingredient(requiredIngredient); - ingredients.add(ingredient); + this.ingredients.add(new Ingredient(requiredIngredient)); } for (Ingredient ingredient : this.ingredients) { - for (IAEItemStack stack : getCraftableStacks()) { + for (IAEItemStack stack : GuiUtils.getStorageStacks(this.termGui, IAEItemStack::isCraftable)) { if (ingredient.getIngredient().contains(stack.getItemStack())) { ingredient.setCraftableIngredient(stack.getItemStack()); } @@ -58,94 +41,8 @@ public class IngredientTracker { this.calculateIngredients(); } - /** - * For {@link com.github.vfyjxf.nee.client.NEEContainerDrawHandler} - */ - public IngredientTracker(GuiRecipe guiRecipe, IRecipeHandler recipe, int recipeIndex) { - this.termGui = guiRecipe.firstGui; - this.recipeIndex = recipeIndex; - getCraftableStacks(); - - for (PositionedStack requiredIngredient : recipe.getIngredientStacks(recipeIndex)) { - Ingredient ingredient = new Ingredient(requiredIngredient); - ingredients.add(ingredient); - } - - for (Ingredient ingredient : this.ingredients) { - for (IAEItemStack stack : getCraftableStacks()) { - if (ingredient.getIngredient().contains(stack.getItemStack())) { - ingredient.setCraftableIngredient(stack.getItemStack()); - } - } - } - } - - private ItemRepo getRepo() throws IllegalAccessException { - if (isFluidCraftPatternTerm(termGui)) { - return (ItemRepo) ReflectionHelper.findField(FCGuiMonitor.class, "repo").get(termGui); - } else { - return (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo").get(termGui); - } - } - - @SuppressWarnings("unchecked") - private List getCraftableStacks() { - List craftableStacks = new ArrayList<>(); - if (termGui != null) { - IItemList list = null; - try { - if (!GuiUtils.isGuiWirelessCrafting(termGui)) { - ItemRepo repo = getRepo(); - list = (IItemList) ReflectionHelper.findField(ItemRepo.class, "list").get(repo); - } else { - // wireless crafting terminal support - ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo") - .get(termGui); - list = (IItemList) ReflectionHelper.findField(ItemRepo.class, "list").get(repo); - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - if (list != null) { - for (IAEItemStack stack : list) { - if (stack.isCraftable()) { - craftableStacks.add(stack.copy()); - } - } - } - } - return craftableStacks; - } - - @SuppressWarnings("unchecked") - private List getStorageStacks() { - List list = new ArrayList<>(); - if (termGui != null) { - try { - if (!GuiUtils.isGuiWirelessCrafting(termGui)) { - ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiMEMonitorable.class, "repo").get(termGui); - for (IAEItemStack stack : (IItemList) ReflectionHelper - .findField(ItemRepo.class, "list").get(repo)) { - list.add(stack.copy()); - } - } else { - // wireless crafting terminal support - ItemRepo repo = (ItemRepo) ReflectionHelper.findField(GuiWirelessCraftingTerminal.class, "repo") - .get(termGui); - for (IAEItemStack stack : (IItemList) ReflectionHelper - .findField(ItemRepo.class, "list").get(repo)) { - list.add(stack.copy()); - } - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - } - return list; - } - public List getIngredients() { - return ingredients; + return this.ingredients; } public List getRequireToCraftStacks() { @@ -173,27 +70,23 @@ public class IngredientTracker { } public List getRequireStacks() { - return requireStacks; + return this.requireStacks; } public boolean hasNext() { - return currentIndex < getRequireStacks().size(); + return this.currentIndex < getRequireStacks().size(); } - public void requestNextIngredient() { - IAEItemStack stack = AEItemStack.create(this.getRequiredStack(currentIndex)); - if (stack != null) { - NEENetworkHandler.getInstance().sendToServer(new PacketCraftingRequest(stack, noPreview)); - } - currentIndex++; + public ItemStack getNextIngredient() { + return getRequiredStack(this.currentIndex++); } public ItemStack getRequiredStack(int index) { - return this.getRequireStacks().get(index); + return getRequireStacks().get(index); } public int getRecipeIndex() { - return recipeIndex; + return this.recipeIndex; } public void addAvailableStack(ItemStack stack) { @@ -229,29 +122,28 @@ public class IngredientTracker { } } - @SuppressWarnings("unchecked") public void calculateIngredients() { + final List stacks = GuiUtils + .getStorageStacks(this.termGui, stack -> NEEConfig.matchOtherItems || stack.isCraftable()); - List stacks = NEEConfig.matchOtherItems ? getStorageStacks() : getCraftableStacks(); for (Ingredient ingredient : this.ingredients) { + ingredient.setCurrentCount(0); for (IAEItemStack stack : stacks) { - if (ingredient.getIngredient().contains(stack.getItemStack())) { - if (stack.getStackSize() > 0) { - ingredient.addCount(stack.getStackSize()); - if (ingredient.requiresToCraft()) { - stack.setStackSize(0); - } else { - stack.setStackSize(stack.getStackSize() - ingredient.getRequireCount()); - } + if (stack.getStackSize() > 0 && ingredient.getIngredient().contains(stack.getItemStack())) { + ingredient.addCount(stack.getStackSize()); + if (ingredient.requiresToCraft()) { + stack.setStackSize(0); + } else { + stack.setStackSize(stack.getStackSize() - ingredient.getRequireCount()); } } } } - List inventoryStacks = new ArrayList<>(); + final List inventoryStacks = new ArrayList<>(); for (Slot slot : (List) termGui.inventorySlots.inventorySlots) { - boolean canGetStack = slot != null && slot.getHasStack() + final boolean canGetStack = slot != null && slot.getHasStack() && slot.getStack().stackSize > 0 && slot.isItemValid(slot.getStack()) && slot.canTakeStack(Minecraft.getMinecraft().thePlayer); diff --git a/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java b/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java index 7aad6c3..751438c 100644 --- a/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java +++ b/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java @@ -19,7 +19,7 @@ import com.github.vfyjxf.nee.processor.RecipeProcessor; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; -import codechicken.nei.PositionedStack; +import codechicken.nei.NEIServerUtils; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; @@ -183,14 +183,11 @@ public final class ItemUtils { return null; } - public static int getIngredientIndex(ItemStack stack, PositionedStack positionedStack) { - ItemStack stackInput = stack.copy(); - stackInput.stackSize = 1; - for (int i = 0; i < positionedStack.items.length; i++) { - ItemStack currentStack = positionedStack.items[i].copy(); - currentStack.stackSize = 1; - if (ItemStack.areItemStacksEqual(currentStack, stackInput)) { - return i; + public static int getPermutationIndex(ItemStack stack, List items) { + + for (int index = 0; index < items.size(); index++) { + if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(items.get(index), stack)) { + return index; } } return -1; @@ -212,9 +209,9 @@ public final class ItemUtils { + "}"; } - public static NBTTagCompound writeItemStackToNBT(ItemStack itemStack, NBTTagCompound tag) { - itemStack.writeToNBT(tag); - tag.setInteger("Count", itemStack.stackSize); + public static NBTTagCompound writeItemStackToNBT(ItemStack itemStack, int stackSize) { + NBTTagCompound tag = itemStack.writeToNBT(new NBTTagCompound()); + tag.setInteger("Count", stackSize); return tag; } diff --git a/src/main/java/com/github/vfyjxf/nee/utils/ModIDs.java b/src/main/java/com/github/vfyjxf/nee/utils/ModIDs.java index 3aa6eda..0472bc5 100644 --- a/src/main/java/com/github/vfyjxf/nee/utils/ModIDs.java +++ b/src/main/java/com/github/vfyjxf/nee/utils/ModIDs.java @@ -4,4 +4,5 @@ public class ModIDs { public static final String WCT = "ae2wct"; public static final String FC = "ae2fc"; + public static final String ThE = "thaumicenergistics"; } diff --git a/src/main/resources/assets/neenergistics/lang/en_US.lang b/src/main/resources/assets/neenergistics/lang/en_US.lang index 3297f90..74abf96 100644 --- a/src/main/resources/assets/neenergistics/lang/en_US.lang +++ b/src/main/resources/assets/neenergistics/lang/en_US.lang @@ -1,7 +1,10 @@ -neenergistics.gui.tooltip.helper.crafting.text1=click to request missing items -neenergistics.gui.tooltip.helper.crafting.text2=click to request the recipe result. -neenergistics.gui.tooltip.missing=Missing Items -neenergistics.gui.tooltip.helper.pattern=Autocrafting available +neenergistics.gui.tooltip.crafting.preview=Request missing items +neenergistics.gui.tooltip.crafting.preview.result=Request the recipe result +neenergistics.gui.tooltip.crafting.nopreview=Request missing items (No Preview) +neenergistics.gui.tooltip.crafting.nopreview.result=Request the recipe result (No Preview) + +neenergistics.gui.tooltip.ingredient.permutation=Change Item +neenergistics.gui.tooltip.ingredient.count=Change Count nei.options.keys.nee=NotEnoughEnergistics nei.options.keys.nee.count=Change Item Count diff --git a/src/main/resources/assets/neenergistics/lang/ru_RU.lang b/src/main/resources/assets/neenergistics/lang/ru_RU.lang index 44add06..f32e7dd 100644 --- a/src/main/resources/assets/neenergistics/lang/ru_RU.lang +++ b/src/main/resources/assets/neenergistics/lang/ru_RU.lang @@ -1,6 +1,6 @@ -neenergistics.gui.tooltip.helper.crafting.text1=Нажмите, чтобы запоросить отсутсвующие предметы -neenergistics.gui.tooltip.missing=Отсутствуют требуемые предметы -neenergistics.gui.tooltip.helper.pattern=Автокрафт доступен +neenergistics.gui.tooltip.crafting.preview=Запоросить отсутсвующие предметы +neenergistics.gui.tooltip.crafting.nopreview=Запоросить отсутсвующие предметы (без превью) + nei.options.keys.nee=NotEnoughEnergistics nei.options.keys.nee.count=Изменить кол-во nei.options.keys.nee.ingredient=Выбрать ингредиент diff --git a/src/main/resources/assets/neenergistics/lang/zh_CN.lang b/src/main/resources/assets/neenergistics/lang/zh_CN.lang index d9e307e..cc773c6 100644 --- a/src/main/resources/assets/neenergistics/lang/zh_CN.lang +++ b/src/main/resources/assets/neenergistics/lang/zh_CN.lang @@ -1,8 +1,3 @@ -neenergistics.gui.tooltip.helper.crafting.text1=点击以请求缺失物品 -neenergistics.gui.tooltip.helper.crafting.text2=点击以请求配方成品 -neenergistics.gui.tooltip.missing=缺失物品 -neenergistics.gui.tooltip.helper.pattern=自动合成已启用 - nei.options.keys.nee=NotEnoughEnergistics nei.options.keys.nee.count=修改物品数量 nei.options.keys.nee.ingredient=选择材料 @@ -16,6 +11,4 @@ gui.neenergistics.button.name.disabled=关闭 gui.neenergistics.button.name.whitelist=白名单 gui.neenergistics.button.title.remove=删除 gui.neenergistics.button.tooltip.remove=删除并取消当前配方 - -tile.neenergistics.pattern_interface.name=样板接口 - +tile.neenergistics.pattern_interface.name=样板接口 \ No newline at end of file diff --git a/src/main/resources/assets/neenergistics/textures/gui/states.png b/src/main/resources/assets/neenergistics/textures/gui/states.png index 355481ac9c616a0823b73c142c7c8778eb616773..2d3d9832a6831f71f0cfe2032f59e7cd2c4f04fc 100644 GIT binary patch delta 1192 zcmV;Z1Xugk35yGmFn<69XF*Lt006O%3;baP00009a7bBm000ia000ia0czHX2><{E zAW1|)RCr$P-7$z2M;Hh2HCWi4Tw}0F70bhvX)Ht`wnDHBf{h>n3%jICXCpzdFeQ(wh9UsNv84m( z3wU?upVSF-Lw~=twA5U@c(FNn@L(E>01U^d0F>d+-9V}A1iEUWj}d`?`0!zS*Cs^( zhGXnkfE@5z>)-ub{0b0`A3xrlK7BgPLpSu?<>v0)yM9H08L1Y4TKGd= z=g(XKVz<9^=~8p}@Zq#Bm7!l)SZHUP78e&40GOe%Uw;8|z`NlO-E}F#fAi+eG>_2d z5uwi`d-Uj08o+F&0+0h=>I-|VFyxkhety2WdiCnW&+JBg>iLU~eyL}FSSse1K!0|-?(4j-=+KU%2nx{{nrg;`&&x9U^W9%6~ zh_KgM{eQmBAd0}PTesTPrtVIkNBd`B0ID58E&Mgz!$8pqtgWr3xv<0V?K*${{6_vc zZ#$d@1YRk>DcCN70r*#U?=tZ5`fs>=`LeD72I7qeu^ajmCr)g6HTeGh`-%Vz#MB|o z!L9|j7W&Y4CO{E@VVD@eXg|K}&G=`%zDh=1`XL}6H2S!wp|+n3g* z+94nX0A?!{fY)i^mp}NvT{X>5pZ?y=&CNCW9KeAC2gV9O8T>d56yN(x3INQ`r~pjU z!he_HpZoUxw1Y+tP~Gsyx^}I-J*&0-V?`j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