3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-10-03 20:21:05 +02:00

Improve scheduling for chunk data of regen

Dieser Commit ist enthalten in:
Phillipp Glanz 2023-04-03 15:10:57 +02:00
Ursprung 7bca6ef57c
Commit 9ac3bccbde

Datei anzeigen

@ -61,6 +61,7 @@ import net.minecraft.world.level.chunk.PalettedContainerRO;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.lighting.LevelLightEngine;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock;
@ -771,19 +772,10 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
final int y = blockHash.getY();
final int z = blockHash.getZ() + bz;
final BlockPos pos = new BlockPos(x, y, z);
synchronized (nmsWorld) {
BlockEntity tileEntity = TaskManager.taskManager().syncAt(
() -> nmsWorld.getBlockEntity(pos),
new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z))
);
BlockEntity tileEntity = nmsWorld.getBlockEntity(pos);
if (tileEntity == null || tileEntity.isRemoved()) {
nmsWorld.removeBlockEntity(pos);
tileEntity = TaskManager.taskManager().syncAt(
() -> nmsWorld.getBlockEntity(pos),
new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z))
);
tileEntity = nmsWorld.getBlockEntity(pos);
}
if (tileEntity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
@ -794,7 +786,6 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
tileEntity.load(tag);
}
}
}
};
}
@ -828,7 +819,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
// Run the sync tasks
for (Runnable task : finalSyncTasks) {
if (task != null) {
task.run();
Bukkit.getRegionScheduler().execute(WorldEditPlugin.getInstance(), nmsWorld.getWorld(), bx,
bz, task::run
);
}
}
if (callback == null) {