From 3c3b2dd7f169eb8c67b755f4abd7135d73e37c52 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 23 Dec 2025 21:28:13 -0500 Subject: [PATCH] Updated LZ4 library --- build.gradle | 2 +- core/src/mindustry/core/Control.java | 2 +- core/src/mindustry/mod/Mods.java | 3 +-- core/src/mindustry/net/ArcNetProvider.java | 7 ++++--- core/src/mindustry/ui/dialogs/ContentInfoDialog.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 6ee53a65c2..2285fad3e3 100644 --- a/build.gradle +++ b/build.gradle @@ -327,7 +327,7 @@ project(":core"){ dependencies{ compileJava.dependsOn(preGen) - api "org.lz4:lz4-java:1.8.0" + api "at.yawk.lz4:lz4-java:1.10.2" api arcModule("arc-core") api arcModule("extensions:flabel") api arcModule("extensions:freetype") diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 432b681e0e..55a4abb2ef 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -503,7 +503,7 @@ public class Control implements ApplicationListener, Loadable{ } } - //copy over all buildings from the previous save, retaining config and health, and making them derelict. contents are not saved (derelict repair clears them anyway) + //copy over all buildings from the previous save, retaining config and health, and making them derelict for(var build : previousBuildings){ Tile tile = world.tile(build.tileX(), build.tileY()); if(tile != null && tile.build == null && Build.validPlace(build.block, state.rules.defaultTeam, build.tileX(), build.tileY(), build.rotation, false, false)){ diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 766eae0f6f..d5966b65ba 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -1112,7 +1112,6 @@ public class Mods implements Loadable{ /** Loads a mod file+meta, but does not add it to the list. * Note that directories can be loaded as mods. */ private LoadedMod loadMod(Fi sourceFile, boolean overwrite, boolean initialize) throws Exception{ - Time.mark(); ZipFi rootZip = null; @@ -1232,7 +1231,7 @@ public class Mods implements Loadable{ } if(!headless && Core.settings.getBool("mod-" + baseName + "-enabled", true)){ - Log.info("Loaded mod '@' in @ms", meta.name, Time.elapsed()); + Log.info("Loading mod: @", meta.name); } return new LoadedMod(sourceFile, zip, mainMod, loader, meta); diff --git a/core/src/mindustry/net/ArcNetProvider.java b/core/src/mindustry/net/ArcNetProvider.java index dde8aba760..4051453c38 100644 --- a/core/src/mindustry/net/ArcNetProvider.java +++ b/core/src/mindustry/net/ArcNetProvider.java @@ -34,7 +34,7 @@ public class ArcNetProvider implements NetProvider{ final CopyOnWriteArrayList connections = new CopyOnWriteArrayList<>(); Thread serverThread; - private static final LZ4FastDecompressor decompressor = LZ4Factory.fastestInstance().fastDecompressor(); + private static final LZ4SafeDecompressor decompressor = LZ4Factory.fastestInstance().safeDecompressor(); private static final LZ4Compressor compressor = LZ4Factory.fastestInstance().fastCompressor(); private volatile int playerLimitCache, packetSpamLimit; @@ -439,13 +439,14 @@ public class ArcNetProvider implements NetProvider{ byteBuffer.position(byteBuffer.position() + buffer.position()); }else{ //decompress otherwise - int read = decompressor.decompress(byteBuffer, byteBuffer.position(), buffer, 0, length); + int compressedLength = byteBuffer.limit() - byteBuffer.position(); + decompressor.decompress(byteBuffer, byteBuffer.position(), compressedLength, buffer, 0, length); buffer.position(0); buffer.limit(length); packet.read(reads.get(), length); //move buffer forward based on bytes read by decompressor - byteBuffer.position(byteBuffer.position() + read); + byteBuffer.position(byteBuffer.position() + compressedLength); } return packet; diff --git a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java index d19bebacb0..c32316d745 100644 --- a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java +++ b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java @@ -100,7 +100,7 @@ public class ContentInfoDialog extends BaseDialog{ if(contentClass.isAnonymousClass()) contentClass = contentClass.getSuperclass(); Core.app.openURI("https://mindustrygame.github.io/wiki/Modding%20Classes/" + contentClass.getSimpleName()); - }).margin(8f).pad(4f).size(300f, 50f).row(); + }).margin(8f).pad(4f).padTop(8f).size(300f, 50f).row(); } content.displayExtra(table);