keybinds work
This commit is contained in:
@@ -414,8 +414,7 @@ final class Registration {
|
||||
iids.add(items.wirelessTerminal());
|
||||
iids.add(items.wirelessCraftingTerminal());
|
||||
iids.add(items.wirelessPatternTerminal());
|
||||
iids.add(items.wirelessFluidTerminal());
|
||||
|
||||
|
||||
for (IItemDefinition id : iids) {
|
||||
id.maybeItem().ifPresent(terminal -> {
|
||||
registries.wireless().registerWirelessHandler((IWirelessTermHandler) terminal);
|
||||
@@ -423,6 +422,10 @@ final class Registration {
|
||||
Upgrades.MAGNET.registerItem(id, 1);
|
||||
});
|
||||
}
|
||||
items.wirelessFluidTerminal().maybeItem().ifPresent(terminal -> {
|
||||
registries.wireless().registerWirelessHandler((IWirelessTermHandler) terminal);
|
||||
Upgrades.QUANTUM_LINK.registerItem(items.wirelessFluidTerminal(), 1);
|
||||
});
|
||||
|
||||
// Charge Rates
|
||||
items.chargedStaff().maybeItem().ifPresent(chargedStaff -> registries.charger().addChargeRate(chargedStaff, 320d));
|
||||
|
||||
@@ -84,7 +84,9 @@ public class AppEngPacketHandlerBase {
|
||||
|
||||
PACKET_INFORM_PLAYER(PacketInformPlayer.class),
|
||||
|
||||
PACKET_CRAFTING_CPUS_UPDATE(PacketCraftingCPUsUpdate.class);
|
||||
PACKET_CRAFTING_CPUS_UPDATE(PacketCraftingCPUsUpdate.class),
|
||||
|
||||
PACKET_TERMINAL_KEYBIND(PacketTerminalUse.class);
|
||||
|
||||
|
||||
private final Class<? extends AppEngPacket> packetClass;
|
||||
|
||||
@@ -71,6 +71,7 @@ import appeng.tile.storage.TileDrive;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
import baubles.api.BaublesApi;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -233,10 +234,14 @@ public enum GuiBridge implements IGuiHandler {
|
||||
final boolean stem = ((ordinal >> 3) & 1) == 1;
|
||||
if (ID.type.isItem()) {
|
||||
ItemStack it = ItemStack.EMPTY;
|
||||
if (stem) {
|
||||
it = player.inventory.getCurrentItem();
|
||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||
it = player.inventory.getStackInSlot(x);
|
||||
if (y == 0) {
|
||||
if (stem) {
|
||||
it = player.inventory.getCurrentItem();
|
||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||
it = player.inventory.getStackInSlot(x);
|
||||
}
|
||||
} else {
|
||||
it = BaublesApi.getBaublesHandler(player).getStackInSlot(x);
|
||||
}
|
||||
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
||||
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
||||
@@ -344,10 +349,14 @@ public enum GuiBridge implements IGuiHandler {
|
||||
final boolean stem = ((ordinal >> 3) & 1) == 1;
|
||||
if (ID.type.isItem()) {
|
||||
ItemStack it = ItemStack.EMPTY;
|
||||
if (stem) {
|
||||
it = player.inventory.getCurrentItem();
|
||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||
it = player.inventory.getStackInSlot(x);
|
||||
if (y == 0) {
|
||||
if (stem) {
|
||||
it = player.inventory.getCurrentItem();
|
||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||
it = player.inventory.getStackInSlot(x);
|
||||
}
|
||||
} else {
|
||||
it = BaublesApi.getBaublesHandler(player).getStackInSlot(x);
|
||||
}
|
||||
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
||||
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.items.tools.powered.Terminal;
|
||||
import appeng.util.Platform;
|
||||
import baubles.api.BaublesApi;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class PacketTerminalUse extends AppEngPacket {
|
||||
Terminal terminal;
|
||||
|
||||
public PacketTerminalUse(final ByteBuf stream) {
|
||||
this.terminal = Terminal.values()[stream.readInt()];
|
||||
}
|
||||
|
||||
public PacketTerminalUse(Enum<Terminal> terminal) {
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt(this.getPacketID());
|
||||
data.writeInt(terminal.ordinal());
|
||||
|
||||
this.configureWrite(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {
|
||||
NonNullList<ItemStack> mainInventory = player.inventory.mainInventory;
|
||||
for (int i = 0; i < mainInventory.size(); i++) {
|
||||
ItemStack is = mainInventory.get(i);
|
||||
if (is.isItemEqual(terminal.getItemDefinition().maybeStack(1).get())) {
|
||||
Platform.openGUI(player, i, terminal.getBridge(), false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < BaublesApi.getBaublesHandler(player).getSlots(); i++) {
|
||||
ItemStack is = BaublesApi.getBaublesHandler(player).getStackInSlot(i);
|
||||
if (is.isItemEqual(terminal.getItemDefinition().maybeStack(1).get())) {
|
||||
Platform.openGUI(player, i, terminal.getBridge(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum a {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user