跳到正文

Dynamic Surroundings (Expanded) Mixins

作者:animator70

A Mixin patch mod for Dynamic Surroundings (Expanded) (CurseForge) that fixes its failure to properly recognize tool/weapon sound effects from certain mods on Minecraft Forge 1.20.1.

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Dynamic Surroundings (Expanded) Mixins

A Mixin patch mod for Dynamic Surroundings (Expanded) (CurseForge) that fixes its failure to properly recognize tool/weapon sound effects from certain mods on Minecraft Forge 1.20.1.

Patches are injected at runtime via Mixin.


Core Features

  • Fixes missing switching sounds and sword hum sounds for tools/weapons from mods like Tinkers’ Construct 3.
  • Specifically: lets Dynamic Surroundings correctly classify items as sword / axe / tool… based on item tags (e.g. #minecraft:swords) instead of relying only on class inheritance.

Root Cause

  • Dynamic Surroundings’ ItemLibrary#resolveClassType() determines item type using only instanceof against vanilla item classes — it never uses item tags (#minecraft:swords, etc.).
  • Tinkers’ Construct 3 swords inherit as (roughly):
ModifiableSwordItem → ModifiableItem → TieredItem
  • They are not SwordItem, but TieredItem. Thus:
Mod’s sword Inherits Resolved as Sound
Ice and Fire / Twilight Forest SwordItem SWORD Sword hum plays
Tinkers’ Construct 3 TieredItem TOOL Tool sound; no sword hum
  • So Tinkers’ swords appear silent — they were simply misclassified as tools.

In fact, Dynamic Surroundings already defines these tags (ItemEffectTags.SWORDS, etc., and effects/swords.json mapped to #minecraft:swords / #c:swords) — it just forgot to use them in resolveClassType.


The Fix

A Mixin is injected at the HEAD of ItemLibrary#resolveClassType, applying tag-based classification before the instanceof check (preemptive interception):

  1. When the method is called, the tag check runs first.
  2. Tag matches → setReturnValue returns the correct type immediately; the original instanceof logic is skipped.
  3. No tag match → nothing happens; the original instanceof logic runs unchanged.

Therefore:

  • Vanilla items behave identically (tag result matches instanceof).
  • Items like Tinkers’ (TieredItem but carrying #minecraft:swords) are correctly classified as swords.
  • All other Dynamic Surroundings features (books, potions, ambient/environment, footsteps, etc.) are unaffected.

Extra Patches

  • The original mod’s effects/tools.json omitted #minecraft:pickaxes, so pickaxes weren’t recognized as tools. This mod adds a direct stack.is(ItemTags.PICKAXES) check against the vanilla tag to fix that.
  • The original ItemSwingEffect#tick hard-coded the main hand (getItemInHand(MAIN_HAND)), so off-hand swings couldn’t fetch the off-hand weapon and produced no sword hum. This mod uses @ModifyVariable to instead fetch the item via entity.swingingArm (main-hand behavior unchanged).

Features

  • Fixes tool/weapon switch sounds and sword hum for mods like Tinkers’ Construct 3
  • Mixin-based patching
  • Zero impact on vanilla item behavior
  • Compatible with data/resource packs: add tags like #minecraft:swords to extend classification
  • Client-side only (clientSideOnly)

Dependencies

Dependency Required Notes
Dynamic Surroundings (Expanded) 1.20.1 Required The mod being patched
Architectury API 9.2.14+ Required Dependency of Dynamic Surroundings
Tinkers’ Construct 3 + Mantle Optional (for testing) The target scenario this mod fixes; not required

常见问题

Dynamic Surroundings (Expanded) Mixins 支持哪些 Minecraft 版本?

Dynamic Surroundings (Expanded) Mixins 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

Dynamic Surroundings (Expanded) Mixins 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

animator70 的其他作品

查看全部 →