mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-30 11:53:52 -07:00
Finish PlayerPickItemEvent
This commit is contained in:
@@ -20,19 +20,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (!event.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - Add PlayerPickItemEvent
|
||||
+ i = event.getSourceSlot();
|
||||
|
||||
if (i != -1) {
|
||||
if (Inventory.isHotbarSlot(i)) {
|
||||
- if (Inventory.isHotbarSlot(i)) {
|
||||
- playerinventory.selected = i;
|
||||
+ playerinventory.selected = event.getTargetSlot(); // Paper - Add target slot
|
||||
+ if (Inventory.isHotbarSlot(i) && Inventory.isHotbarSlot(event.getTargetSlot())) {
|
||||
+ playerinventory.selected = event.getTargetSlot();
|
||||
} else {
|
||||
- playerinventory.pickSlot(i);
|
||||
+ playerinventory.pickSlot(i, event.getTargetSlot()); // Paper - Add target slot
|
||||
+ playerinventory.pickSlot(i, event.getTargetSlot());
|
||||
}
|
||||
} else if (this.player.hasInfiniteMaterials()) {
|
||||
- playerinventory.addAndPickItem(stack);
|
||||
+ playerinventory.addAndPickItem(stack, event.getTargetSlot()); // Paper - Add target slot
|
||||
+ playerinventory.addAndPickItem(stack, event.getTargetSlot());
|
||||
+ // Paper end - Add PlayerPickItemEvent
|
||||
}
|
||||
|
||||
this.player.connection.send(new ClientboundSetHeldSlotPacket(playerinventory.selected));
|
||||
|
Reference in New Issue
Block a user