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 onlyinstanceofagainst 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, butTieredItem. 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., andeffects/swords.jsonmapped to#minecraft:swords/#c:swords) — it just forgot to use them inresolveClassType.
The Fix
A Mixin is injected at the HEAD of ItemLibrary#resolveClassType, applying tag-based classification before the instanceof check (preemptive interception):
- When the method is called, the tag check runs first.
- Tag matches →
setReturnValuereturns the correct type immediately; the originalinstanceoflogic is skipped. - No tag match → nothing happens; the original
instanceoflogic runs unchanged.
Therefore:
- Vanilla items behave identically (tag result matches
instanceof). - Items like Tinkers' (
TieredItembut 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.jsonomitted#minecraft:pickaxes, so pickaxes weren't recognized as tools. This mod adds a directstack.is(ItemTags.PICKAXES)check against the vanilla tag to fix that. - The original
ItemSwingEffect#tickhard-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@ModifyVariableto instead fetch the item viaentity.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:swordsto 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 |

