Closed Codestech1 closed 1 year ago
that program is written in rust and practically impossible to integrate
From: HEROOSTECH @.> Sent: Tuesday, October 11, 2022 8:31:47 PM To: unnamed/creative @.> Cc: Subscribed @.***> Subject: [unnamed/creative] Anti-Unzip and better compressing (Issue #6)
If you can - please make this in this library https://github.com/ComunidadAylas/PackSquash
— Reply to this email directly, view it on GitHubhttps://github.com/unnamed/creative/issues/6, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXCAPNI27SERZFQ4J4JCYNDWCWQAHANCNFSM6AAAAAARCQJWEI. You are receiving this because you are subscribed to this thread.Message ID: @.***>
that program is written in rust and practically impossible to integrate … ____ From: HEROOSTECH @.> Sent: Tuesday, October 11, 2022 8:31:47 PM To: unnamed/creative @.> Cc: Subscribed @.> Subject: [unnamed/creative] Anti-Unzip and better compressing (Issue #6) If you can - please make this in this library https://github.com/ComunidadAylas/PackSquash — Reply to this email directly, view it on GitHub<#6>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXCAPNI27SERZFQ4J4JCYNDWCWQAHANCNFSM6AAAAAARCQJWEI. You are receiving this because you are subscribed to this thread.Message ID: @.>
It's not impossible since JVM allow you to write native code, so, you can execute Rust code but it's a very bad idea.
Just look to code and port this to java. ItemsAdder spigot plugin made this. I can help if you want. (I can't rust)
Just look to code and port this to java. ItemsAdder spigot plugin made this. I can help if you want. (I can't rust)
it isnt as easy as "just looking at the code", especially when itemsadder is closed-source+paid and the program you provided is in rust. Compression of the zip that creative makes is a valid concern, but it would be somewhat complicated to implement, and as the maintainer of creative hasnt worked on the project for a while, all you can really do right now is to implement it yourself and make a pull request
Oraxen has done the simplest of resource pack protections as seen here. Can be done by playing around with Javas default zip utils.
zipEntry.setCrc(bytes.length);
zipEntry.setSize(new BigInteger(bytes).mod(BigInteger.valueOf(Long.MAX_VALUE)).longValue());
"Protection" can now be done using the new ZipEntryLifecycleHandler
, part of the serializer-minecraft
subproject (Protection code inspired on Oraxen, only included in this example)
class ProtectingZipEntryLifecycleHandler implements ZipEntryLifecycleHandler {
private final Random random = new Random();
@Override
public ZipEntry create(String path) {
return ZipEntryLifecycleHandler.DEFAULT.create(path);
}
@Override
public void onClose(ZipEntry entry) {
// from Oraxen
byte[] bytes = new byte[1024];
random.nextBytes(bytes);
entry.setCrc(bytes.length);
entry.setSize(new BigInteger(bytes).mod(BigInteger.valueOf(Long.MAX_VALUE)).longValue());;
}
}
And then using it when you create a FileTreeWriter
try (FileTreeWriter writer = FileTreeWriter.zip(
new ZipOutputStream(...),
new ProtectingZipEntryLifecycleHandler()
)) {
...
}
Compressing is already done for most resources. Users can minify Texture
and Sound
too by using some library like pngtastic
for textures and another library for sounds (OGGS), maybe port one to Java?
If you can - please make this in this library https://github.com/ComunidadAylas/PackSquash