for (Location loc : locations) {
Block source = copy_location.getBlock();
BlockState sourceState = source.getState();
Block update = destination.getBlock();
update.setTypeIdAndData(source.getTypeId(), source.getData(), false);
BlockState updateState = update.getState();
// Note: only a BlockState, not a Block, is actually an instance
// of InventoryHolder
if (sourceState instanceof InventoryHolder) {
((InventoryHolder) updateState).getInventory()
.setContents(((InventoryHolder) sourceState).getInventory().getContents());
}
else if (sourceState instanceof Sign) {
int n = 0;
for (String line : ((Sign) sourceState).getLines()) {
((Sign) updateState).setLine(n, line);
n++;
}
updateState.update();
}
// TODO: Account for Noteblock, Skull, Jukebox