mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Fix for pasting double chests in certain orientations.
https://github.com/BentoBoxWorld/bentobox/issues/326 Error was that double chests get pasted in two single blocks but the full inventory is stored for each block. This code just ignores any inventory slots greater than what the chest can handle.
This commit is contained in:
parent
09905ab018
commit
74950b7a5d
@ -322,7 +322,10 @@ public class Clipboard {
|
||||
Inventory ih = ((InventoryHolder)bs).getInventory();
|
||||
if (config.isConfigurationSection(INVENTORY)) {
|
||||
ConfigurationSection inv = config.getConfigurationSection(INVENTORY);
|
||||
inv.getKeys(false).forEach(i -> ih.setItem(Integer.valueOf(i), (ItemStack)inv.get(i)));
|
||||
// Double chests are pasted as two blocks so inventory is filled twice. This code stops over filling for the first block.
|
||||
inv.getKeys(false).stream()
|
||||
.filter(i -> Integer.valueOf(i) < ih.getSize())
|
||||
.forEach(i -> ih.setItem(Integer.valueOf(i), (ItemStack)inv.get(i)));
|
||||
}
|
||||
}
|
||||
// Mob spawners
|
||||
|
Loading…
Reference in New Issue
Block a user