Allow View Cell to be toggled on or off (#731)

Co-authored-by: boubou19 <[email protected]>
This commit is contained in:
Mayaandboubou19 authored and GitHub committed 2025-05-25 19:54:13 +00:00
1 parent 4a3eb0b8f5
commit d3a55ddfb9
6 files changed
+84 -3

No files matched your search

@@ -49,6 +49,7 @@ import appeng.container.implementations.ContainerMEMonitorable;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.CommonHelper;
@@ -63,6 +64,7 @@ import appeng.helpers.WirelessTerminalGuiObject;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.modules.NEI;
import appeng.items.storage.ItemViewCell;
import appeng.parts.reporting.AbstractPartTerminal;
import appeng.tile.misc.TileSecurity;
import appeng.util.IConfigManagerHost;
@@ -401,9 +403,34 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
searchField.mouseClicked(xCoord, yCoord, btn);
if (handleViewCellClick(xCoord, yCoord, btn)) return;
super.mouseClicked(xCoord, yCoord, btn);
}
private boolean handleViewCellClick(final int xCoord, final int yCoord, final int btn) {
if (this.viewCell && monitorableContainer.canAccessViewCells && btn == 1) {
Slot slot = getSlot(xCoord, yCoord);
if (slot instanceof SlotRestrictedInput cvs) {
// if it has an item
if (!cvs.getHasStack()) return false;
// if its a view cell
if (!(cvs.getStack().getItem() instanceof ItemViewCell)) return false;
// update the view cell
try {
NetworkHandler.instance.sendToServer(
new PacketValueConfig("Terminal.UpdateViewCell", Integer.toString(cvs.getSlotIndex())));
} catch (IOException e) {
AELog.debug(e);
}
// eat the right-click input if a view cell was successfully toggled
return true;
}
}
return false;
}
@Override
public void onGuiClosed() {
super.onGuiClosed();