choose 1 from grid

This commit is contained in:
Raoul Van den Berge
2016-01-02 20:56:28 +01:00
parent 1e4501f1c5
commit 9dd2ffd3ec
2 changed files with 14 additions and 2 deletions

View File

@@ -308,7 +308,11 @@ public class GuiGrid extends GuiBase
} }
else if (isHoveringOverValidSlot(getItems()) && container.getPlayer().inventory.getItemStack() == null) else if (isHoveringOverValidSlot(getItems()) && container.getPlayer().inventory.getItemStack() == null)
{ {
StorageCraft.NETWORK.sendToServer(new MessageStoragePull(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), hoveringId, clickedButton == 1, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))); boolean half = clickedButton == 1;
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
boolean one = clickedButton == 2;
StorageCraft.NETWORK.sendToServer(new MessageStoragePull(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), hoveringId, half, one, shift));
} }
else if (clickedClear) else if (clickedClear)
{ {

View File

@@ -16,19 +16,21 @@ public class MessageStoragePull extends MessageHandlerPlayerToServer<MessageStor
private int z; private int z;
private int id; private int id;
private boolean half; private boolean half;
private boolean one;
private boolean shift; private boolean shift;
public MessageStoragePull() public MessageStoragePull()
{ {
} }
public MessageStoragePull(int x, int y, int z, int id, boolean half, boolean shift) public MessageStoragePull(int x, int y, int z, int id, boolean half, boolean one, boolean shift)
{ {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
this.id = id; this.id = id;
this.half = half; this.half = half;
this.one = one;
this.shift = shift; this.shift = shift;
} }
@@ -40,6 +42,7 @@ public class MessageStoragePull extends MessageHandlerPlayerToServer<MessageStor
z = buf.readInt(); z = buf.readInt();
id = buf.readInt(); id = buf.readInt();
half = buf.readBoolean(); half = buf.readBoolean();
one = buf.readBoolean();
shift = buf.readBoolean(); shift = buf.readBoolean();
} }
@@ -51,6 +54,7 @@ public class MessageStoragePull extends MessageHandlerPlayerToServer<MessageStor
buf.writeInt(z); buf.writeInt(z);
buf.writeInt(id); buf.writeInt(id);
buf.writeBoolean(half); buf.writeBoolean(half);
buf.writeBoolean(one);
buf.writeBoolean(shift); buf.writeBoolean(shift);
} }
@@ -78,6 +82,10 @@ public class MessageStoragePull extends MessageHandlerPlayerToServer<MessageStor
quantity = 64; quantity = 64;
} }
} }
else if (message.one)
{
quantity = 1;
}
ItemStack took = controller.take(item.copy(quantity).toItemStack()); ItemStack took = controller.take(item.copy(quantity).toItemStack());