Dynamic Surroundings (Expanded) Mixins

Quick rating

Community listing page, reviews may not be monitored by the author.

Dynamic Surroundings (Expanded) Mixins

No reviews yet

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.

Mod Loaders
Minecraft

About

Description

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