Updated LZ4 library
This commit is contained in:
@@ -327,7 +327,7 @@ project(":core"){
|
|||||||
dependencies{
|
dependencies{
|
||||||
compileJava.dependsOn(preGen)
|
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("arc-core")
|
||||||
api arcModule("extensions:flabel")
|
api arcModule("extensions:flabel")
|
||||||
api arcModule("extensions:freetype")
|
api arcModule("extensions:freetype")
|
||||||
|
|||||||
@@ -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){
|
for(var build : previousBuildings){
|
||||||
Tile tile = world.tile(build.tileX(), build.tileY());
|
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)){
|
if(tile != null && tile.build == null && Build.validPlace(build.block, state.rules.defaultTeam, build.tileX(), build.tileY(), build.rotation, false, false)){
|
||||||
|
|||||||
@@ -1112,7 +1112,6 @@ public class Mods implements Loadable{
|
|||||||
/** Loads a mod file+meta, but does not add it to the list.
|
/** Loads a mod file+meta, but does not add it to the list.
|
||||||
* Note that directories can be loaded as mods. */
|
* Note that directories can be loaded as mods. */
|
||||||
private LoadedMod loadMod(Fi sourceFile, boolean overwrite, boolean initialize) throws Exception{
|
private LoadedMod loadMod(Fi sourceFile, boolean overwrite, boolean initialize) throws Exception{
|
||||||
Time.mark();
|
|
||||||
|
|
||||||
ZipFi rootZip = null;
|
ZipFi rootZip = null;
|
||||||
|
|
||||||
@@ -1232,7 +1231,7 @@ public class Mods implements Loadable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!headless && Core.settings.getBool("mod-" + baseName + "-enabled", true)){
|
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);
|
return new LoadedMod(sourceFile, zip, mainMod, loader, meta);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ArcNetProvider implements NetProvider{
|
|||||||
final CopyOnWriteArrayList<ArcConnection> connections = new CopyOnWriteArrayList<>();
|
final CopyOnWriteArrayList<ArcConnection> connections = new CopyOnWriteArrayList<>();
|
||||||
Thread serverThread;
|
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 static final LZ4Compressor compressor = LZ4Factory.fastestInstance().fastCompressor();
|
||||||
|
|
||||||
private volatile int playerLimitCache, packetSpamLimit;
|
private volatile int playerLimitCache, packetSpamLimit;
|
||||||
@@ -439,13 +439,14 @@ public class ArcNetProvider implements NetProvider{
|
|||||||
byteBuffer.position(byteBuffer.position() + buffer.position());
|
byteBuffer.position(byteBuffer.position() + buffer.position());
|
||||||
}else{
|
}else{
|
||||||
//decompress otherwise
|
//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.position(0);
|
||||||
buffer.limit(length);
|
buffer.limit(length);
|
||||||
packet.read(reads.get(), length);
|
packet.read(reads.get(), length);
|
||||||
//move buffer forward based on bytes read by decompressor
|
//move buffer forward based on bytes read by decompressor
|
||||||
byteBuffer.position(byteBuffer.position() + read);
|
byteBuffer.position(byteBuffer.position() + compressedLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
return packet;
|
return packet;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class ContentInfoDialog extends BaseDialog{
|
|||||||
if(contentClass.isAnonymousClass()) contentClass = contentClass.getSuperclass();
|
if(contentClass.isAnonymousClass()) contentClass = contentClass.getSuperclass();
|
||||||
|
|
||||||
Core.app.openURI("https://mindustrygame.github.io/wiki/Modding%20Classes/" + contentClass.getSimpleName());
|
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);
|
content.displayExtra(table);
|
||||||
|
|||||||
Reference in New Issue
Block a user