mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 04:23:54 +00:00
Fix wna when used internally
This commit is contained in:
@ -19,6 +19,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -102,4 +103,7 @@ public class MCAWorld extends AbstractWorld {
|
||||
public void sendFakeChunk(@Nullable Player player, ChunkPacket packet) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {}
|
||||
}
|
||||
|
@ -77,8 +77,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable,
|
||||
VirtualWorld {
|
||||
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld {
|
||||
|
||||
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||
|
||||
@ -94,6 +93,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
protected final CFIPrimitives primitives = new CFIPrimitives();
|
||||
private CFIPrimitives oldPrimitives = new CFIPrimitives();
|
||||
|
||||
@Override
|
||||
public void flush() {}
|
||||
|
||||
public final class CFIPrimitives implements Cloneable {
|
||||
|
||||
int waterHeight;
|
||||
|
@ -67,6 +67,7 @@ public class EditSessionBuilder {
|
||||
private EditSessionEvent event;
|
||||
private String command;
|
||||
private RelightMode relightMode;
|
||||
private Boolean wnaMode;
|
||||
|
||||
/**
|
||||
* An EditSession builder<br>
|
||||
@ -203,6 +204,11 @@ public class EditSessionBuilder {
|
||||
return setDirty();
|
||||
}
|
||||
|
||||
public EditSessionBuilder forceWNA() {
|
||||
this.wnaMode = true;
|
||||
return setDirty();
|
||||
}
|
||||
|
||||
private EditSessionBuilder setDirty() {
|
||||
compiled = false;
|
||||
return this;
|
||||
@ -303,7 +309,8 @@ public class EditSessionBuilder {
|
||||
World unwrapped = WorldWrapper.unwrap(world);
|
||||
boolean placeChunks = this.fastmode || this.limit.FAST_PLACEMENT;
|
||||
|
||||
if (placeChunks) {
|
||||
if (placeChunks && (wnaMode == null || !wnaMode)) {
|
||||
wnaMode = false;
|
||||
if (unwrapped instanceof IQueueExtent) {
|
||||
extent = queue = (IQueueExtent) unwrapped;
|
||||
} else if (Settings.IMP.QUEUE.PARALLEL_THREADS > 1 && !Fawe.isMainThread()) {
|
||||
@ -314,6 +321,7 @@ public class EditSessionBuilder {
|
||||
extent = queue = Fawe.get().getQueueHandler().getQueue(world);
|
||||
}
|
||||
} else {
|
||||
wnaMode = true;
|
||||
extent = world;
|
||||
}
|
||||
Extent root = extent;
|
||||
@ -445,4 +453,8 @@ public class EditSessionBuilder {
|
||||
return blockBag;
|
||||
}
|
||||
|
||||
public boolean isWNAMode() {
|
||||
return wnaMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
@ -319,4 +320,9 @@ public class WorldWrapper extends AbstractWorld {
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return parent.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
parent.flush();
|
||||
}
|
||||
}
|
||||
|
@ -222,6 +222,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
private final int maxY;
|
||||
private final List<WatchdogTickingExtent> watchdogExtents = new ArrayList<>(2);
|
||||
|
||||
private final boolean wnaMode;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public EditSession(@NotNull EventBus bus, World world, @Nullable Player player,
|
||||
@ -257,6 +259,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
this.maxY = world.getMaxY();
|
||||
this.blockBag = builder.getBlockBag();
|
||||
this.history = changeSet != null;
|
||||
this.wnaMode = builder.isWNAMode();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1075,6 +1078,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.level"));
|
||||
}
|
||||
}
|
||||
if (wnaMode) {
|
||||
getWorld().flush();
|
||||
}
|
||||
// Reset limit
|
||||
limit.set(originalLimit);
|
||||
// Enqueue it
|
||||
|
@ -30,6 +30,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.Flushable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
@ -186,4 +188,6 @@ public interface WorldNativeAccess<NC, NBS, NP> {
|
||||
onBlockStateChange(pos, oldState, newState);
|
||||
}
|
||||
|
||||
void flush();
|
||||
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -233,4 +234,7 @@ public class NullWorld extends AbstractWorld {
|
||||
public boolean regenerate(Region region, Extent extent, RegenOptions options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {}
|
||||
}
|
||||
|
@ -401,4 +401,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
|
||||
default boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void flush();
|
||||
}
|
||||
|
Reference in New Issue
Block a user