mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
Fix being able to duplicate held block under rare circumstances. (Thanks Cybertoon)
Could be accomplished by (with default inventory), scroll to log, press G, scroll to dirt, middle click grass, grass will now be put in the empty slot. Hence it now appears twice in the inventory.
This commit is contained in:
parent
663ac22524
commit
846ba75d3a
@ -55,13 +55,18 @@ namespace ClassicalSharp.Mode {
|
||||
|
||||
// Is the currently selected block an empty slot
|
||||
if (inv[inv.SelectedIndex] == Block.Air) {
|
||||
inv.Selected = old; return;
|
||||
inv.Selected = old; return;
|
||||
}
|
||||
|
||||
// Try to replace same block or empty slots first.
|
||||
// Try to replace same block
|
||||
for (int i = 0; i < Inventory.BlocksPerRow; i++) {
|
||||
if (inv[i] != old && inv[i] != Block.Air) continue;
|
||||
|
||||
if (inv[i] != old) continue;
|
||||
inv.SelectedIndex = i; return;
|
||||
}
|
||||
|
||||
// Try to replace empty slots
|
||||
for (int i = 0; i < Inventory.BlocksPerRow; i++) {
|
||||
if (inv[i] != Block.Air) continue;
|
||||
inv[i] = old;
|
||||
inv.SelectedIndex = i; return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user