diff --git a/build.gradle b/build.gradle index 8d8d7c3..e86a716 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,8 @@ plugins { alias libs.plugins.loom } -version = "$project.baseVersion+$project.branch" -archivesBaseName = project.archivesName +version = "$baseVersion+$branch" +archivesBaseName = project.slug repositories { maven { url "https://api.modrinth.com/maven" } @@ -23,6 +23,7 @@ dependencies { mappings variantOf(libs.yarn) { classifier "v2" } modImplementation libs.fl modImplementation libs.fapi + modImplementation libs.sodium modImplementation libs.nettyIoUringClasses @@ -43,18 +44,20 @@ processResources { modId : modId, modName : modName, modDescription: modDescription, - homepage : homepage, - issues : issues, - sources : sources, + homepage : "https://modrinth.com/mod/${slug}", + issues : "https://github.com/${user}/${slug}/issues", + sources : "https://github.com/${user}/${slug}", license : license, authors : authors.split(", ").join("\",\n \""), contributors : contributors.split(", ").join("\",\n \""), - mc : libs.versions.mc.get(), + members : "${authors}. Contributions by ${contributors}", + mc : compatibleVersions.split(", ")[0], fl : libs.versions.fl.get(), fapi : libs.versions.fapi.get() ] - inputs.properties meta - filesMatching("fabric.mod.json") { expand meta } + inputs.properties(meta) + filesMatching("*.mod.json") { expand(meta) } + filesMatching("META-INF/*mods.toml") { expand(meta) } } tasks.withType(JavaCompile).configureEach { @@ -63,7 +66,7 @@ tasks.withType(JavaCompile).configureEach { } loom { - accessWidenerPath = file("src/main/resources/fireblanket.aw") + accessWidenerPath = file("src/main/resources/fireblanket.accesswidener") } sourceSets { @@ -77,12 +80,13 @@ sourceSets { java { withSourcesJar() - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { from("LICENSE") { - rename { "${it}_${project.base.archivesName.get()}" } + rename { "${it}_${archivesBaseName}" } } configurations.shade.resolve().each { diff --git a/gradle.properties b/gradle.properties index cc06cf7..687b750 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,17 +7,19 @@ org.gradle.configureondemand=true # Loom fabric.loom.multiProjectOptimisation=true # Mod Metadata -archivesName=fireblanket group=net.modfest +user=ModFest +slug=fireblanket modId=fireblanket modName=Fireblanket modDescription=Performance, bugfixes, and utilities for ModFest events. authors=jaskarth, unascribed contributors=Patbox, IThundxr -homepage=https://modrinth.com/mod/fireblanket -issues=https://github.com/modfest/fireblanket/issues -sources=https://github.com/modfest/fireblanket license=AGPL-3.0-or-later # Mod Version -baseVersion=0.5.4 +baseVersion=0.5.5 +# Branch Metadata branch=1.21 +tagBranch=1.21 +compatibleVersions=1.21, 1.21.1 +compatibleLoaders=fabric, quilt, neoforge diff --git a/settings.gradle b/settings.gradle index 593ea78..dce0b1d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ pluginManagement { repositories { - maven { url 'https://maven.fabricmc.net/' } + maven { url "https://maven.fabricmc.net/" } gradlePluginPortal() } } diff --git a/src/main/java/net/modfest/fireblanket/FireblanketMixin.java b/src/main/java/net/modfest/fireblanket/FireblanketMixin.java index 17c78ab..6513d9d 100644 --- a/src/main/java/net/modfest/fireblanket/FireblanketMixin.java +++ b/src/main/java/net/modfest/fireblanket/FireblanketMixin.java @@ -17,6 +17,7 @@ public class FireblanketMixin implements IMixinConfigPlugin { public static final boolean ALLOW_LAMBDAMAP_SAVING = Boolean.getBoolean("fireblanket.allowLambdaMapSaving"); private static final boolean DO_CHUNKSECTION_OPTO = Boolean.getBoolean("fireblanket.flattenChunkPalettes"); public static final boolean ALLOW_FOOTGUNS = Boolean.getBoolean("fireblanket.allowFootguns"); + public static final boolean AVOID_ZTSD = Boolean.getBoolean("fireblanket.saveAsDat"); @Override public void onLoad(String mixinPackage) { @@ -116,6 +117,14 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { return !ALLOW_FOOTGUNS; } + if (mixinClassName.contains("footgun")) { + return !ALLOW_FOOTGUNS; + } + + if (mixinClassName.contains("MixinRegionFile") || mixinClassName.contains("MixinPersistentState") || mixinClassName.contains("MixinLevelStorageSession")) { + return !AVOID_ZTSD; + } + // Conflicts with Krypton, which also lifts the limit return !mixinClassName.contains("SplitterHandler") || !FabricLoader.getInstance().isModLoaded("krypton"); } diff --git a/src/main/java/net/modfest/fireblanket/mixin/zstd/MixinPersistentState.java b/src/main/java/net/modfest/fireblanket/mixin/zstd/MixinPersistentState.java index dfe632d..8fd1ef0 100644 --- a/src/main/java/net/modfest/fireblanket/mixin/zstd/MixinPersistentState.java +++ b/src/main/java/net/modfest/fireblanket/mixin/zstd/MixinPersistentState.java @@ -1,6 +1,8 @@ package net.modfest.fireblanket.mixin.zstd; import com.github.luben.zstd.ZstdOutputStream; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtIo; import net.minecraft.world.PersistentState; @@ -17,10 +19,8 @@ @Mixin(PersistentState.class) public class MixinPersistentState { - - @Redirect(at = @At(value = "INVOKE", target = "net/minecraft/nbt/NbtIo.writeCompressed(Lnet/minecraft/nbt/NbtCompound;Ljava/nio/file/Path;)V"), - method = "save") - public void fireblanket$writeZstd(NbtCompound nbt, Path vanilla) throws IOException { + @WrapOperation(at = @At(value = "INVOKE", target = "net/minecraft/nbt/NbtIo.writeCompressed(Lnet/minecraft/nbt/NbtCompound;Ljava/nio/file/Path;)V"), method = "save") + public void fireblanket$writeZstd(NbtCompound nbt, Path vanilla, Operation original) throws IOException { String path = vanilla.toAbsolutePath().toString(); if (path.endsWith(".dat")) { File zstd = new File(path.substring(0, path.length() - 4) + ".zat"); @@ -33,8 +33,7 @@ public class MixinPersistentState { Files.deleteIfExists(vanilla); } else { // oookay, I dunno what you want. have fun. - NbtIo.writeCompressed(nbt, vanilla); + original.call(nbt, vanilla); } } - } diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..29344ad --- /dev/null +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,44 @@ +modLoader = "javafml" +loaderVersion = "[4,)" +license = "${license}" +issueTrackerURL = "${issues}" + +[[mods]] +modId = "${modId}" +version = "${version}" +displayName = "${modName}" +description = '''${modDescription}''' +authors = "${members}" +displayURL = "${homepage}" +logoFile = "assets/${modId}/icon.png" + +[properties] +"connector:placeholder" = true + +[[dependencies.${ modId }]] +modId = "connector" +type = "required" +versionRange = "*" +ordering = "NONE" +side = "BOTH" + +[[dependencies.${ modId }]] +modId = "neoforge" +type = "required" +versionRange = "*" +ordering = "NONE" +side = "BOTH" + +[[dependencies.${ modId }]] +modId = "minecraft" +type = "required" +versionRange = "[${mc},)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.${ modId }]] +modId = "fabric_api" +type = "required" +versionRange = "[${fapi},)" +ordering = "NONE" +side = "BOTH" diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 05e34bf..a11670e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -16,7 +16,16 @@ "sources": "${sources}" }, "license": "${license}", - "icon": "assets/fireblanket/icon.png", + "icon": "assets/${modId}/icon.png", + "accessWidener": "${modId}.accesswidener", + "mixins": [ + "${modId}.mixins.json" + ], + "depends": { + "minecraft": ">=${mc}", + "fabricloader": ">=${fl}", + "fabric-api": ">=${fapi}" + }, "entrypoints": { "main": [ "net.modfest.fireblanket.Fireblanket" @@ -24,14 +33,5 @@ "client": [ "net.modfest.fireblanket.FireblanketClient" ] - }, - "mixins": [ - "fireblanket.mixins.json" - ], - "accessWidener": "fireblanket.aw", - "depends": { - "minecraft": ">=${mc}", - "fabricloader": ">=${fl}", - "fabric-api": ">=${fapi}" } } diff --git a/src/main/resources/fireblanket.aw b/src/main/resources/fireblanket.accesswidener similarity index 91% rename from src/main/resources/fireblanket.aw rename to src/main/resources/fireblanket.accesswidener index 6d91b71..a1dd7a1 100644 --- a/src/main/resources/fireblanket.aw +++ b/src/main/resources/fireblanket.accesswidener @@ -1,7 +1,6 @@ -accessWidener v1 named +accessWidener v2 named accessible class net/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask -#accessible class net/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask$RenderData accessible class net/minecraft/server/world/ServerChunkManager$MainThreadExecutor accessible method net/minecraft/server/world/ServerChunkLoadingManager entryIterator ()Ljava/lang/Iterable;