misc.py edited online with Bitbucket

This commit is contained in:
shillingp
2014-06-23 23:09:55 +00:00
parent 53c9118755
commit 23fb4d6644

28
misc.py
View File

@@ -95,20 +95,20 @@ def onPlayerInteractEntity(event):
# #
# Cycling around the item bar will switch between rows of the inventory # Cycling around the item bar will switch between rows of the inventory
# #
@hook.event("player.PlayerItemHeldEvent", "normal") #@hook.event("player.PlayerItemHeldEvent", "normal")
def onHeldEvent(event): #def onHeldEvent(event):
player = event.getPlayer() # player = event.getPlayer()
prev_slot = event.getPreviousSlot() # prev_slot = event.getPreviousSlot()
new_slot = event.getNewSlot() # new_slot = event.getNewSlot()
if (prev_slot == 0 and new_slot == 8): # if (prev_slot == 0 and new_slot == 8):
doCycle(player, 27) # doCycle(player, 27)
elif (prev_slot == 8 and new_slot == 0): # elif (prev_slot == 8 and new_slot == 0):
doCycle(player, 9) # doCycle(player, 9)
#
def doCycle(player, e): #def doCycle(player, e):
inv = player.getInventory() # inv = player.getInventory()
for x in range (0, 9): # for x in range (0, 9):
inv[x], inv[x+e] = inv[x+e], inv[x] # inv[x], inv[x+e] = inv[x+e], inv[x]
# #