Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce interface terminal TPS impact + break some backends + new gui #394

Merged
merged 22 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ac5832f
api/features: Move iface term functionality to API
firenoo Sep 11, 2023
ec392c1
me/cache: Add indication of booting/nonbooting to event
firenoo Sep 11, 2023
203c64c
appeng/core/sync/packets: Add PacketIfaceTermUpdate.java
firenoo Sep 12, 2023
a89f634
appeng/helpers: Use new iface terminal API
firenoo Sep 15, 2023
6597d85
appeng/container/implementations: Optimize iface terminal
firenoo Sep 15, 2023
247c189
appeng/client/render/AppEngRenderItem: Don't disable depth test
firenoo Sep 18, 2023
8bd7c66
appeng/client/gui/widgets: GuiImgButton.java: Add extra options button
firenoo Sep 21, 2023
893e7a6
appeng/client/gui: AEBaseGui.java: bind texture w/ ResourceLocation
firenoo Sep 21, 2023
ff006eb
appeng/client/gui/widgets: GuiScrollbar.java: Add visibility flag
firenoo Sep 27, 2023
6815d91
appeng/client/gui: Add IGuiTooltipHandler
firenoo Sep 24, 2023
1157a4f
appeng/client/gui/implementations: New Interface Terminal GUI
firenoo Sep 27, 2023
1e51d19
Add interface compatibility to use in `ae2fc` (#404)
Laiff Oct 14, 2023
0f3a7eb
Add interface compatibility to use in `ae2fc` and direction tracking …
Laiff Oct 14, 2023
3d3af96
Fix rendering inside `InterfaceTerminal` AEStack should be correctly set
Laiff Oct 15, 2023
38ceda9
Fix `zLevel` in `TranslatedRenderItem` for durability bar
Laiff Oct 15, 2023
c493a4f
Fix `TranslatedRenderItem` integrate `POST_HOOKS` to support DuraDisplay
Laiff Oct 15, 2023
0a366d6
Fix buffer read write inconsistency
Laiff Oct 20, 2023
ef03195
Fix `zIndexes` for compatability with `DuraDisplay`
Laiff Oct 22, 2023
eb78532
Use `IInterfaceViewable` to decide crafting location
Laiff Oct 22, 2023
7fe4981
Fix tooltip zIndex
Laiff Oct 23, 2023
56629f4
Replace `ForgeDirection` serialization with `byte`
Laiff Oct 23, 2023
f35c5af
Code cleanup after review
Laiff Oct 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/java/appeng/client/gui/IInterfaceTerminalPostUpdate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package appeng.client.gui;

import java.util.List;

import appeng.core.sync.packets.PacketIfaceTermUpdate.PacketEntry;

public interface IInterfaceTerminalPostUpdate {

/**
* Interface to handle updates inside interface terminal
*
* @param updates List of updates
* @param statusFlags status bitflags
*/
void postUpdate(List<PacketEntry> updates, int statusFlags);
Laiff marked this conversation as resolved.
Show resolved Hide resolved
}
firenoo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import appeng.api.util.WorldCoord;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.IGuiTooltipHandler;
import appeng.client.gui.IInterfaceTerminalPostUpdate;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.IDropToFillTextField;
Expand Down Expand Up @@ -89,7 +90,8 @@
*
* @author firenoo
*/
public class GuiInterfaceTerminal extends AEBaseGui implements IDropToFillTextField, IGuiTooltipHandler {
public class GuiInterfaceTerminal extends AEBaseGui
implements IDropToFillTextField, IGuiTooltipHandler, IInterfaceTerminalPostUpdate {

public static final int HEADER_HEIGHT = 52;
public static final int INV_HEIGHT = 98;
Expand Down Expand Up @@ -752,6 +754,7 @@ private boolean handleTab() {
return false;
}

@Override
public void postUpdate(List<PacketEntry> updates, int statusFlags) {
if ((statusFlags & PacketIfaceTermUpdate.CLEAR_ALL_BIT) == PacketIfaceTermUpdate.CLEAR_ALL_BIT) {
/* Should clear all client entries. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import appeng.core.sync.packets.PacketIfaceTermUpdate;
import appeng.helpers.InventoryAction;
import appeng.items.misc.ItemEncodedPattern;
import appeng.parts.AEBasePart;
import appeng.parts.reporting.PartInterfaceTerminal;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
Expand Down Expand Up @@ -305,7 +306,8 @@ private PacketIfaceTermUpdate updateList() {
/* Add a new entry */
if (update == null) update = new PacketIfaceTermUpdate();
InvTracker entry = new InvTracker(nextId++, machine, node.isActive());
update.addNewEntry(entry.id, entry.name, entry.online).setLoc(entry.x, entry.y, entry.z, entry.dim)
update.addNewEntry(entry.id, entry.name, entry.online)
.setLoc(entry.x, entry.y, entry.z, entry.dim, entry.side.ordinal())
.setItems(entry.rows, entry.rowSize, entry.invNbt)
.setReps(machine.getSelfRep(), machine.getDisplayRep());
tracked.put(machine, entry);
Expand Down Expand Up @@ -355,6 +357,7 @@ private static class InvTracker {
private final int y;
private final int z;
private final int dim;
private final ForgeDirection side;
private boolean online;
private NBTTagList invNbt;

Expand All @@ -370,6 +373,7 @@ private static class InvTracker {
this.y = location.y;
this.z = location.z;
this.dim = location.getDimension();
this.side = machine instanceof AEBasePart hasSide ? hasSide.getSide() : ForgeDirection.UNKNOWN;
this.online = online;
this.invNbt = new NBTTagList();
updateNBT();
Expand Down Expand Up @@ -409,16 +413,4 @@ private void updateNBT() {
}
}
}
//
// private static class PatternInvSlot extends WrapperInvSlot {
//
// public PatternInvSlot(final IInventory inv) {
// super(inv);
// }
//
// @Override
// public boolean isItemValid(final ItemStack itemstack) {
// return itemstack != null && itemstack.getItem() instanceof ItemEncodedPattern;
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants.NBT;

import appeng.client.gui.implementations.GuiInterfaceTerminal;
import appeng.client.gui.IInterfaceTerminalPostUpdate;
import appeng.core.AELog;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
Expand Down Expand Up @@ -103,7 +103,7 @@ public void setDisconnect() {

/**
* Adds a new entry. Fill out the rest of the command using the {@link PacketAdd#setItems(int, int, NBTTagList)} and
* {@link PacketAdd#setLoc(int, int, int, int)}.
* {@link PacketAdd#setLoc(int, int, int, int, int)}.
*
* @return the packet, which needs to have information filled out.
*/
Expand Down Expand Up @@ -143,8 +143,8 @@ public PacketOverwrite addOverwriteEntry(long id) {
public void clientPacketData(final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player) {
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;

if (gs instanceof GuiInterfaceTerminal) {
((GuiInterfaceTerminal) gs).postUpdate(this.commands, this.statusFlags);
if (gs instanceof IInterfaceTerminalPostUpdate hasPostUpdate) {
hasPostUpdate.postUpdate(this.commands, this.statusFlags);
}
}

Expand Down Expand Up @@ -198,7 +198,7 @@ protected PacketEntry(ByteBuf buf) throws IOException {
public static class PacketAdd extends PacketEntry {

public String name;
public int x, y, z, dim;
public int x, y, z, dim, side;
public int rows, rowSize;
public boolean online;
public ItemStack selfRep, dispRep;
Expand All @@ -214,11 +214,12 @@ public static class PacketAdd extends PacketEntry {
super(buf);
}

public PacketAdd setLoc(int x, int y, int z, int dim) {
public PacketAdd setLoc(int x, int y, int z, int dim, int side) {
this.x = x;
this.y = y;
this.z = z;
this.dim = dim;
this.side = side;
return this;
}

Expand Down Expand Up @@ -252,6 +253,7 @@ protected void write(ByteBuf buf) throws IOException {
buf.writeInt(y);
buf.writeInt(z);
buf.writeInt(dim);
buf.writeInt(side);
Laiff marked this conversation as resolved.
Show resolved Hide resolved
buf.writeInt(rows);
buf.writeInt(rowSize);

Expand Down Expand Up @@ -284,6 +286,7 @@ protected void read(ByteBuf buf) throws IOException {
this.y = buf.readInt();
this.z = buf.readInt();
this.dim = buf.readInt();
this.side = buf.readInt();
this.rows = buf.readInt();
this.rowSize = buf.readInt();
int payloadSize = buf.readInt();
Expand Down