mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 11:45:31 +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();
|
Inventory ih = ((InventoryHolder)bs).getInventory();
|
||||||
if (config.isConfigurationSection(INVENTORY)) {
|
if (config.isConfigurationSection(INVENTORY)) {
|
||||||
ConfigurationSection inv = config.getConfigurationSection(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
|
// Mob spawners
|
||||||
|
Loading…
Reference in New Issue
Block a user