From 0f49a82aa7eae583f38eb3770058111cfae8cc52 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 17 Jun 2024 15:56:28 -0400 Subject: [PATCH] fixy fix --- build.gradle.kts | 3 +++ .../client/MultiStateCopycatModelMixin.java | 26 +++++++++++++++++++ src/main/resources/railwaystweaks.mixins.json | 1 + 3 files changed, 30 insertions(+) create mode 100644 src/main/java/dev/ithundxr/railwaystweaks/mixin/client/MultiStateCopycatModelMixin.java diff --git a/build.gradle.kts b/build.gradle.kts index 9d11c04..28974c3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,6 +17,7 @@ repositories { maven("https://maven.jamieswhiteshirt.com/libs-release") // Reach Entity Attributes maven("https://jitpack.io/") // Fabric ASM maven("https://maven.tterrag.com/") // Flywheel + maven("https://api.modrinth.com/maven") } dependencies { @@ -33,6 +34,8 @@ dependencies { modImplementation("net.fabricmc.fabric-api:fabric-api:${"fabric_api_version"()}") modImplementation("com.simibubi.create:create-fabric-${"minecraft_version"()}:${"create_version"()}") + + compileOnly("maven.modrinth:copycats:fabric.1.20.1-1.3.2") { isTransitive = false } } tasks.processResources { diff --git a/src/main/java/dev/ithundxr/railwaystweaks/mixin/client/MultiStateCopycatModelMixin.java b/src/main/java/dev/ithundxr/railwaystweaks/mixin/client/MultiStateCopycatModelMixin.java new file mode 100644 index 0000000..7c4f042 --- /dev/null +++ b/src/main/java/dev/ithundxr/railwaystweaks/mixin/client/MultiStateCopycatModelMixin.java @@ -0,0 +1,26 @@ +package dev.ithundxr.railwaystweaks.mixin.client; + +import com.copycatsplus.copycats.content.copycat.base.model.multistate.fabric.MultiStateCopycatModel; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; + +import java.util.Map; +import java.util.Set; + +@Pseudo +@Mixin(MultiStateCopycatModel.class) +public class MultiStateCopycatModelMixin { + @Unique + private Set> railwaysTweaks$set; + + @WrapOperation(method = "emitBlockQuads", at = @At(value = "INVOKE", target = "Ljava/util/Map;entrySet()Ljava/util/Set;")) + private Set> railwaysTweaks$fixCopycatPlusCME(Map instance, Operation>> original) { + railwaysTweaks$set = original.call(instance); + return railwaysTweaks$set; + } +} diff --git a/src/main/resources/railwaystweaks.mixins.json b/src/main/resources/railwaystweaks.mixins.json index faedc61..ed4a179 100644 --- a/src/main/resources/railwaystweaks.mixins.json +++ b/src/main/resources/railwaystweaks.mixins.json @@ -9,6 +9,7 @@ ], "client": [ "client.HttpTextureMixin", + "client.MultiStateCopycatModelMixin", "client.PlayerRendererMixin" ], "injectors": {