Support Minecraft 1.21.9: Replace deprecated VERSION_STRING with getCurrentVersion().name() #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for Minecraft 1.21.9 by updating the data generator code to work with API changes introduced in this version.
Changes
API Update
In Minecraft 1.21.9, Mojang removed the deprecated
SharedConstants.VERSION_STRING
constant and it must now be replaced with the dynamic methodSharedConstants.getCurrentVersion().name()
.Before (1.21.8 and earlier):
After (1.21.9):
Files Modified
mc/1.21.9/src/main/java/dev/u9g/minecraftdatagenerator/mixin/ReadyMixin.java
- Updated version string retrievalmc/1.21.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/EntitiesDataGenerator.java
- Code formatting (spotless)mc/1.21.9/src/main/java/dev/u9g/minecraftdatagenerator/generators/RecipeDataGenerator.java
- Import ordering (spotless)Testing
✅ Build passes:
./gradlew :mc:1.21.9:build
✅ Data generation successful:
./gradlew :mc:1.21.9:runServer
✅ All 16 expected data files generated correctly
✅ Server correctly identifies as Minecraft version 1.21.9
Generated data files include: blocks, items, entities, effects, enchantments, recipes, biomes, particles, sounds, materials, foods, instruments, language, tints, attributes, and blockCollisionShapes.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.