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:
tastybento 2018-11-04 09:16:55 -08:00
parent 09905ab018
commit 74950b7a5d

View File

@ -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