Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-17 00:20:09 +01:00
Add strings, changes to fastmode/side effect handling
Dieser Commit ist enthalten in:
Ursprung
d1236313cf
Commit
f23d430150
@ -361,7 +361,7 @@ public class FaweAPI {
|
||||
Fawe.instance().getQueueHandler(),
|
||||
world,
|
||||
true,
|
||||
SideEffectSet.none().with(SideEffect.LIGHTING, SideEffect.State.ON)
|
||||
SideEffectSet.none().with(SideEffect.LIGHTING)
|
||||
);
|
||||
queue = parallel.getExtent();
|
||||
} else {
|
||||
|
@ -107,7 +107,7 @@ public final class EditSessionBuilder {
|
||||
private Extent extent;
|
||||
private boolean compiled;
|
||||
private boolean wrapped;
|
||||
private SideEffectSet sideEffectSet = SideEffectSet.defaults();
|
||||
private SideEffectSet sideEffectSet = null;
|
||||
|
||||
private @Nullable
|
||||
World world;
|
||||
@ -459,8 +459,9 @@ public final class EditSessionBuilder {
|
||||
fastMode = actor.getSession().hasFastMode();
|
||||
}
|
||||
}
|
||||
if (fastMode) {
|
||||
sideEffectSet = SideEffectSet.none();
|
||||
if (sideEffectSet == null) {
|
||||
// Keep heightmaps to maintain behaviour
|
||||
sideEffectSet = fastMode ? SideEffectSet.none().with(SideEffect.HEIGHTMAPS) : SideEffectSet.defaults();
|
||||
}
|
||||
if (checkMemory == null) {
|
||||
checkMemory = actor != null && !this.fastMode;
|
||||
@ -498,6 +499,7 @@ public final class EditSessionBuilder {
|
||||
} else {
|
||||
extent = queue = Fawe.instance().getQueueHandler().getQueue(world);
|
||||
}
|
||||
queue.setSideEffectSet(sideEffectSet);
|
||||
} else {
|
||||
wnaMode = true;
|
||||
extent = world;
|
||||
@ -580,8 +582,7 @@ public final class EditSessionBuilder {
|
||||
if (this.sideEffectSet.shouldApply(SideEffect.HEIGHTMAPS)) {
|
||||
queue.addProcessor(new HeightmapProcessor(world.getMinY(), world.getMaxY()));
|
||||
}
|
||||
if (this.sideEffectSet.shouldApply(SideEffect.UPDATE) || this.sideEffectSet.shouldApply(SideEffect.NEIGHBORS) || this.sideEffectSet.shouldApply(
|
||||
SideEffect.VALIDATION)) {
|
||||
if (this.sideEffectSet.shouldApply(SideEffect.NEIGHBORS)) {
|
||||
Region region = allowedRegions == null || allowedRegions.length == 0
|
||||
? null
|
||||
: allowedRegions.length == 1 ? allowedRegions[0] : new RegionIntersection(allowedRegions);
|
||||
|
@ -154,6 +154,7 @@ public class LocalSession implements TextureHolder {
|
||||
private transient TextureUtil texture;
|
||||
private transient ResettableExtent transform = null;
|
||||
private transient World currentWorld;
|
||||
private transient boolean fastMode = false;
|
||||
//FAWE end
|
||||
private transient ClipboardHolder clipboard;
|
||||
private transient final Object clipboardLock = new Object();
|
||||
@ -1725,11 +1726,12 @@ public class LocalSession implements TextureHolder {
|
||||
* @return an edit session
|
||||
*/
|
||||
public EditSession createEditSession(Actor actor) {
|
||||
//FAWE start
|
||||
//FAWE start - save command used
|
||||
return createEditSession(actor, null);
|
||||
}
|
||||
|
||||
public EditSession createEditSession(Actor actor, String command) {
|
||||
//FAWE end
|
||||
checkNotNull(actor);
|
||||
|
||||
World world = null;
|
||||
@ -1740,18 +1742,18 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
|
||||
// Create an edit session
|
||||
EditSession editSession;
|
||||
EditSessionBuilder builder = WorldEdit.getInstance().newEditSessionBuilder().world(world);
|
||||
if (actor.isPlayer() && actor instanceof Player) {
|
||||
BlockBag blockBag = getBlockBag((Player) actor);
|
||||
builder.actor(actor);
|
||||
builder.blockBag(blockBag);
|
||||
}
|
||||
//FAWE start
|
||||
builder.command(command);
|
||||
builder.fastMode(!this.sideEffectSet.doesApplyAny());
|
||||
builder.fastMode(this.fastMode);
|
||||
builder.setSideEffectSet(this.sideEffectSet);
|
||||
|
||||
editSession = builder.build();
|
||||
EditSession editSession = builder.build();
|
||||
|
||||
if (mask != null) {
|
||||
editSession.setMask(mask);
|
||||
@ -1763,7 +1765,7 @@ public class LocalSession implements TextureHolder {
|
||||
editSession.addTransform(transform);
|
||||
}
|
||||
editSession.setTickingWatchdog(tickingWatchdog);
|
||||
|
||||
//FAWE end
|
||||
return editSession;
|
||||
}
|
||||
//FAWE end
|
||||
@ -1802,7 +1804,9 @@ public class LocalSession implements TextureHolder {
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasFastMode() {
|
||||
return !this.sideEffectSet.doesApplyAny();
|
||||
//FAWE start - use fastmode boolean not side effects
|
||||
return this.fastMode;
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1812,7 +1816,9 @@ public class LocalSession implements TextureHolder {
|
||||
*/
|
||||
@Deprecated
|
||||
public void setFastMode(boolean fastMode) {
|
||||
this.sideEffectSet = fastMode ? SideEffectSet.none() : SideEffectSet.defaults();
|
||||
//FAWE start - use fastmode boolean not side effects
|
||||
this.fastMode = fastMode;
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,6 +59,27 @@ public class SideEffectSet {
|
||||
//FAWE end
|
||||
}
|
||||
|
||||
//FAWE start - simple overload method for setting side effects
|
||||
|
||||
/**
|
||||
* Create a new {@link SideEffectSet} with the given side effect set to "on"
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public SideEffectSet with(SideEffect sideEffect) {
|
||||
return with(sideEffect, SideEffect.State.ON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link SideEffectSet} with the given side effect set to "off"
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public SideEffectSet without(SideEffect sideEffect) {
|
||||
return with(sideEffect, SideEffect.State.OFF);
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
public SideEffectSet with(SideEffect sideEffect, SideEffect.State state) {
|
||||
Map<SideEffect, SideEffect.State> entries = this.sideEffects.isEmpty()
|
||||
? Maps.newEnumMap(SideEffect.class)
|
||||
@ -101,4 +122,23 @@ public class SideEffectSet {
|
||||
return NONE;
|
||||
}
|
||||
|
||||
//FAWE start
|
||||
|
||||
/**
|
||||
* API-friendly side effect set.
|
||||
* Sets:
|
||||
* - Heightmaps
|
||||
* - Lighting (if set to mode 1 or 2 in config)
|
||||
* Does not set:
|
||||
* - History
|
||||
* - Neighbours
|
||||
* - Lighting (if set to mode 0 in config
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public static SideEffectSet api() {
|
||||
return defaults().without(SideEffect.HISTORY);
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
}
|
||||
|
@ -626,10 +626,14 @@
|
||||
"worldedit.selection.polygon2d.explain.secondary": "Added point #{0} at {1}.",
|
||||
"worldedit.selection.sphere.explain.secondary": "Radius set to {0}.",
|
||||
"worldedit.selection.sphere.explain.secondary-defined": "Radius set to {0} ({1}).",
|
||||
"worldedit.sideeffect.history": "History",
|
||||
"worldedit.sideeffect.history.description": "Writes history of the change",
|
||||
"worldedit.sideeffect.heightmaps": "Heightmaps",
|
||||
"worldedit.sideeffect.heightmaps.description": "Updates heightmaps",
|
||||
"worldedit.sideeffect.lighting": "Lighting",
|
||||
"worldedit.sideeffect.lighting.description": "Updates block lighting",
|
||||
"worldedit.sideeffect.neighbors": "Neighbors",
|
||||
"worldedit.sideeffect.neighbors.description": "Notifies nearby blocks of changes",
|
||||
"worldedit.sideeffect.neighbors.description": "Updates shapes of blocks in the edit",
|
||||
"worldedit.sideeffect.update": "Update",
|
||||
"worldedit.sideeffect.update.description": "Notifies the changed block",
|
||||
"worldedit.sideeffect.validation": "Validation",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren