修正沒有正確使用mixin問題

This commit is contained in:
叁玖领域 2026-01-15 15:45:48 +08:00
parent 53d7cf145e
commit ea753c4f7d
14 changed files with 41 additions and 22 deletions

View File

@ -131,6 +131,13 @@ mixin {
add sourceSets.main, "${mod_id}.refmap.json"
config "${mod_id}.mixins.json"
}
jar {
manifest.attributes([
"MixinConfigs": "${mod_id}.mixins.json"
])
}
dependencies {
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}

View File

@ -33,7 +33,7 @@ mod_name=3944Realms 's Lib Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=0.1.4
mod_version=0.1.5
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -1,2 +1,2 @@
// 1.20.1 2026-01-02T21:20:53.7969072 Languages: zh_tw
79fece6715632a6fe3df3d0c666c7f428cc97dad assets/lib39/lang/zh_tw.json
// 1.20.1 2026-01-15T15:44:47.1536248 Languages: zh_tw
6d602ad25d759a9ba000c70138fb5e5090ac6657 assets/lib39/lang/zh_tw.json

View File

@ -1,2 +1,2 @@
// 1.20.1 2026-01-02T21:20:53.7939092 Languages: zh_cn
3ea1846920a8b807e45cd160c1aeeb483cadb202 assets/lib39/lang/zh_cn.json
// 1.20.1 2026-01-15T15:44:47.1536248 Languages: zh_cn
1d2d816efcddaf84eced9ad85f1efeba650843e7 assets/lib39/lang/zh_cn.json

View File

@ -1,2 +1,2 @@
// 1.20.1 2026-01-02T21:20:53.7969072 Languages: lzh
3d0e4dde6733bcf76f908f01d54ebbd8b840e07c assets/lib39/lang/lzh.json
// 1.20.1 2026-01-15T15:44:47.1536248 Languages: lzh
7540c6cec408f79a64dce3d60997e54cbf833035 assets/lib39/lang/lzh.json

View File

@ -1,2 +1,2 @@
// 1.20.1 2026-01-02T21:20:53.7959072 Languages: en_us
4e6a2291b5064949b18583735a1e31599b4db2e8 assets/lib39/lang/en_us.json
// 1.20.1 2026-01-15T15:44:47.1536248 Languages: en_us
1b6024d50222f8672f22c27645fc035cce0f7a1c assets/lib39/lang/en_us.json

View File

@ -54,6 +54,7 @@
"item.lib39.fabric": "Fabric",
"item.lib39.forge": "Forge",
"item.lib39.neoforge": "NeoForge",
"sound.lib39.duck_doll": "Duck Doll Sound",
"tooltip.lib39.content.doll.hover.1": "§eSkinOwner §7:§a %s ",
"tooltip.lib39.content.doll.hover.2": "§7Rename with a player name in an anvil to change skin"
}

View File

@ -54,6 +54,7 @@
"item.lib39.fabric": "織",
"item.lib39.forge": "砧",
"item.lib39.neoforge": "狸",
"sound.lib39.duck_doll": "偶音",
"tooltip.lib39.content.doll.hover.1": "§e膚主§7:§a%s",
"tooltip.lib39.content.doll.hover.2": "§7鐵砧之上更名以易膚"
}

View File

@ -54,6 +54,7 @@
"item.lib39.fabric": "织布",
"item.lib39.forge": "铁砧",
"item.lib39.neoforge": "小狐狸",
"sound.lib39.duck_doll": "玩偶声音",
"tooltip.lib39.content.doll.hover.1": "§e皮肤所有者§7:§a%s",
"tooltip.lib39.content.doll.hover.2": "§7在铁砧上可通过重命名对应玩家名来改变皮肤"
}

View File

@ -54,6 +54,7 @@
"item.lib39.fabric": "織布",
"item.lib39.forge": "铁砧",
"item.lib39.neoforge": "狐狸",
"sound.lib39.duck_doll": "玩偶聲音",
"tooltip.lib39.content.doll.hover.1": "§e皮膚所有者§7:§a%s",
"tooltip.lib39.content.doll.hover.2": "§7在鐵砧上可通過重命名對應玩家名來改變皮膚"
}

View File

@ -115,6 +115,17 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
true
)
);
public static final LangKeyValue DOLL_SOUND = addAndRet(
LangKeyValue.ofKey(
ModPartEnum.SOUND.getFullKey(Lib39.MOD_ID, "duck_doll"), ModPartEnum.SOUND,
"Duck Doll Sound",
"玩偶声音",
"玩偶聲音",
"偶音",
true
)
);
/**
* The constant HELP_SUBCOMMANDS_TITLE.

View File

@ -12,6 +12,7 @@
package top.r3944realms.lib39.mixin;
import com.llamalad7.mixinextras.MixinExtrasBootstrap;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
@ -23,9 +24,8 @@ import java.util.Set;
* The type Lib 39 mixin plugin.
*/
public class Lib39MixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {
MixinExtrasBootstrap.init();
}
@Override
@ -35,26 +35,23 @@ public class Lib39MixinPlugin implements IMixinConfigPlugin {
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return true; // 改为 true 允许所有 mixin
return true;
}
@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
}
@Override
public List<String> getMixins() {
return null; // 改为 null 表示不使用动态注册
return null;
}
@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
}

View File

@ -4,6 +4,7 @@ import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Debug;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.At;
@ -22,10 +23,9 @@ public class MixinCarriedObjectRender {
@ModifyVariable(
method = "drawFirstPersonBlock",
at = @At(
value = "INVOKE",
value = "LOAD",
target = "Ltschipp/carryon/client/render/CarryRenderHelper;renderBakedModel(Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/resources/model/BakedModel;)V"
),
name = "stack"
)
)
private static ItemStack warpDollItem$1(ItemStack stack, @Local(ordinal = 0, argsOnly = true) Player player) {
if (stack.getItem() instanceof DollItem) {
@ -37,10 +37,9 @@ public class MixinCarriedObjectRender {
@ModifyVariable(
method = "drawThirdPerson",
at = @At(
value = "INVOKE",
value = "LOAD",
target = "Ltschipp/carryon/client/render/CarryRenderHelper;renderBakedModel(Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/resources/model/BakedModel;)V"
),
name = "tileItem"
)
)
private static ItemStack warpDollItem$2(ItemStack stack, @Local(ordinal = 0) Player player) {
if (stack.getItem() instanceof DollItem) {

View File

@ -2,6 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "top.r3944realms.lib39.mixin",
"plugin": "top.r3944realms.lib39.mixin.Lib39MixinPlugin",
"compatibilityLevel": "JAVA_17",
"refmap": "lib39.refmap.json",
"mixins": [