3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-20 09:50:06 +01:00

Implement dirty workaround for get data from right ticking region

Dieser Commit ist enthalten in:
Phillipp Glanz 2023-04-03 13:13:33 +02:00
Ursprung 9d06640ab1
Commit 2b46e1901c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden

Datei anzeigen

@ -61,7 +61,6 @@ 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;
@ -253,8 +252,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
if (entity == null) { if (entity == null) {
return null; return null;
} }
return new PaperweightLazyCompoundTag(Suppliers.memoize(TaskManager.taskManager().syncAt(entity, return new PaperweightLazyCompoundTag(Suppliers.memoize(TaskManager.taskManager().syncAt(
new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x,y,z)) entity,
new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z))
)::saveWithId)); )::saveWithId));
// return new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)); // return new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId));
} }
@ -773,10 +773,17 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
final BlockPos pos = new BlockPos(x, y, z); final BlockPos pos = new BlockPos(x, y, z);
synchronized (nmsWorld) { synchronized (nmsWorld) {
BlockEntity tileEntity = nmsWorld.getBlockEntity(pos);
BlockEntity tileEntity = TaskManager.taskManager().syncAt(
() -> nmsWorld.getBlockEntity(pos),
new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z))
);
if (tileEntity == null || tileEntity.isRemoved()) { if (tileEntity == null || tileEntity.isRemoved()) {
nmsWorld.removeBlockEntity(pos); nmsWorld.removeBlockEntity(pos);
tileEntity = nmsWorld.getBlockEntity(pos); tileEntity = TaskManager.taskManager().syncAt(
() -> nmsWorld.getBlockEntity(pos),
new Location(new BukkitWorld(getChunk().bukkitChunk.getWorld()), Vector3.at(x, y, z))
);
} }
if (tileEntity != null) { if (tileEntity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative( final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(