Skip to content

Commit

Permalink
Fix for pasting double chests in certain orientations.
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
tastybento committed Nov 4, 2018
1 parent 09905ab commit 74950b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/world/bentobox/bentobox/schems/Clipboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ private void setBlockState(Island island, Block block, ConfigurationSection conf
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
Expand Down

0 comments on commit 74950b7

Please sign in to comment.