Refactor to dynamic version detection, remove NMS modules and Wrapper classes#87
Conversation
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
|
@copilot remove ParticleWrapper, TextureWrapper (already have mob head config) , all the Wrapper. Also wirte a full mob head config file (mob_heads.yml) information can be found in the older commit |
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Done! I've removed all Wrapper classes (ParticleWrapper, TextureWrapper, MaterialWrapper, SpawnerWrapper) and expanded mob_heads.yml with complete texture information for all 70+ mobs from the old commits. Changes in commit 1b817cf:
The mob_heads.yml now contains the complete texture hash for each mob (not Base64 encoded) so it can be directly used with the textures.minecraft.net URL. |
Removes version-specific NMS modules (v1_21, v1_21_4, v1_21_6) and hard-coded material/entity mappings. Implements dynamic detection that adapts to any Minecraft 1.21+ version at runtime. Adds comprehensive player-configurable mob head textures via YAML.
Changes
New Dynamic Detection System
DynamicMaterialDetector- Auto-detects head/skull materials fromMaterial.values()using stream filtersDynamicEntityValidator- Validates spawnable entities, excludes PLAYERMobHeadConfig- Manages completemob_heads.ymlwith 70+ mob texturesRemoved Wrapper Classes
MaterialWrapper- Replaced with directMaterial.valueOf()callsTextureWrapper- Replaced withMobHeadConfigdirect integrationParticleWrapper- Replaced with directParticleenum usageSpawnerWrapper- Replaced withDynamicEntityValidatorSimplified Version Handling
VersionInitializer- Reduced from 126 to 25 lines, removed reflection-based initialization and wrapper callscore/build.gradleandsettings.gradleto remove module dependenciesComplete Mob Head Configuration
mob_heads.yml- Comprehensive configuration with all Minecraft mobs including:Configuration Example
Impact
Original prompt
Refactor the SmartSpawner plugin to remove version-specific modules and hard-coded materials, implementing a dynamic detection system with player-configurable mob head textures.
🎯 OBJECTIVES
1. Remove Deprecated Modules
MaterialInitializer,ParticleInitializer,SpawnerInitializer,TextureInitializerv1_21,v1_21_4,v1_21_6VersionInitializerfor future compatibilitycore/build.gradleto remove deleted module references injartask2. Create Dynamic Material Detection System
File:
core/src/main/java/com/example/smartspawner/util/DynamicMaterialDetector.java3. Create Dynamic Entity Type Validator
File:
core/src/main/java/com/example/smartspawner/util/DynamicEntityValidator.java4. Player-Configurable Mob Head Textures
File:
core/src/main/resources/mob_heads.yml5. Update Gradle Build Configuration
File:
core/build.gradle- Updatejartask:jar { archiveBaseName.set("SmartSpawner") archiveVersion.set("${version}") from { project(':api').sourceSets.main.output } // REMOVED: v1_21, v1_21_4, v1_21_6 modules from sourceSets.main.output duplicatesStrategy = DuplicatesStrategy.EXCLUDE exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' }6. Update SpawnerMenuAction
Replace hard-coded
SPAWNER_INFO_MATERIALSwith dynamic detection:✅ ACCEPTANCE CRITERIA
...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.