3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 18:10:08 +01:00

fix wna/loading on non-paper servers

Dieser Commit ist enthalten in:
dordsor21 2021-01-10 12:37:41 +00:00
Ursprung aab9958932
Commit bd079421a3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 20 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -18,6 +18,7 @@ import net.minecraft.server.v1_15_R1.Chunk;
import net.minecraft.server.v1_15_R1.ChunkProviderServer; import net.minecraft.server.v1_15_R1.ChunkProviderServer;
import net.minecraft.server.v1_15_R1.EnumDirection; import net.minecraft.server.v1_15_R1.EnumDirection;
import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.IBlockData;
import net.minecraft.server.v1_15_R1.MinecraftServer;
import net.minecraft.server.v1_15_R1.NBTBase; import net.minecraft.server.v1_15_R1.NBTBase;
import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.PlayerChunk; import net.minecraft.server.v1_15_R1.PlayerChunk;
@ -47,7 +48,9 @@ public class FAWEWorldNativeAccess_1_15_2 implements WorldNativeAccess<Chunk, IB
public FAWEWorldNativeAccess_1_15_2(FAWE_Spigot_v1_15_R2 adapter, WeakReference<World> world) { public FAWEWorldNativeAccess_1_15_2(FAWE_Spigot_v1_15_R2 adapter, WeakReference<World> world) {
this.adapter = adapter; this.adapter = adapter;
this.world = world; this.world = world;
this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging.
// - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway.
this.lastTick = new AtomicInteger(MinecraftServer.currentTick);
} }
private World getWorld() { private World getWorld() {
@ -80,7 +83,7 @@ public class FAWEWorldNativeAccess_1_15_2 implements WorldNativeAccess<Chunk, IB
@Nullable @Nullable
@Override @Override
public IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) { public IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) {
int currentTick = getWorld().getServer().getCurrentTick(); int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) { if (Fawe.isMainThread()) {
if (lastTick.get() > currentTick) { if (lastTick.get() > currentTick) {
lastTick.set(currentTick); lastTick.set(currentTick);

Datei anzeigen

@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R1.Chunk;
import net.minecraft.server.v1_16_R1.ChunkProviderServer; import net.minecraft.server.v1_16_R1.ChunkProviderServer;
import net.minecraft.server.v1_16_R1.EnumDirection; import net.minecraft.server.v1_16_R1.EnumDirection;
import net.minecraft.server.v1_16_R1.IBlockData; import net.minecraft.server.v1_16_R1.IBlockData;
import net.minecraft.server.v1_16_R1.MinecraftServer;
import net.minecraft.server.v1_16_R1.NBTBase; import net.minecraft.server.v1_16_R1.NBTBase;
import net.minecraft.server.v1_16_R1.NBTTagCompound; import net.minecraft.server.v1_16_R1.NBTTagCompound;
import net.minecraft.server.v1_16_R1.PlayerChunk; import net.minecraft.server.v1_16_R1.PlayerChunk;
@ -48,7 +49,9 @@ public class FAWEWorldNativeAccess_1_16_R1 implements WorldNativeAccess<Chunk, I
public FAWEWorldNativeAccess_1_16_R1(FAWE_Spigot_v1_16_R1 adapter, WeakReference<World> world) { public FAWEWorldNativeAccess_1_16_R1(FAWE_Spigot_v1_16_R1 adapter, WeakReference<World> world) {
this.adapter = adapter; this.adapter = adapter;
this.world = world; this.world = world;
this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging.
// - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway.
this.lastTick = new AtomicInteger(MinecraftServer.currentTick);
} }
private World getWorld() { private World getWorld() {
@ -81,7 +84,7 @@ public class FAWEWorldNativeAccess_1_16_R1 implements WorldNativeAccess<Chunk, I
@Nullable @Nullable
@Override @Override
public IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) { public IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) {
int currentTick = getWorld().getServer().getCurrentTick(); int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) { if (Fawe.isMainThread()) {
if (lastTick.get() > currentTick) { if (lastTick.get() > currentTick) {
lastTick.set(currentTick); lastTick.set(currentTick);

Datei anzeigen

@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R2.Chunk;
import net.minecraft.server.v1_16_R2.ChunkProviderServer; import net.minecraft.server.v1_16_R2.ChunkProviderServer;
import net.minecraft.server.v1_16_R2.EnumDirection; import net.minecraft.server.v1_16_R2.EnumDirection;
import net.minecraft.server.v1_16_R2.IBlockData; import net.minecraft.server.v1_16_R2.IBlockData;
import net.minecraft.server.v1_16_R2.MinecraftServer;
import net.minecraft.server.v1_16_R2.NBTBase; import net.minecraft.server.v1_16_R2.NBTBase;
import net.minecraft.server.v1_16_R2.NBTTagCompound; import net.minecraft.server.v1_16_R2.NBTTagCompound;
import net.minecraft.server.v1_16_R2.PlayerChunk; import net.minecraft.server.v1_16_R2.PlayerChunk;
@ -48,7 +49,9 @@ public class FAWEWorldNativeAccess_1_16_R2 implements WorldNativeAccess<Chunk, I
public FAWEWorldNativeAccess_1_16_R2(FAWE_Spigot_v1_16_R2 adapter, WeakReference<World> world) { public FAWEWorldNativeAccess_1_16_R2(FAWE_Spigot_v1_16_R2 adapter, WeakReference<World> world) {
this.adapter = adapter; this.adapter = adapter;
this.world = world; this.world = world;
this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging.
// - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway.
this.lastTick = new AtomicInteger(MinecraftServer.currentTick);
} }
private World getWorld() { private World getWorld() {
@ -81,7 +84,7 @@ public class FAWEWorldNativeAccess_1_16_R2 implements WorldNativeAccess<Chunk, I
@Nullable @Nullable
@Override @Override
public IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) { public IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) {
int currentTick = getWorld().getServer().getCurrentTick(); int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) { if (Fawe.isMainThread()) {
if (lastTick.get() > currentTick) { if (lastTick.get() > currentTick) {
lastTick.set(currentTick); lastTick.set(currentTick);

Datei anzeigen

@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R3.Chunk;
import net.minecraft.server.v1_16_R3.ChunkProviderServer; import net.minecraft.server.v1_16_R3.ChunkProviderServer;
import net.minecraft.server.v1_16_R3.EnumDirection; import net.minecraft.server.v1_16_R3.EnumDirection;
import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.IBlockData;
import net.minecraft.server.v1_16_R3.MinecraftServer;
import net.minecraft.server.v1_16_R3.NBTBase; import net.minecraft.server.v1_16_R3.NBTBase;
import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.NBTTagCompound;
import net.minecraft.server.v1_16_R3.PlayerChunk; import net.minecraft.server.v1_16_R3.PlayerChunk;
@ -48,7 +49,9 @@ public class FAWEWorldNativeAccess_1_16_R3 implements WorldNativeAccess<Chunk, I
public FAWEWorldNativeAccess_1_16_R3(FAWE_Spigot_v1_16_R3 adapter, WeakReference<World> world) { public FAWEWorldNativeAccess_1_16_R3(FAWE_Spigot_v1_16_R3 adapter, WeakReference<World> world) {
this.adapter = adapter; this.adapter = adapter;
this.world = world; this.world = world;
this.lastTick = new AtomicInteger(getWorld().getServer().getCurrentTick()); // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging.
// - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway.
this.lastTick = new AtomicInteger(MinecraftServer.currentTick);
} }
private World getWorld() { private World getWorld() {
@ -81,7 +84,7 @@ public class FAWEWorldNativeAccess_1_16_R3 implements WorldNativeAccess<Chunk, I
@Nullable @Nullable
@Override @Override
public synchronized IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) { public synchronized IBlockData setBlockState(Chunk chunk, BlockPosition position, IBlockData state) {
int currentTick = getWorld().getServer().getCurrentTick(); int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) { if (Fawe.isMainThread()) {
if (lastTick.get() > currentTick) { if (lastTick.get() > currentTick) {
lastTick.set(currentTick); lastTick.set(currentTick);