some fixes

Use sponge schematic format instead of structure block
Fix VS undo running on main thread
Fix missing sections when setting blocks
This commit is contained in:
Jesse Boyd
2018-09-18 12:49:33 +10:00
parent 83464013ba
commit 5b5336cc83
19 changed files with 431 additions and 322 deletions

View File

@ -273,7 +273,7 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
if (existing == blockData) return true;
if (section == null) {
if (blockData.isAir()) return true;
sections[y4] = new ChunkSection(y4 << 4, nmsWorld.worldProvider.g());
sections[y4] = section = new ChunkSection(y4 << 4, nmsWorld.worldProvider.g());
}
if (existing.e() != blockData.e() || existing.getMaterial().f() != blockData.getMaterial().f()) {
nmsChunk.a(pos = new BlockPosition(x, y, z), blockData, false);

View File

@ -299,47 +299,48 @@ public class AsyncBlock implements Block {
return null;
}
public Block getBukkitBlock() {
@Deprecated
private Block getUnsafeBlock() {
return world.getBukkitWorld().getBlockAt(x, y, z);
}
@Override
public boolean breakNaturally() {
return TaskManager.IMP.sync(() -> getBukkitBlock().breakNaturally());
return TaskManager.IMP.sync(() -> getUnsafeBlock().breakNaturally());
}
@Override
public boolean breakNaturally(ItemStack tool) {
return TaskManager.IMP.sync(() -> getBukkitBlock().breakNaturally(tool));
return TaskManager.IMP.sync(() -> getUnsafeBlock().breakNaturally(tool));
}
@Override
public Collection<ItemStack> getDrops() {
return TaskManager.IMP.sync(() -> getBukkitBlock().getDrops());
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops());
}
@Override
public Collection<ItemStack> getDrops(ItemStack tool) {
return TaskManager.IMP.sync(() -> getBukkitBlock().getDrops(tool));
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool));
}
@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
this.getBukkitBlock().setMetadata(metadataKey, newMetadataValue);
this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue);
}
@Override
public List<MetadataValue> getMetadata(String metadataKey) {
return this.getBukkitBlock().getMetadata(metadataKey);
return this.getUnsafeBlock().getMetadata(metadataKey);
}
@Override
public boolean hasMetadata(String metadataKey) {
return this.getBukkitBlock().hasMetadata(metadataKey);
return this.getUnsafeBlock().hasMetadata(metadataKey);
}
@Override
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
this.getBukkitBlock().removeMetadata(metadataKey, owningPlugin);
this.getUnsafeBlock().removeMetadata(metadataKey, owningPlugin);
}
}