fix terminal/netwoork tool (please)

This commit is contained in:
PrototypeTrousers
2023-02-09 12:16:40 -03:00
parent ab1f519401
commit ecb697ab11
3 changed files with 24 additions and 7 deletions
@@ -232,9 +232,12 @@ public enum GuiBridge implements IGuiHandler {
public Object getServerGuiElement(final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z) {
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
final GuiBridge ID = values()[ordinal >> 4];
final boolean usingItemOnTile = ((ordinal >> 3) & 1) == 1;
if (ID.type.isItem()) {
ItemStack it = ItemStack.EMPTY;
if (y == 0) {
if (usingItemOnTile) {
it = player.inventory.getCurrentItem();
} else if (y == 0) {
if (x >= 0 && x < player.inventory.mainInventory.size()) {
it = player.inventory.getStackInSlot(x);
}
@@ -344,9 +347,13 @@ public enum GuiBridge implements IGuiHandler {
public Object getClientGuiElement(final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z) {
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
final GuiBridge ID = values()[ordinal >> 4];
final boolean usingItemOnTile = ((ordinal >> 3) & 1) == 1;
if (ID.type.isItem()) {
ItemStack it = ItemStack.EMPTY;
if (y == 0) {
if (usingItemOnTile) {
it = player.inventory.getCurrentItem();
} else if (y == 0) {
if (x >= 0 && x < player.inventory.mainInventory.size()) {
it = player.inventory.getStackInSlot(x);
}
@@ -27,6 +27,7 @@ import appeng.api.networking.security.IActionHost;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerCraftConfirm;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.core.AELog;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.GuiBridge;
@@ -91,7 +92,14 @@ public class PacketCraftRequest extends AppEngPacket {
final ContainerOpenContext context = cca.getOpenContext();
if (context != null) {
final TileEntity te = context.getTile();
Platform.openGUI(player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM);
if (te != null) {
Platform.openGUI(player, te, cca.getOpenContext().getSide(), GuiBridge.GUI_CRAFTING_CONFIRM);
} else {
if (ah instanceof IInventorySlotAware) {
IInventorySlotAware i = ((IInventorySlotAware) ah);
Platform.openGUI(player, i.getInventorySlot(), GuiBridge.GUI_CRAFTING_CONFIRM, i.isBaubleSlot());
}
}
if (player.openContainer instanceof ContainerCraftConfirm) {
final ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;