From 8a37e085c103a4f0102fa71de42d14bf8d18d3d4 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:26:00 +0100 Subject: [PATCH] Hide P2P outputs from interface terminal (#241) Co-authored-by: boubou19 --- dependencies.gradle | 9 ++-- .../client/gui/GuiInterfaceWireless.java | 36 ++++++--------- .../github/client/gui/GuiLevelTerminal.java | 46 +++++-------------- 3 files changed, 31 insertions(+), 60 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 330f2150b..6eac53026 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -35,19 +35,22 @@ */ dependencies { api('com.github.GTNewHorizons:NotEnoughItems:2.6.45-GTNH:dev') - api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-475-GTNH:dev') + api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-476-GTNH:dev') api('curse.maven:cofh-core-69162:2388751') api('com.github.GTNewHorizons:waila:1.8.2:dev') - implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") + implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") { + exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial' + } compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.20:dev") { transitive = false } compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev') compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false } compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.17:dev') compileOnly('com.github.GTNewHorizons:EnderIO:2.8.22:dev') - compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.68:dev') { + compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.69:dev') { exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework' + exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial' } compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') diff --git a/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java b/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java index fe726be03..65ff62eb2 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiInterfaceWireless.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; @@ -19,7 +20,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -43,7 +43,6 @@ import appeng.api.config.TerminalStyle; import appeng.api.config.YesNo; import appeng.api.util.DimensionalCoord; -import appeng.api.util.WorldCoord; import appeng.client.gui.IInterfaceTerminalPostUpdate; import appeng.client.gui.widgets.GuiImgButton; import appeng.client.gui.widgets.GuiScrollbar; @@ -846,7 +845,8 @@ private void parsePacketCmd(PacketInterfaceTerminalUpdate.PacketEntry cmd) { addCmd.name, addCmd.rows, addCmd.rowSize, - addCmd.online).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side) + addCmd.online, + addCmd.p2pOutput).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side) .setIcons(addCmd.selfRep, addCmd.dispRep).setItems(addCmd.items); masterList.addEntry(entry); } else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRemove) { @@ -1148,6 +1148,8 @@ public void refreshVisible() { String output = GuiInterfaceWireless.this.searchFieldOutputs.getText().toLowerCase(); for (InterfaceWirelessEntry entry : entries) { + if (!entry.online || entry.p2pOutput) continue; + var moleAss = AEApi.instance().definitions().blocks().molecularAssembler().maybeStack(1); entry.dispY = -9999; if (onlyMolecularAssemblers @@ -1238,13 +1240,14 @@ private class InterfaceWirelessEntry { int guiHeight; int dispY = -9999; boolean online; + boolean p2pOutput; private Boolean[] brokenRecipes; int numItems = 0; /** Should recipe be filtered out/grayed out? */ boolean[] filteredRecipes; private int hoveredSlotIdx = -1; - InterfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online) { + InterfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online, boolean p2pOutput) { this.id = id; if (StatCollector.canTranslate(name)) { this.dispName = StatCollector.translateToLocal(name); @@ -1260,6 +1263,7 @@ private class InterfaceWirelessEntry { this.rows = rows; this.rowSize = rowSize; this.online = online; + this.p2pOutput = p2pOutput; this.optionsButton = new GuiFCImgButton(2, 0, "HIGHLIGHT", "YES"); this.optionsButton.setHalfSize(true); this.renameButton = new GuiFCImgButton(2, 0, "EDIT", "YES"); @@ -1378,25 +1382,11 @@ public boolean mouseClicked(int mouseX, int mouseY, int btn) { blockPos.getDimension(), ForgeDirection.getOrientation(side))); } else { - /* View in world */ - WorldCoord blockPos2 = new WorldCoord( - (int) mc.thePlayer.posX, - (int) mc.thePlayer.posY, - (int) mc.thePlayer.posZ); - if (mc.theWorld.provider.dimensionId != dim) { - mc.thePlayer.addChatMessage( - new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim)); - } else { - BlockPosHighlighter.highlightBlock( - blockPos, - System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2)); - mc.thePlayer.addChatMessage( - new ChatComponentTranslation( - PlayerMessages.InterfaceHighlighted.getName(), - blockPos.x, - blockPos.y, - blockPos.z)); - } + BlockPosHighlighter.highlightBlocks( + mc.thePlayer, + Collections.singletonList(blockPos), + PlayerMessages.InterfaceHighlighted.getName(), + PlayerMessages.InterfaceInOtherDim.getName()); mc.thePlayer.closeScreen(); } return true; diff --git a/src/main/java/com/glodblock/github/client/gui/GuiLevelTerminal.java b/src/main/java/com/glodblock/github/client/gui/GuiLevelTerminal.java index 452759eef..f7ea91f56 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiLevelTerminal.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiLevelTerminal.java @@ -12,6 +12,7 @@ import java.text.NumberFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; @@ -34,7 +35,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; @@ -65,7 +65,6 @@ import appeng.api.config.YesNo; import appeng.api.storage.ITerminalHost; import appeng.api.storage.data.IAEItemStack; -import appeng.api.util.WorldCoord; import appeng.client.gui.IGuiTooltipHandler; import appeng.client.gui.widgets.GuiImgButton; import appeng.client.gui.widgets.GuiScrollbar; @@ -1327,8 +1326,6 @@ public AppEngInternalInventory getInventory() { } public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) { - final EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (!section.visible || mouseButton < 0 || mouseButton > 2) { return false; } @@ -1343,7 +1340,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) { dim, ForgeDirection.getOrientation(side), ""); - if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(player)) { + if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(mc.thePlayer)) { FluidCraft.proxy.netHandler.sendToServer( new CPacketLevelTerminalCommands( Action.EDIT, @@ -1361,23 +1358,12 @@ public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) { blockPos.getDimension(), blockPos.getSide())); } else { - /* View in world */ - WorldCoord blockPos2 = new WorldCoord((int) player.posX, (int) player.posY, (int) player.posZ); - if (mc.theWorld.provider.dimensionId != dim) { - player.addChatMessage( - new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim)); - } else { - BlockPosHighlighter.highlightBlock( - blockPos, - System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2)); - player.addChatMessage( - new ChatComponentTranslation( - PlayerMessages.InterfaceHighlighted.getName(), - blockPos.x, - blockPos.y, - blockPos.z)); - } - player.closeScreen(); + BlockPosHighlighter.highlightBlocks( + mc.thePlayer, + Collections.singletonList(blockPos), + PlayerMessages.LevelEmitterHighlighted.getName(), + PlayerMessages.LevelEmitterInAnotherDim.getName()); + mc.thePlayer.closeScreen(); } return true; } @@ -1393,25 +1379,17 @@ public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) { // send packet to server, request an update InventoryAction action = switch (mouseButton) { - case 0 -> { - // pickup / set-down. - yield null; - } - case 1 -> { - yield null; - } + case 0 -> null; // pickup / set-down. + case 1 -> null; case 2 -> { // creative dupe: - if (player.capabilities.isCreativeMode) { + if (mc.thePlayer.capabilities.isCreativeMode) { yield InventoryAction.CREATIVE_DUPLICATE; } else { yield InventoryAction.AUTO_CRAFT; } } - default -> { - // drop item: - yield null; - } + default -> null;// drop item: }; if (action != null) {