Load chunks async for every block pasted.

This loads every chunk async based on the block or entity being pasted.
This commit is contained in:
tastybento 2020-03-17 23:14:43 -07:00
parent cf986925a0
commit 41e9bccc67

View File

@ -242,7 +242,7 @@ public class BlueprintPaster {
World world = location.getWorld();
Location pasteTo = location.clone().add(entry.getKey());
BlueprintBlock bpBlock = entry.getValue();
Util.getChunkAtAsync(pasteTo).thenRun(() -> {
Block block = pasteTo.getBlock();
// Set the block data - default is AIR
BlockData bd;
@ -255,6 +255,7 @@ public class BlueprintPaster {
setBlockState(block, bpBlock);
// pos1 and pos2 update
updatePos(block.getLocation());
});
}
/**
@ -337,6 +338,7 @@ public class BlueprintPaster {
list.stream().filter(k -> k.getType() != null).forEach(k -> {
// Center, and just a bit high
Location center = location.add(new Vector(0.5, 0.5, 0.5));
Util.getChunkAtAsync(center).thenRun(() -> {
LivingEntity e = (LivingEntity)location.getWorld().spawnEntity(center, k.getType());
if (k.getCustomName() != null) {
String customName = k.getCustomName();
@ -354,6 +356,7 @@ public class BlueprintPaster {
}
k.configureEntity(e);
});
});
}
/**