more fixes yay

This commit is contained in:
PrototypeTrousers
2023-02-09 13:02:55 -03:00
parent ecb697ab11
commit 4039188712
3 changed files with 24 additions and 9 deletions
@@ -84,7 +84,7 @@ public abstract class AEBaseContainer extends Container {
private final HashSet<Integer> locked = new HashSet<>();
private final TileEntity tileEntity;
private final IPart part;
private final IGuiItemObject obj;
protected final IGuiItemObject obj;
private final HashMap<Integer, SyncData> syncData = new HashMap<>();
private boolean isContainerValid = true;
private String customName;
@@ -53,11 +53,11 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
protected AppEngInternalInventory upgrades;
protected SlotRestrictedInput magnetSlot;
public ContainerMEPortableCell(InventoryPlayer ip, WirelessTerminalGuiObject monitorable, boolean bindInventory) {
super(ip, monitorable, bindInventory);
if (monitorable != null) {
final int slotIndex = ((IInventorySlotAware) monitorable).getInventorySlot();
if (!((IInventorySlotAware) monitorable).isBaubleSlot()) {
public ContainerMEPortableCell(InventoryPlayer ip, WirelessTerminalGuiObject guiObject, boolean bindInventory) {
super(ip, guiObject, guiObject, bindInventory);
if (guiObject != null) {
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
this.lockPlayerInventorySlot(slotIndex);
}
this.slot = slotIndex;
@@ -65,7 +65,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
this.slot = -1;
this.lockPlayerInventorySlot(ip.currentItem);
}
this.wirelessTerminalGUIObject = monitorable;
this.wirelessTerminalGUIObject = guiObject;
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
this.loadFromNBT();
this.setupUpgrades();
@@ -19,8 +19,10 @@
package appeng.core.sync.packets;
import appeng.api.networking.security.IActionHost;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.INetworkInfo;
@@ -60,8 +62,21 @@ public class PacketSwitchGuis extends AppEngPacket {
final AEBaseContainer bc = (AEBaseContainer) c;
final ContainerOpenContext context = bc.getOpenContext();
if (context != null) {
final TileEntity te = context.getTile();
Platform.openGUI(player, te, context.getSide(), this.newGui);
final Object target = bc.getTarget();
if (target instanceof IActionHost) {
final IActionHost ah = (IActionHost) target;
final TileEntity te = context.getTile();
if (te != null) {
Platform.openGUI(player, te, bc.getOpenContext().getSide(), this.newGui);
} else {
if (ah instanceof IInventorySlotAware) {
IInventorySlotAware i = ((IInventorySlotAware) ah);
Platform.openGUI(player, i.getInventorySlot(), this.newGui, i.isBaubleSlot());
}
}
}
}
}
}