Skip to content

Instantly share code, notes, and snippets.

@riking
Last active December 17, 2015 01:38
Show Gist options
  • Save riking/5529511 to your computer and use it in GitHub Desktop.
Save riking/5529511 to your computer and use it in GitHub Desktop.
case DENY:
switch (action) {
// Modified other slots
case MOVE_TO_OTHER_INVENTORY:
case HOTBAR_MOVE_AND_READD:
case HOTBAR_SWAP:
case COLLECT_TO_CURSOR:
case PLACE_DRAG_SINGLE:
case PLACE_DRAG_EVEN:
case UNKNOWN:
this.player.updateInventory(this.player.activeContainer);
break;
// Modified cursor and clicked
case PICKUP_ALL:
case PICKUP_SOME:
case PICKUP_HALF:
case PICKUP_ONE:
case PLACE_ALL:
case PLACE_SOME:
case PLACE_ONE:
case SWAP_WITH_CURSOR:
this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried()));
this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem()));
break;
// Modified clicked only
case DROP_ALL_SLOT:
case DROP_ONE_SLOT:
this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem()));
break;
// Modified cursor only
case DROP_ALL_CURSOR:
case DROP_ONE_CURSOR:
case CLONE_STACK:
this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried()));
break;
// Nothing
case NOTHING:
break;
}
case DENY:
if (action.modifiesOtherSlots()) {
this.player.updateInventory(this.player.activeContainer);
} else {
if (action.modifiesCursor()) {
this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried()));
}
if (action.modifiesClicked()) {
this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment