Originally Posted by
Ultimate Webclient
The problem:
Let's say i have a whip in inventory slot 1, and i move it to slot 2 and try to wield it.
i can't wield it unless i move it back to slot one. can anyone help me with his problem?
Packet 214.
Code:
public class MoveItems implements Packet {
public void handle(Player player, int packetType, int packetSize) {
int interfaceId = player.getInStream().readShort(StreamBuffer.ValueType.A, StreamBuffer.ByteOrder.LITTLE);
int itemId = player.getInStream().readByte(StreamBuffer.ValueType.C);
int fromSlot = player.getInStream().readShort(StreamBuffer.ValueType.A, StreamBuffer.ByteOrder.LITTLE);
int toSlot = player.getInStream().readShort(StreamBuffer.ByteOrder.LITTLE);
switch(interfaceId) {
case 3214:
player.getInventory().swap(fromSlot, toSlot);
break;
}
}
}
Code:
public void swap(int fromSlot, int toSlot) {
InventoryItem temp = inventory[fromSlot];
inventory[fromSlot] = inventory[toSlot];
inventory[toSlot] = temp;
update();
}
Ofc. this is for my server so will need editing for yours...
What base you using?