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