Skip to content

Commit

Permalink
Merge branch 'EngineHub:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomamaeatstoes authored Nov 5, 2024
2 parents 13a2326 + a1132ab commit 6191ff7
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 31 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
7.3.7
- Fixed handling of some time-related commands in the snapshot system
- Fixed some situations where rotated pastes can behave oddly with the update side effect disabled
- Fixed an error that can occur when generating completions starting with a `"`
- Fixed Sponge v3 schematics lacking the `BlockEntities` not loading
- Fixed the `//curve` and `//line` commands not accepting decimal values for thickness
- Fixed WorldEdit not using typical error handling systems when an error is thrown during post-edit
- Fixed NBT parsing for certain legacy schematics with non-standard string formatting
- Improved performance of the side effect system, and fixed some API inconsistencies
- Re-enabled the buffering system, due to some systems depending on it in certain situations
- [Sponge] Added `-y` value support that was missing in some situations

7.3.6
- [Bukkit] Allow 1.21 Paper adapter to load on 1.21.1
- Revert "Shutdown the executor service on disable, to prevent waiting on async tasks before shutting down" due to it causing issues in some situations

7.3.5
- [Bukkit] Utilise new Bukkit registry API, allowing WorldEdit to work with Commodore disabled (`paper.disableOldApiSupport` flag on Paper)
- Fix queryRel not behaving correctly in //deform and the deform brush
- Fixed queryRel not behaving correctly in //deform and the deform brush
- Shutdown the executor service on disable, to prevent waiting on async tasks before shutting down
- Remove legacy code for pre-1.16 //drawsel handling

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fabric-mixin = "net.fabricmc:sponge-mixin:0.13.3+mixin.0.8.5"

paperweight = "io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.7.2"

linBus-bom = "org.enginehub.lin-bus:lin-bus-bom:0.1.0"
linBus-bom = "org.enginehub.lin-bus:lin-bus-bom:0.2.0"
linBus-common.module = "org.enginehub.lin-bus:lin-bus-common"
linBus-stream.module = "org.enginehub.lin-bus:lin-bus-stream"
linBus-tree.module = "org.enginehub.lin-bus:lin-bus-tree"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,33 @@ public void handleCommand(CommandEvent event) {
// exceptions without writing a hook into every dispatcher, we need to unwrap these
// exceptions and rethrow their converted form, if their is one.
try {
commandManager.execute(context, ImmutableList.copyOf(split));
try {
commandManager.execute(context, ImmutableList.copyOf(split));
} finally {
Optional<EditSession> editSessionOpt =
context.snapshotMemory().injectedValue(Key.of(EditSession.class));

if (editSessionOpt.isPresent()) {
EditSession editSession = editSessionOpt.get();
session.remember(editSession);
editSession.close();

if (config.profile) {
long time = System.currentTimeMillis() - start;
double timeS = (time / 1000.0);
int changed = editSession.getBlockChangeCount();
double throughput = timeS == 0 ? changed : changed / timeS;
actor.printDebug(TranslatableComponent.of(
"worldedit.command.time-elapsed",
TextComponent.of(timeS),
TextComponent.of(changed),
TextComponent.of(Math.round(throughput))
));
}

worldEdit.flushBlockBag(actor, editSession);
}
}
} catch (Throwable t) {
// Use the exception converter to convert the exception if any of its causes
// can be converted, otherwise throw the original exception
Expand Down Expand Up @@ -540,29 +566,6 @@ public void handleCommand(CommandEvent event) {
} catch (Throwable t) {
handleUnknownException(actor, t);
} finally {
Optional<EditSession> editSessionOpt =
context.snapshotMemory().injectedValue(Key.of(EditSession.class));

if (editSessionOpt.isPresent()) {
EditSession editSession = editSessionOpt.get();
session.remember(editSession);
editSession.close();

if (config.profile) {
long time = System.currentTimeMillis() - start;
double timeS = (time / 1000.0);
int changed = editSession.getBlockChangeCount();
double throughput = timeS == 0 ? changed : changed / timeS;
actor.printDebug(TranslatableComponent.of(
"worldedit.command.time-elapsed",
TextComponent.of(timeS),
TextComponent.of(changed),
TextComponent.of(Math.round(throughput))
));
}

worldEdit.flushBlockBag(actor, editSession);
}
Request.reset();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader;
import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Writer;
import org.enginehub.linbus.stream.LinBinaryIO;
import org.enginehub.linbus.stream.LinReadOptions;
import org.enginehub.linbus.tree.LinCompoundTag;
import org.enginehub.linbus.tree.LinIntTag;
import org.enginehub.linbus.tree.LinRootEntry;
Expand Down Expand Up @@ -58,7 +59,8 @@ public String getPrimaryFileExtension() {
@Override
public ClipboardReader getReader(InputStream inputStream) throws IOException {
return new MCEditSchematicReader(LinBinaryIO.read(
new DataInputStream(new GZIPInputStream(inputStream))
new DataInputStream(new GZIPInputStream(inputStream)),
LEGACY_OPTIONS
));
}

Expand All @@ -72,7 +74,7 @@ public boolean isFormat(InputStream inputStream) {
LinRootEntry rootEntry;
try {
DataInputStream stream = new DataInputStream(new GZIPInputStream(inputStream));
rootEntry = LinBinaryIO.readUsing(stream, LinRootEntry::readFrom);
rootEntry = LinBinaryIO.readUsing(stream, LEGACY_OPTIONS, LinRootEntry::readFrom);
} catch (Exception e) {
return false;
}
Expand All @@ -92,7 +94,7 @@ public String getPrimaryFileExtension() {
@Override
public ClipboardReader getReader(InputStream inputStream) throws IOException {
return new SpongeSchematicV1Reader(LinBinaryIO.read(
new DataInputStream(new GZIPInputStream(inputStream))
new DataInputStream(new GZIPInputStream(inputStream)), LEGACY_OPTIONS
));
}

Expand All @@ -116,7 +118,7 @@ public String getPrimaryFileExtension() {
@Override
public ClipboardReader getReader(InputStream inputStream) throws IOException {
return new SpongeSchematicV2Reader(LinBinaryIO.read(
new DataInputStream(new GZIPInputStream(inputStream))
new DataInputStream(new GZIPInputStream(inputStream)), LEGACY_OPTIONS
));
}

Expand Down Expand Up @@ -175,7 +177,7 @@ private static boolean detectOldSpongeSchematic(InputStream inputStream, int ver
LinRootEntry rootEntry;
try {
DataInputStream stream = new DataInputStream(new GZIPInputStream(inputStream));
rootEntry = LinBinaryIO.readUsing(stream, LinRootEntry::readFrom);
rootEntry = LinBinaryIO.readUsing(stream, LEGACY_OPTIONS, LinRootEntry::readFrom);
} catch (Exception e) {
return false;
}
Expand All @@ -200,6 +202,8 @@ private static boolean detectOldSpongeSchematic(InputStream inputStream, int ver
@Deprecated
public static final BuiltInClipboardFormat SPONGE_SCHEMATIC = SPONGE_V2_SCHEMATIC;

private static final LinReadOptions LEGACY_OPTIONS = LinReadOptions.builder().allowNormalUtf8Encoding(true).build();

private final ImmutableSet<String> aliases;

BuiltInClipboardFormat(String... aliases) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,16 @@ public int hashCode() {
return getWorld().hashCode();
}

@Override
public int getMaxY() {
return getWorld().max().y();
}

@Override
public int getMinY() {
return getWorld().min().y();
}

@Override
public boolean equals(Object o) {
if (o == null) {
Expand Down

0 comments on commit 6191ff7

Please sign in to comment.