This commit is contained in:
PrototypeTrousers
2023-02-03 15:07:55 -03:00
parent 472f1e65a2
commit d7e7ef0cb4
3 changed files with 11 additions and 20 deletions
@@ -241,7 +241,7 @@ public enum GuiBridge implements IGuiHandler {
} else if (x >= 0 && x < player.inventory.mainInventory.size()) { } else if (x >= 0 && x < player.inventory.mainInventory.size()) {
it = player.inventory.getStackInSlot(x); it = player.inventory.getStackInSlot(x);
} }
} else if (y == 1 && z == 0) { } else if (y == 1 && z == Integer.MIN_VALUE) {
if (stem) { if (stem) {
if (player.openContainer instanceof IInventorySlotAware) { if (player.openContainer instanceof IInventorySlotAware) {
int slot = ((IInventorySlotAware) player.openContainer).getInventorySlot(); int slot = ((IInventorySlotAware) player.openContainer).getInventorySlot();
@@ -1,5 +1,6 @@
package appeng.core.sync.packets; package appeng.core.sync.packets;
import appeng.api.util.AEPartLocation;
import appeng.core.sync.AppEngPacket; import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo; import appeng.core.sync.network.INetworkInfo;
import appeng.items.tools.powered.Terminal; import appeng.items.tools.powered.Terminal;
@@ -31,17 +32,16 @@ public class PacketTerminalUse extends AppEngPacket {
@Override @Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) { public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {
NonNullList<ItemStack> mainInventory = player.inventory.mainInventory; NonNullList<ItemStack> mainInventory = player.inventory.mainInventory;
for (int i = 0; i < mainInventory.size(); i++) { for (ItemStack is : mainInventory) {
ItemStack is = mainInventory.get(i);
if (terminal.getItemDefinition().isSameAs(is)) { if (terminal.getItemDefinition().isSameAs(is)) {
Platform.openGUI(player, i, terminal.getBridge(), false); Platform.openGUI(player, null, AEPartLocation.INTERNAL, terminal.getBridge());
return; return;
} }
} }
for (int i = 0; i < BaublesApi.getBaublesHandler(player).getSlots(); i++) { for (int i = 0; i < BaublesApi.getBaublesHandler(player).getSlots(); i++) {
ItemStack is = BaublesApi.getBaublesHandler(player).getStackInSlot(i); ItemStack is = BaublesApi.getBaublesHandler(player).getStackInSlot(i);
if (terminal.getItemDefinition().isSameAs(is)) { if (terminal.getItemDefinition().isSameAs(is)) {
Platform.openGUI(player, i, terminal.getBridge(), true); Platform.openGUI(player, null, AEPartLocation.INTERNAL, terminal.getBridge());
break; break;
} }
} }
+6 -15
View File
@@ -324,8 +324,9 @@ public class Platform {
} }
int x; int x;
int y = 0; int y;
int z = 0; int z;
if (tile != null) { if (tile != null) {
x = tile.getPos().getX(); x = tile.getPos().getX();
y = tile.getPos().getY(); y = tile.getPos().getY();
@@ -333,10 +334,12 @@ public class Platform {
} else { } else {
if (p.openContainer instanceof IInventorySlotAware) { if (p.openContainer instanceof IInventorySlotAware) {
x = ((IInventorySlotAware) p.openContainer).getInventorySlot(); x = ((IInventorySlotAware) p.openContainer).getInventorySlot();
y = ((IInventorySlotAware)p.openContainer).isBaubleSlot() ? 1 : 0; y = ((IInventorySlotAware) p.openContainer).isBaubleSlot() ? 1 : 0;
} else { } else {
x = p.inventory.currentItem; x = p.inventory.currentItem;
y = 0;
} }
z = Integer.MIN_VALUE;
} }
if ((type.getType().isItem() && tile == null) || type.hasPermissions(tile, x, y, z, side, p)) { if ((type.getType().isItem() && tile == null) || type.hasPermissions(tile, x, y, z, side, p)) {
@@ -350,18 +353,6 @@ public class Platform {
} }
} }
public static void openGUI(@Nonnull final EntityPlayer p, int i, @Nonnull final GuiBridge type, boolean isBauble) {
if (isClient()) {
return;
}
if (type.getType().isItem()) {
if (type.getType() == GuiHostType.ITEM) {
p.openGui(AppEng.instance(), type.ordinal() << 4, p.getEntityWorld(), i, isBauble ? 1 : 0, 0);
}
}
}
/* /*
* returns true if the code is on the client. * returns true if the code is on the client.
*/ */