Hold shift to go faster in the AESU gui, closes #1686

This commit is contained in:
modmuss50 2019-03-17 16:10:20 +00:00
parent ee0d72223a
commit d7f0e04034
3 changed files with 15 additions and 9 deletions

View file

@ -37,32 +37,36 @@ public class PacketAesu implements INetworkPacket<PacketAesu> {
int buttonID;
BlockPos pos;
boolean shift;
public PacketAesu() {
}
public PacketAesu(int buttonID, TileAdjustableSU tile) {
this.pos = tile.getPos();
public PacketAesu(int buttonID, TileAdjustableSU tile, boolean shift) {
this.buttonID = buttonID;
this.pos = tile.getPos();
this.shift = shift;
}
@Override
public void writeData(ExtendedPacketBuffer out) throws IOException {
out.writeBlockPos(pos);
out.writeInt(buttonID);
out.writeBoolean(shift);
}
@Override
public void readData(ExtendedPacketBuffer in) throws IOException {
this.pos = in.readBlockPos();
this.buttonID = in.readInt();
this.shift = in.readBoolean();
}
@Override
public void processData(PacketAesu message, MessageContext context) {
TileEntity tile = context.getServerHandler().player.world.getTileEntity(message.pos);
if (tile instanceof TileAdjustableSU){
((TileAdjustableSU) tile).handleGuiInputFromClient(message.buttonID);
((TileAdjustableSU) tile).handleGuiInputFromClient(message.buttonID, shift);
}
}
}