mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
Hide P2P outputs from interface terminal (#241)
Co-authored-by: boubou19 <miisterunknown@gmail.com>
This commit is contained in:
1 parent
8b4ab1ba61
commit
8a37e085c1
3 files changed
+31
-60
No files matched your search
@@ -2,6 +2,7 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
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.entity.player.InventoryPlayer;
|
||||
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.Settings;
|
||||
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 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
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 class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
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 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
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 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
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 class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
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;
|
||||
|
||||
@@ -12,6 +12,7 @@ import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRena
|
||||
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.inventory.Container;
|
||||
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.TerminalStyle;
|
||||
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 class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
|
||||
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 class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
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 class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
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 class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
// 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) {
|
||||
|
||||
Reference in new issue
Block a user