Skip to content

Commit

Permalink
fix visual duplication & null issue
Browse files Browse the repository at this point in the history
  • Loading branch information
auxves committed Jan 7, 2021
1 parent b7eb5e6 commit cbbc2de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/io/glossnyx/vibes/network/ClientNetworking.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ object ClientNetworking {
}

Items.AIR -> {
if (player.isCreative) slot.stack = discOf(cursorStack)

val disc = discOf(cursorStack) ?: return
if (player.isCreative) slot.stack = disc
setDiscOf(cursorStack, ItemStack.EMPTY)

send(RightClickStop(slot.id))
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/io/glossnyx/vibes/network/ServerNetworking.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ object ServerNetworking {
val cursorStack = player.inventory.cursorStack

val uuid = uuidOf(cursorStack) ?: return@register
val disc = discOf(cursorStack) ?: return@register

if (player.isCreative) {
slot.stack = discOf(cursorStack)
slot.stack = disc
setDiscOf(cursorStack, ItemStack.EMPTY)
} else {
player.inventory.cursorStack = discOf(cursorStack)
player.inventory.cursorStack = disc
slot.stack = cursorStack.copy()
setDiscOf(slot.stack, ItemStack.EMPTY)
}
Expand Down

0 comments on commit cbbc2de

Please sign in to comment.