Hold shift to go faster in the AESU gui, closes #1686
This commit is contained in:
parent
ee0d72223a
commit
d7f0e04034
3 changed files with 15 additions and 9 deletions
|
@ -27,6 +27,7 @@ package techreborn.client.gui;
|
|||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
|
@ -83,7 +84,8 @@ public class GuiAESU extends GuiBase {
|
|||
public void actionPerformed(final GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
if (button.id >= 300 && button.id <= 303) {
|
||||
NetworkManager.sendToServer(new PacketAesu(button.id, tile));
|
||||
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
|
||||
NetworkManager.sendToServer(new PacketAesu(button.id, tile, shift));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,18 +54,18 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
|
|||
super("ADJUSTABLE_SU", 4, ModBlocks.ADJUSTABLE_SU, EnumPowerTier.INSANE, maxInput, maxOutput, maxEnergy);
|
||||
}
|
||||
|
||||
public void handleGuiInputFromClient(int id) {
|
||||
public void handleGuiInputFromClient(int id, boolean shift) {
|
||||
if (id == 300) {
|
||||
OUTPUT += 256;
|
||||
OUTPUT += shift ? 4096 : 256;
|
||||
}
|
||||
if (id == 301) {
|
||||
OUTPUT += 64;
|
||||
OUTPUT += shift ? 512 : 64;
|
||||
}
|
||||
if (id == 302) {
|
||||
OUTPUT -= 64;
|
||||
OUTPUT -= shift ? 512 : 64;
|
||||
}
|
||||
if (id == 303) {
|
||||
OUTPUT -= 256;
|
||||
OUTPUT -= shift ? 4096 : 256;
|
||||
}
|
||||
if (OUTPUT > maxOutput) {
|
||||
OUTPUT = maxOutput;
|
||||
|
|
Loading…
Add table
Reference in a new issue