Fabric 1.21.10 support + Mojang mappings migration (AI made)#120
Fabric 1.21.10 support + Mojang mappings migration (AI made)#120Darker935 wants to merge 15 commits intoalphaqu:mainfrom
Conversation
Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
Systematically migrate all Java source files and the access widener: Import/package renames: - net.minecraft.client.MinecraftClient → net.minecraft.client.Minecraft - net.minecraft.util.Identifier → net.minecraft.resources.ResourceLocation - net.minecraft.client.texture.* → net.minecraft.client.renderer.texture.* (NativeImage exception: → com.mojang.blaze3d.platform.NativeImage) - net.minecraft.client.render.model.* → net.minecraft.client.renderer.block.model.* - net.minecraft.client.render.model.json.* → net.minecraft.client.renderer.block.model.* - net.minecraft.client.font.* → net.minecraft.client.gui.font.* - net.minecraft.client.render.RenderLayer → net.minecraft.client.renderer.RenderType - net.minecraft.client.render.VertexConsumer → com.mojang.blaze3d.vertex.VertexConsumer - net.minecraft.resource.* → net.minecraft.server.packs.resources.* - net.minecraft.client.gui.screen.* → net.minecraft.client.gui.screens.* - net.minecraft.client.toast.* → net.minecraft.client.gui.components.toasts.* - net.minecraft.client.gui.widget.* → net.minecraft.client.gui.components.* - net.minecraft.util.math.* → net.minecraft.core.* / net.minecraft.util.* - net.minecraft.block.* → net.minecraft.world.level.block.* - net.minecraft.state.* → net.minecraft.world.level.block.state.* - net.minecraft.text.Text → net.minecraft.network.chat.Component - net.minecraft.Bootstrap → net.minecraft.server.Bootstrap - net.minecraft.registry.Registries → net.minecraft.core.registries.BuiltInRegistries - net.minecraft.util.math.AffineTransformation → com.mojang.math.Transformation Class name renames: - MinecraftClient → Minecraft, Identifier → ResourceLocation - Sprite → TextureAtlasSprite, BasicBakedModel → SimpleBakedModel - ModelTransformation → ItemTransforms, Transformation → ItemTransform - MultipartBakedModel → MultiPartBakedModel, MipmapHelper → MipmapGenerator - ModelIdentifier → ModelResourceLocation, TextureStitcher → Stitcher - DrawContext → GuiGraphics, SplashOverlay → SplashScreen - ToastManager → ToastComponent, ButtonWidget → Button, TextWidget → StringWidget - WallShape → WallSide, StateManager → StateDefinition, MathHelper → Mth - Text → Component, Waterloggable → SimpleWaterloggedBlock - ZipResourcePack → FilePackResources, Profiler → ProfilerFiller - ResourceFinder → ResourceProvider, Random (MC) → RandomSource - SpriteGetter → Function<ResourceLocation, TextureAtlasSprite> (TODO: verify) - AffineTransformation → Transformation (com.mojang.math) - Registries → BuiltInRegistries (code usage), getStateManager() → getStateDefinition() - TextRenderer → Font (Mojang name for net.minecraft.client.gui.Font) Inner class renames: - SpriteContents.Animation → SpriteContents.AnimatedTexture - SpriteContents.AnimationFrame → SpriteContents.FrameInfo Mixin @Inject/@reDIrect target strings updated to Mojang internal class paths. Access widener updated with Mojang class paths and # comment style for uncertain names. Uncertain mappings are marked with // TODO: verify Mojang name comments. These include: net.minecraft.client.gl.* (ShaderProgram, GlUniform, ShaderLoader), font provider class names, and various internal model manager classes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
…ModelBakery, clean up Dazy types Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
… (Gradle 8.11 compat) Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
- BitmapFont → BitmapProvider (net.minecraft.client.gui.font.providers) - TrueTypeFont/UnihexFont/GlyphContainer → net.minecraft.client.gui.font.* - Font (interface)/Font.FontFilterPair → GlyphProvider/GlyphProvider.FilterPair - BlankFont/SpaceFont → BlankProvider/SpaceProvider - Glyph → GlyphInfo - FontManager/FontFilterType → net.minecraft.client.gui.font.* - MultipartModelSelector → Condition - And/Or/SimpleMultipartModelSelector → And/Or/KeyValueCondition - MultipartModelComponent → MultipartUnbakedModel.Selector - DataPool → net.minecraft.util.random.DataPool - ResourceMetadata → net.minecraft.server.packs.resources.ResourceMetadata - SplashTextResourceSupplier → SplashManager - Fix SplashScreenMixin inject target string (removed embedded TODO) - Fix SpriteOpenerMixin duplicate import - Remove TODO comments from verified imports Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…neTransformationMixin Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
Co-authored-by: Darker935 <70950705+Darker935@users.noreply.github.com>
…b.com/Darker935/DashLoader into copilot/adapt-mod-for-latest-versions
There was a problem hiding this comment.
Pull request overview
This PR ports DashLoader to Minecraft 1.21.10 and migrates all Minecraft API references from Yarn mappings to Mojang official mappings (MojMaps). The author acknowledges the migration was AI-assisted and requests bug reports.
Changes:
- Updates
gradle.properties,build.gradle, andfabric.mod.jsonto target Minecraft 1.21.10 with Mojang official mappings - Migrates all Java source files (mixins, modules, registry, IO, etc.) from Yarn-mapped class names to Mojang-mapped class names
- Restructures
README.md, issue templates, and CI workflow
Reviewed changes
Copilot reviewed 112 out of 117 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
gradle.properties / build.gradle |
Bumps MC to 1.21.10, switches to loom.officialMojangMappings() |
fabric.mod.json |
Updates MC version constraint to ~1.21.10 |
src/main/java/** |
Full mapping migration: Yarn → Mojang names across all Java sources |
dashloader.mixins.json |
Updated mixin list for new MC version |
inspect.java |
Debug utility file committed to repo root — should not be here |
changelog.md |
Contains unrelated changelog entries not matching this PR |
.github/ISSUE_TEMPLATE/bug_report.md |
Replaced DashLoader-specific bug report fields with generic GitHub defaults |
gradlew.bat |
Standard Gradle wrapper with non-standard :omega end label |
.github/workflows/build.yml |
New CI workflow for building the project |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Inject( | ||
| method = "prepare(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)Ljava/util/List;", | ||
| at = @At(value = "HEAD"), | ||
| cancellable = true | ||
| ) | ||
| private void applySplashCache(ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfoReturnable<List<String>> cir) { | ||
| SplashModule.TEXTS.visit(CacheStatus.LOAD, cir::setReturnValue); | ||
| } | ||
|
|
||
| @Inject( | ||
| method = "prepare(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)Ljava/util/List;", | ||
| at = @At(value = "RETURN") | ||
| ) | ||
| private void stealSplashCache(ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfoReturnable<List<String>> cir) { | ||
| SplashModule.TEXTS.visit(CacheStatus.SAVE, strings -> { | ||
| strings.clear(); | ||
| strings.addAll(cir.getReturnValue()); | ||
| }); | ||
| } | ||
| } |
There was a problem hiding this comment.
In SplashTextResourceSupplierMixin.java, all class body members (both @Inject blocks and the methods) are not indented at all — they begin at column 0, unlike the rest of the codebase which uses consistent indentation inside class bodies. For example, compare with FontManagerOverride.java in the same PR which uses correct 4-space indentation inside the class.
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| if (!(o instanceof AffineTransformationMixin that)) return false; | ||
| if (!super.equals(o)) return false; | ||
|
|
||
| return Objects.equals(matrix, that.matrix); | ||
| } |
There was a problem hiding this comment.
The AffineTransformationMixin.equals() implementation calls super.equals(o) (line 21) on Transformation which is the class being mixed into. The Transformation class in Mojang mappings is a record, and its equals will compare all fields. However, the mixin also separately compares matrix (line 23). If super.equals(o) already compares the matrix (as a record would), this check would be redundant; but if super.equals is being overridden in a non-trivial way and the cast to AffineTransformationMixin that succeeds (line 20), then that.matrix refers to the same field already checked by super.equals. This logic should be carefully reviewed for correctness — specifically whether the if (!super.equals(o)) return false; guard and the separate matrix field check are both necessary.
| @@ -12,24 +12,20 @@ A clear and concise description of what the bug is. | |||
|
|
|||
| **To Reproduce** | |||
| Steps to reproduce the behavior: | |||
| 1. Add '...' mods | |||
| 2. Launch the game | |||
| 3. Join '....' world | |||
| 4. Press '....' stuff | |||
| 1. Go to '...' | |||
| 2. Click on '....' | |||
| 3. Scroll down to '....' | |||
| 4. See error | |||
|
|
|||
| **Expected behavior** | |||
| A clear and concise description of what you expected to happen. | |||
|
|
|||
| **Screenshots** | |||
| If applicable, add screenshots to help explain your problem. | |||
|
|
|||
| **Info (please complete the following information):** | |||
| - DashLoader: [e.g. 3.0-pr1] | |||
| - Minecraft: [e.g. 1.17.1, 1.18] | |||
| - Mods [e.g. Fabric API, Better End] | |||
|
|
|||
| **Full crash log (if relevant)** | |||
| https://pastebin.com/ ... | |||
| **Context (please complete the following information):** | |||
| - DashLoader Version [e.g. 3.0-rc14] | |||
| - Minecraft Version [e.g. 1.18.1] | |||
|
|
|||
| **Additional context** | |||
| Add any other context about the problem here. | |||
There was a problem hiding this comment.
The bug_report.md template has been changed to remove DashLoader-specific context fields (DashLoader version, Minecraft version, mods list, full crash log). The new template is generic (GitHub default), which removes important information that would be needed to triage DashLoader-specific issues — specifically, the crash log request has been removed entirely, which is critical for debugging this mod. The PR description does not mention this as an intentional change.
| public static final CachingData<ProviderIndex> DATA = new CachingData<>(); | ||
| public static final CachingData<Map<FT_Face, DashTrueTypeFont.FontPrams>> FONT_TO_DATA = new CachingData<>(); | ||
|
|
||
| @Override | ||
| public void reset(Cache cache) { | ||
| DATA.reset(cache, new ProviderIndex(new HashMap<>(), new ArrayList<>())); | ||
| FONT_TO_DATA.reset(cache, new HashMap<>()); | ||
| } | ||
|
|
||
| @Override | ||
| public Data save(RegistryWriter factory, StepTask task) { | ||
| ProviderIndex providerIndex = DATA.get(CacheStatus.SAVE); | ||
| assert providerIndex != null; | ||
|
|
||
| int taskSize = 0; | ||
| for (List<GlyphProvider.Conditional> value : providerIndex.providers.values()) { | ||
| taskSize += value.size(); | ||
| } | ||
| taskSize += providerIndex.allProviders.size(); | ||
| task.reset(taskSize); | ||
|
|
||
| var providers = new IntObjectList<List<Integer>>(); | ||
| providerIndex.providers.forEach((identifier, fontFilterPairs) -> { | ||
| var values = new ArrayList<Integer>(); | ||
| for (GlyphProvider.Conditional fontFilterPair : fontFilterPairs) { | ||
| values.add(factory.add(fontFilterPair)); | ||
| task.next(); | ||
| } | ||
| providers.put(factory.add(identifier), values); | ||
| }); | ||
|
|
||
| var allProviders = new ArrayList<Integer>(); | ||
| for (GlyphProvider allProvider : providerIndex.allProviders) { | ||
| allProviders.add(factory.add(allProvider)); | ||
| task.next(); | ||
| } | ||
|
|
||
| return new Data(new DashProviderIndex(providers, allProviders)); | ||
| } | ||
|
|
||
| @Override | ||
| public void load(Data data, RegistryReader reader, StepTask task) { | ||
| ProviderIndex index = new ProviderIndex(new HashMap<>(), new ArrayList<>()); | ||
| data.fontMap.providers.forEach((key, value) -> { | ||
| var fonts = new ArrayList<GlyphProvider.Conditional>(); | ||
| for (Integer i : value) { | ||
| fonts.add(reader.get(i)); | ||
| } | ||
| index.providers.put(reader.get(key), fonts); | ||
| }); | ||
|
|
||
| data.fontMap.allProviders.forEach((value) -> index.allProviders.add(reader.get(value))); | ||
| DATA.set(CacheStatus.LOAD, index); | ||
| } | ||
|
|
||
| @Override | ||
| public Class<Data> getDataClass() { | ||
| return Data.class; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isActive() { | ||
| return ConfigHandler.optionActive(Option.CACHE_FONT); | ||
| } | ||
|
|
||
| public static final class Data { | ||
| public final DashProviderIndex fontMap; | ||
|
|
||
| public Data(DashProviderIndex fontMap) { | ||
| this.fontMap = fontMap; | ||
| } | ||
| } | ||
|
|
||
| public static final class DashProviderIndex { | ||
| public final IntObjectList<List<Integer>> providers; | ||
| public final List<Integer> allProviders; | ||
|
|
||
| public DashProviderIndex(IntObjectList<List<Integer>> providers, List<Integer> allProviders) { | ||
| this.providers = providers; | ||
| this.allProviders = allProviders; | ||
| } | ||
| } | ||
|
|
||
| public static final class ProviderIndex { | ||
| public final Map<ResourceLocation, List<GlyphProvider.Conditional>> providers; | ||
| public final List<GlyphProvider> allProviders; | ||
|
|
||
| public ProviderIndex(Map<ResourceLocation, List<GlyphProvider.Conditional>> providers, List<GlyphProvider> allProviders) { | ||
| this.providers = providers; | ||
| this.allProviders = allProviders; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Many Java source files in this PR have no indentation — all class members, methods, and inner blocks start at column 0. This is inconsistent with the rest of the codebase (where proper 4-space or tab-based indentation is used), making the code significantly harder to read and maintain. Examples include FontModule.java, DashBitmapFont.java, DashSpaceFont.java, BitmapFontAccessor.java, DashStaticPredicate.java, DashSimplePredicate.java, DashOrPredicate.java, DashAndPredicate.java, BooleanSelector.java, FilterMapAccessor.java, DashFontFilterPair.java, DashBlankFont.java, DashBitmapFontGlyph.java, SplashTextResourceSupplierMixin.java, and DashSpaceFont.java. The body content is unindented relative to the class declaration.
| :mainEnd | ||
| if "%OS%"=="Windows_NT" endlocal | ||
|
|
||
| :omega |
There was a problem hiding this comment.
The gradlew.bat file ends with the label :omega (line 89) instead of the standard :omega used in some projects or more commonly just :mainEnd. While :omega works as a batch label, this is an unusual and unexpected label name that is not standard in Gradle wrapper scripts — it replaces what should be :end in the standard Gradle wrapper template. This could cause confusion.
| public Object exportGlyph() { | ||
| try { | ||
| Object lineData = this.exportLineData(); | ||
| Class<?> lineDataClass = Class.forName("net.minecraft.client.gui.font.providers.UnihexProvider$LineData"); | ||
| Class<?> glyphClass = Class.forName("net.minecraft.client.gui.font.providers.UnihexProvider$Glyph"); | ||
| Constructor<?> glyphCtor = glyphClass.getDeclaredConstructor(lineDataClass, int.class, int.class); | ||
| glyphCtor.setAccessible(true); | ||
| return glyphCtor.newInstance(lineData, this.left, this.right); | ||
| } catch (ReflectiveOperationException e) { | ||
| throw new RuntimeException("Failed to rebuild Unihex glyph", e); | ||
| } | ||
| } | ||
|
|
||
| private Object exportLineData() throws ReflectiveOperationException { | ||
| if (this.bitWidth == 8) { | ||
| Class<?> byteClass = Class.forName("net.minecraft.client.gui.font.providers.UnihexProvider$ByteContents"); | ||
| Constructor<?> ctor = byteClass.getDeclaredConstructor(byte[].class); | ||
| ctor.setAccessible(true); | ||
| return ctor.newInstance((Object) this.bytes); | ||
| } | ||
| if (this.bitWidth == 16) { | ||
| Class<?> shortClass = Class.forName("net.minecraft.client.gui.font.providers.UnihexProvider$ShortContents"); | ||
| Constructor<?> ctor = shortClass.getDeclaredConstructor(short[].class); | ||
| ctor.setAccessible(true); | ||
| return ctor.newInstance((Object) this.shorts); | ||
| } | ||
| Class<?> intClass = Class.forName("net.minecraft.client.gui.font.providers.UnihexProvider$IntContents"); | ||
| Constructor<?> ctor = intClass.getDeclaredConstructor(int[].class, int.class); | ||
| ctor.setAccessible(true); | ||
| return ctor.newInstance(this.ints, this.bitWidth); | ||
| } |
There was a problem hiding this comment.
In DashUnihexFont.DashUnicodeTextureGlyph, the exportGlyph and exportLineData methods use Class.forName(...) with hardcoded Mojang-mapped internal class names (e.g., UnihexProvider$LineData, UnihexProvider$ByteContents, UnihexProvider$ShortContents, UnihexProvider$IntContents). These are internal, non-public sealed classes only accessible by reflection, which is fragile. Additionally, the IntContents constructor is assumed to take (int[], int) parameters — if the Mojang-mapped class structure changes between MC versions (e.g., 1.21.10 to 1.21.11+), these calls will fail at runtime. This pattern is extremely brittle and has a high risk of silent breakage on Minecraft updates.
| # Fixes | ||
|
|
||
| - Cache reading logic | ||
| - Vulkan mod compatibility | ||
| - Transparent textures rendering as opaque with sodium with feature `CacheSpriteContents` | ||
| - Possible memory leak in atlas caching module | ||
| - Ignore sprites with duplicate IDs | ||
|
|
||
| # Features | ||
|
|
||
| - Tweaked config screen | ||
|
|
||
| # Internal | ||
|
|
||
| - Removed `Sonatype Snapshots` maven |
There was a problem hiding this comment.
The changelog.md in this PR documents fixes and features (e.g., "Cache reading logic", "Tweaked config screen", "Removed Sonatype Snapshots maven"), but none of these changes are visible in the actual diff — the PR is focused exclusively on adding Minecraft 1.21.10 support and Mojang mappings migration, and a full project restructuring. The changelog does not mention the mapping migration or MC version bump at all. The changelog appears to belong to a different PR or version and has been incorrectly included here.
| if (factory == null) { | ||
| factory = tryScanCreators((look, type) -> look.findStatic(dashClass, "factory", type), dashObject); | ||
| } | ||
| if (factory == null) { | ||
| factory = tryScanCreators((look, type) -> look.findStatic(dashClass, "factory", type), dashObject); | ||
| } |
There was a problem hiding this comment.
In FactoryBinding.create, the second and third factory lookup attempts are identical — both try look.findStatic(dashClass, "factory", type). This is a copy-paste bug: the second attempt is duplicate and therefore one of those lookups is always redundant. The original code likely intended to scan a different method name (e.g., "create") or a different lookup type in one of the two calls.
| import java.lang.reflect.*; | ||
| public class Inspect { | ||
| public static void main(String[] args) throws Exception { | ||
| if (args.length == 0) { | ||
| System.err.println("usage: Inspect <class>"); | ||
| return; | ||
| } | ||
| Class<?> c = Class.forName(args[0]); | ||
| System.out.println("CLASS " + c.getName()); | ||
| System.out.println("FIELDS:"); | ||
| for (Field f : c.getDeclaredFields()) { | ||
| System.out.println(" " + Modifier.toString(f.getModifiers()) + " " + f.getType().getTypeName() + " " + f.getName()); | ||
| } | ||
| System.out.println("CTORS:"); | ||
| for (Constructor<?> k : c.getDeclaredConstructors()) { | ||
| System.out.println(" " + Modifier.toString(k.getModifiers()) + " " + c.getSimpleName() + "(" + params(k.getParameterTypes()) + ")"); | ||
| } | ||
| System.out.println("METHODS:"); | ||
| for (Method m : c.getDeclaredMethods()) { | ||
| System.out.println(" " + Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getTypeName() + " " + m.getName() + "(" + params(m.getParameterTypes()) + ")"); | ||
| } | ||
| } | ||
| private static String params(Class<?>[] ps) { | ||
| StringBuilder sb = new StringBuilder(); | ||
| for (int i=0;i<ps.length;i++) { | ||
| if (i>0) sb.append(", "); | ||
| sb.append(ps[i].getTypeName()); | ||
| } | ||
| return sb.toString(); | ||
| } | ||
| } |
There was a problem hiding this comment.
The inspect.java file is a standalone debug/inspection utility Java file that has been committed to the repository root. This file has no place in the production source tree and should not be part of a pull request — it appears to be a leftover developer debugging tool used while investigating Mojang mappings class structures.
| import java.lang.reflect.*; | |
| public class Inspect { | |
| public static void main(String[] args) throws Exception { | |
| if (args.length == 0) { | |
| System.err.println("usage: Inspect <class>"); | |
| return; | |
| } | |
| Class<?> c = Class.forName(args[0]); | |
| System.out.println("CLASS " + c.getName()); | |
| System.out.println("FIELDS:"); | |
| for (Field f : c.getDeclaredFields()) { | |
| System.out.println(" " + Modifier.toString(f.getModifiers()) + " " + f.getType().getTypeName() + " " + f.getName()); | |
| } | |
| System.out.println("CTORS:"); | |
| for (Constructor<?> k : c.getDeclaredConstructors()) { | |
| System.out.println(" " + Modifier.toString(k.getModifiers()) + " " + c.getSimpleName() + "(" + params(k.getParameterTypes()) + ")"); | |
| } | |
| System.out.println("METHODS:"); | |
| for (Method m : c.getDeclaredMethods()) { | |
| System.out.println(" " + Modifier.toString(m.getModifiers()) + " " + m.getReturnType().getTypeName() + " " + m.getName() + "(" + params(m.getParameterTypes()) + ")"); | |
| } | |
| } | |
| private static String params(Class<?>[] ps) { | |
| StringBuilder sb = new StringBuilder(); | |
| for (int i=0;i<ps.length;i++) { | |
| if (i>0) sb.append(", "); | |
| sb.append(ps[i].getTypeName()); | |
| } | |
| return sb.toString(); | |
| } | |
| } | |
| // This file is intentionally left blank. | |
| // It previously contained a standalone debug/inspection utility | |
| // that should not be part of the production source tree. |
| } | ||
| } | ||
|
|
||
| public record FontPrams(ResourceLocation id, float size, String skip) { |
There was a problem hiding this comment.
The DashTrueTypeFont.java record type is named FontPrams (line 110). This appears to be a misspelling of "FontParams". The name is used in FontModule.java as well.
I basically made and update for minecraft 1.21.10 and also, Mojang mappings instead of Yarn
I could do anything manually like updating for yarn, but since we're joining a new era of unobfuscated code, I decided to spend all of my tokens changing from YARN to Mojmaps, try and report any bugs since this is literally full AI made (apparently working for me)
||I dont know how to make a PR for multi-versioned mods, so I just made a PR for main branch||