From 928f6a45017df8aeb467e6879b350ade89c73d9a Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sat, 26 Oct 2024 18:37:15 +0200 Subject: Isolate Wildfire Female Gender Mod Support [no changelog] --- build.gradle.kts | 4 +-- docs/Texture Pack Format.md | 2 +- .../PatchArmorTexturesInGenderMod.java | 37 +++++++++++++++++++++ .../PatchArmorTexturesInGenderMod.java | 38 ---------------------- src/main/kotlin/Firmament.kt | 3 ++ 5 files changed, 43 insertions(+), 41 deletions(-) create mode 100644 src/compat/wildfireGender/java/moe/nea/firmament/mixins/compat/wildfiregender/PatchArmorTexturesInGenderMod.java delete mode 100644 src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java diff --git a/build.gradle.kts b/build.gradle.kts index cca7fda..31952d6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -183,6 +183,7 @@ val sodiumSourceSet = createIsolatedSourceSet("sodium") val citResewnSourceSet = createIsolatedSourceSet("citresewn") val yaclSourceSet = createIsolatedSourceSet("yacl") val explosiveEnhancementSourceSet = createIsolatedSourceSet("explosiveEnhancement") +val wildfireGenderSourceSet = createIsolatedSourceSet("wildfireGender") dependencies { // Minecraft dependencies @@ -222,7 +223,7 @@ dependencies { modCompileOnly(libs.jarvis.api) include(libs.jarvis.fabric) - modCompileOnly(libs.femalegender) + (wildfireGenderSourceSet.modImplementationConfigurationName)(libs.femalegender) (configuredSourceSet.modImplementationConfigurationName)(libs.configured) (sodiumSourceSet.modImplementationConfigurationName)(libs.sodium) @@ -239,7 +240,6 @@ dependencies { nonModImplentation(libs.repoparser) shadowMe(libs.repoparser) fun ktor(mod: String) = "io.ktor:ktor-$mod-jvm:${libs.versions.ktor.get()}" - modCompileOnly(libs.citresewn) transInclude(nonModImplentation(ktor("client-core"))!!) transInclude(nonModImplentation(ktor("client-java"))!!) transInclude(nonModImplentation(ktor("serialization-kotlinx-json"))!!) diff --git a/docs/Texture Pack Format.md b/docs/Texture Pack Format.md index 9d61ce0..23dd7a1 100644 --- a/docs/Texture Pack Format.md +++ b/docs/Texture Pack Format.md @@ -21,7 +21,7 @@ Find the texture id of a skull. This is the hash part of an url like `https://textures.minecraft.net/texture/bc8ea1f51f253ff5142ca11ae45193a4ad8c3ab5e9c6eec8ba7a4fcb7bac40` (so after the /texture/). You can find it in game for placed skulls using the keybinding in the Power User Config. Then place the replacement texture at `firmskyblock:textures/placedskulls/.png`. Keep in mind that you will probably replace -the texture with another skin texture, meaning that skin texture has it's own hash. Do not mix those up, you need to use +the texture with another skin texture, meaning that skin texture has its own hash. Do not mix those up, you need to use the hash of the old skin. ## Armor Skull Models diff --git a/src/compat/wildfireGender/java/moe/nea/firmament/mixins/compat/wildfiregender/PatchArmorTexturesInGenderMod.java b/src/compat/wildfireGender/java/moe/nea/firmament/mixins/compat/wildfiregender/PatchArmorTexturesInGenderMod.java new file mode 100644 index 0000000..723af59 --- /dev/null +++ b/src/compat/wildfireGender/java/moe/nea/firmament/mixins/compat/wildfiregender/PatchArmorTexturesInGenderMod.java @@ -0,0 +1,37 @@ +package moe.nea.firmament.mixins.compat.wildfiregender; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; +import com.wildfire.render.GenderArmorLayer; +import moe.nea.firmament.features.texturepack.CustomGlobalArmorOverrides; +import net.minecraft.item.ArmorItem; +import net.minecraft.item.ArmorMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.entry.RegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(GenderArmorLayer.class) +@Pseudo +public class PatchArmorTexturesInGenderMod { + @WrapOperation(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", + at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ArmorItem;getMaterial()Lnet/minecraft/registry/entry/RegistryEntry;")) + private RegistryEntry replaceArmorMaterial(ArmorItem instance, Operation> original, @Local ItemStack chestplate) { + var entry = original.call(instance); + var overrides = CustomGlobalArmorOverrides.overrideArmor(chestplate); + if (overrides == null) + return entry; + var material = entry.value(); + return RegistryEntry.of(new ArmorMaterial( + material.defense(), + material.enchantability(), + material.equipSound(), + material.repairIngredient(), + overrides, + material.toughness(), + material.knockbackResistance() + )); + } +} diff --git a/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java b/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java deleted file mode 100644 index 68b07c1..0000000 --- a/src/main/java/moe/nea/firmament/mixins/custommodels/PatchArmorTexturesInGenderMod.java +++ /dev/null @@ -1,38 +0,0 @@ - -package moe.nea.firmament.mixins.custommodels; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.llamalad7.mixinextras.sugar.Local; -import com.wildfire.render.GenderArmorLayer; -import moe.nea.firmament.features.texturepack.CustomGlobalArmorOverrides; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.ArmorMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.entry.RegistryEntry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Pseudo; -import org.spongepowered.asm.mixin.injection.At; - -@Mixin(GenderArmorLayer.class) -@Pseudo -public class PatchArmorTexturesInGenderMod { - @WrapOperation(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ArmorItem;getMaterial()Lnet/minecraft/registry/entry/RegistryEntry;")) - private RegistryEntry replaceArmorMaterial(ArmorItem instance, Operation> original, @Local ItemStack chestplate) { - var entry = original.call(instance); - var overrides = CustomGlobalArmorOverrides.overrideArmor(chestplate); - if (overrides == null) - return entry; - var material = entry.value(); - return RegistryEntry.of(new ArmorMaterial( - material.defense(), - material.enchantability(), - material.equipSound(), - material.repairIngredient(), - overrides, - material.toughness(), - material.knockbackResistance() - )); - } -} diff --git a/src/main/kotlin/Firmament.kt b/src/main/kotlin/Firmament.kt index d8a309b..e0541f1 100644 --- a/src/main/kotlin/Firmament.kt +++ b/src/main/kotlin/Firmament.kt @@ -28,6 +28,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.plus +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.json.decodeFromStream import kotlin.coroutines.EmptyCoroutineContext @@ -59,9 +60,11 @@ object Firmament { } val version: Version by lazy { metadata.version } + @OptIn(ExperimentalSerializationApi::class) val json = Json { prettyPrint = DEBUG isLenient = true + allowTrailingComma = true ignoreUnknownKeys = true encodeDefaults = true } -- cgit