Guntram Blohm vor 4 Jahren
Commit
29c40b45f1

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+.gradle/
+build/

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "Versionfiles"]
+	path = Versionfiles
+	url = https://github.com/gbl/Versionfiles.git

+ 32 - 0
COMPILING.md

@@ -0,0 +1,32 @@
+# TL;DR
+
+- Get a version of gradle that's at least 4.10.2
+- `git clone <repo>`
+- `git branch -r`  to see available branches
+- `git checkout fabric_1_16` to select your branch
+- `git submodule init`
+- `git submodule update`
+- `/path/to/gradle build`
+
+# How to compile this mod
+
+Because I created several mods, which have some things in common, the structure of my mods is a bit different from the example mod that Fabric or Forge provide.
+
+In particular, I don't want the gradle files to be duplicated into every single mod repository, and some common files that contain version info for Fabric, its tools, and some library mods, have been moved to a (common) submodule.
+
+# Prerequisites
+
+You need a gradle installation which does not come with the mod. At the time of this writing, the version of gradle used is 4.10.2. Gradle 6.5 has been tested to work too, so versions between those *should* as well.
+
+You might already have gradle installed, especially when you're running Linux - if so, make sure it's new enough. For example, Ubuntu 18.04 has gradle 4.4.1 which is not. Run `gradle -version` to check.
+
+If you have the Fabric example mod installed, you can use the gradle installation from there. Else, download a release from https://gradle.org/releases/ (binary only is sufficient) and unpack it somewhere.
+
+# Versionfiles submodule
+
+All my mods use the same repository of files that match MineCraft, Fabric, and common libraries versions. This is included in the mod repository as a Versionfiles submodule, and you should get it when cloning the repo. Run `git submodule init`, then `git submodule update` to get the current version of the files. Do this after selecting your branch, see below.
+
+# Compiling the mod
+
+There are branches for the various versions of MineCraft that are supported by the mod. Run `git branch -r` to see which branches there are, then `git checkout branchname` without the `origin/` part, for example, `git checkout fabric_1_16`.
+

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 Guntram Blohm
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 26 - 0
README.md

@@ -0,0 +1,26 @@
+This mod will enlarge the advancements info UI, so it'll use most of your screen, not just a tiny part of it, especially when your GUI scale is high.
+
+This means more info visible at the same time, less scrolling, and a better overview.
+
+Also, it checks out which requirements you've met and which you haven't, and displays a list of those to the right of the UI. This makes it much easier to find what you have done and what you still need to do.
+
+For example, the "Discover every Biome" Advancement doesn't tell you what's still missing; this mod will help you go for that last biome you haven't visited.
+
+This works with data pack Advancements as well; here's an example from BlazeAndCave:
+
+![Screenshot](https://media.forgecdn.net/attachments/309/457/screenshot_2020-08-22_19-50-58.png "Screenshot")
+
+If the list to the right overflows, you can use your mouse scroll wheel to scroll.
+
+----------------------------------------------------------------------
+
+Advancements, and their objectives, have their very own names, which may or may not correspond to MineCraft items, blocks, or entities. The mod tries its best to map those names to Minecraft objects, but in some cases, especially with Data Packs, that's just not possible. The mod will show the internal name in that case in the hope you're better at deciphering what's needed than the mod itself. 
+
+For example, the objective of "The Parrots and the Bats" is named "bred", this will show as bred in the info box. 
+
+
+This is the very first version of the mod, and as such, there are probably still bugs. Please report them!
+
+To make sure the mod doesn't slow down your minecraft, 
+it has been optimized using
+ [![JProfiler Logo](https://www.ej-technologies.com/images/product_banners/jprofiler_small.png "Logo")](https://www.ej-technologies.com/products/jprofiler/overview.html).

+ 1 - 0
Versionfiles

@@ -0,0 +1 @@
+Subproject commit 11ab3287b302a5f64d14be357830cb4858d2ea20

+ 60 - 0
build.gradle

@@ -0,0 +1,60 @@
+plugins {
+	id 'fabric-loom' version '0.4-SNAPSHOT'
+}
+
+repositories {
+	maven {
+		url = "https://maven.fabricmc.net/"
+	}
+	maven {
+		url = "https://minecraft.guntram.de/maven/"
+	}
+}
+
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
+ext.Versions = new Properties()
+Versions.load(file("Versionfiles/mcversion-1.16.properties").newReader())
+
+archivesBaseName = "advancementinfo"
+ext.projectVersion = "1.0"
+
+version = "${Versions['minecraft_version']}-fabric${Versions['fabric_versiononly']}-${project.projectVersion}"
+
+minecraft {
+    refmapName = "advancementinfo-refmap.json";
+}
+
+processResources {
+	inputs.property "version", project.version
+
+    from(sourceSets.main.resources.srcDirs) {
+		include "fabric.mod.json"
+		expand "version": project.version
+	}
+	from(sourceSets.main.resources.srcDirs) {
+		exclude "fabric.mod.json"
+	}
+}
+
+dependencies {
+    minecraft  "com.mojang:minecraft:${Versions['minecraft_version']}"
+    mappings   "net.fabricmc:yarn:${Versions['yarn_mappings']}:v2"
+    modCompile "net.fabricmc:fabric-loader:${Versions['loader_version']}"
+    modCompile "net.fabricmc.fabric-api:fabric-api:${Versions['fabric_version']}"
+    modCompile "io.github.prospector:modmenu:${Versions['modmenu_version']}"
+    modCompile "de.guntram.mcmod:GBfabrictools:${Versions['gbfabrictools_version']}"
+    include    "de.guntram.mcmod:GBfabrictools:${Versions['gbfabrictools_version']}"
+}
+// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
+// if it is present.
+// If you remove this task, sources will not be generated.
+task sourcesJar(type: Jar, dependsOn: classes) {
+	classifier = 'sources'
+	from sourceSets.main.allSource
+}
+
+jar {
+	from "LICENSE"
+}

BIN
logo.xcf


+ 10 - 0
settings.gradle

@@ -0,0 +1,10 @@
+pluginManagement {
+    repositories {
+        jcenter()
+        maven {
+            name = 'Fabric'
+            url = 'https://maven.fabricmc.net/'
+        }
+        gradlePluginPortal()
+    }
+}

+ 30 - 0
src/main/java/de/guntram/mcmod/advancementinfo/AdvancementCriterion.java

@@ -0,0 +1,30 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.guntram.mcmod.advancementinfo;
+
+import net.minecraft.text.Text;
+
+/**
+ *
+ * @author gbl
+ */
+public class AdvancementCriterion {
+    private Text name;
+    private boolean obtained;
+    
+    AdvancementCriterion(Text name, boolean obtained) {
+        this.name = name;
+        this.obtained = obtained;
+    }
+    
+    public boolean getObtained() {
+        return obtained;
+    }
+    
+    public Text getName() {
+        return name;
+    } 
+}

+ 64 - 0
src/main/java/de/guntram/mcmod/advancementinfo/AdvancementInfo.java

@@ -0,0 +1,64 @@
+package de.guntram.mcmod.advancementinfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import net.fabricmc.api.ClientModInitializer;
+import net.minecraft.client.gui.screen.advancement.AdvancementWidget;
+import net.minecraft.client.resource.language.I18n;
+import net.minecraft.text.LiteralText;
+import net.minecraft.text.Text;
+import net.minecraft.text.TranslatableText;
+
+public class AdvancementInfo implements ClientModInitializer
+{
+    static final String MODID="advancementinfo";
+    static final String VERSION="@VERSION@";
+    
+    static final public int AI_spaceX = 30;
+    static final public int AI_spaceY = 30;
+    static final public int AI_infoWidth = 120;
+    
+    static public AdvancementWidget mouseOver, mouseClicked;
+    static public List<AdvancementCriterion> cachedClickList;
+
+    public static List<AdvancementCriterion> getCriteriaList(AdvancementProgressSupplier widget) {
+        List<AdvancementCriterion> result = new ArrayList<>();
+        addCriteria(result, widget.getProgress().getUnobtainedCriteria(), false);
+        addCriteria(result, widget.getProgress().getObtainedCriteria(), true);
+        return result;        
+    }
+    
+    private static void addCriteria(List<AdvancementCriterion> result, Iterable<String> criteria, boolean obtained) {
+        final String[] prefixes = new String[] { "item.minecraft", "block.minecraft", "entity.minecraft", "container", "effect.minecraft", "biome.minecraft" };
+        // criteria is actually a List<> .. but play nice
+        ArrayList<String> sorted=new ArrayList<>();
+        for (String s:criteria) {
+            sorted.add(s);
+        } 
+        Collections.sort(sorted);
+        for (String s: sorted) {
+            Text translation = null;
+            String key = s;
+            if (key.startsWith("minecraft:")) {
+                key=key.substring(10);
+            }
+            for (String prefix: prefixes) {
+                if (I18n.hasTranslation(prefix+"."+key)) {
+                    translation = new TranslatableText(prefix+"."+key);
+                    break;
+                }
+            }
+            if (translation == null) {
+                translation = new LiteralText(key);
+            }
+            result.add(new AdvancementCriterion(translation, obtained));
+        }
+    }
+    
+    
+    @Override
+    public void onInitializeClient()
+    {
+    }
+}

+ 16 - 0
src/main/java/de/guntram/mcmod/advancementinfo/AdvancementProgressSupplier.java

@@ -0,0 +1,16 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.guntram.mcmod.advancementinfo;
+
+import net.minecraft.advancement.AdvancementProgress;
+
+/**
+ *
+ * @author gbl
+ */
+public interface AdvancementProgressSupplier {
+    public AdvancementProgress getProgress();
+}

+ 14 - 0
src/main/java/de/guntram/mcmod/advancementinfo/IteratorReceiver.java

@@ -0,0 +1,14 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.guntram.mcmod.advancementinfo;
+
+/**
+ *
+ * @author gbl
+ */
+public interface IteratorReceiver {
+    public void accept(int pos, int len);
+}

+ 170 - 0
src/main/java/de/guntram/mcmod/advancementinfo/mixin/AdvancementScreenMixin.java

@@ -0,0 +1,170 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.guntram.mcmod.advancementinfo.mixin;
+
+import de.guntram.mcmod.advancementinfo.AdvancementCriterion;
+import de.guntram.mcmod.advancementinfo.AdvancementInfo;
+import static de.guntram.mcmod.advancementinfo.AdvancementInfo.AI_spaceX;
+import static de.guntram.mcmod.advancementinfo.AdvancementInfo.AI_spaceY;
+import de.guntram.mcmod.advancementinfo.AdvancementProgressSupplier;
+import de.guntram.mcmod.advancementinfo.IteratorReceiver;
+import java.util.List;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.gui.screen.advancement.AdvancementWidget;
+import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
+import net.minecraft.client.resource.language.I18n;
+import net.minecraft.client.util.math.MatrixStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Constant;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.ModifyConstant;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+/**
+ *
+ * @author gbl
+ */
+@Mixin(AdvancementsScreen.class)
+public class AdvancementScreenMixin extends Screen {
+    
+    public AdvancementScreenMixin() { super(null); }
+    
+    private int scrollPos;
+    
+    @ModifyConstant(method="render", constant=@Constant(intValue = 252), require=1)
+    private int getRenderLeft(int orig) { return width - AI_spaceX*2; }
+    
+    @ModifyConstant(method="render", constant=@Constant(intValue = 140), require=1)
+    private int getRenderTop(int orig) { return height - AI_spaceY*2; }
+
+    @ModifyConstant(method="mouseClicked", constant=@Constant(intValue = 252), require=1)
+    private int getMouseLeft(int orig) { return width - AI_spaceX*2; }
+    
+    @ModifyConstant(method="mouseClicked", constant=@Constant(intValue = 140), require=1)
+    private int getMouseTop(int orig) { return height - AI_spaceY*2; }
+
+    @ModifyConstant(method="drawAdvancementTree", constant=@Constant(intValue = 234), require = 1)
+    private int getAdvTreeXSize(int orig) { return width - AI_spaceX*2 - 2*9 - AdvancementInfo.AI_infoWidth; }
+
+    @ModifyConstant(method="drawAdvancementTree", constant=@Constant(intValue = 113), require = 1)
+    private int getAdvTreeYSize(int orig) { return height - AI_spaceY*2 - 3*9; }
+
+    /* Make it so that drawWidgets only draws the left top corner ... */
+    @ModifyConstant(method="drawWidgets", constant=@Constant(intValue = 252), require=1)
+    private int getWidgetsLeft(int orig) // { return width - AI_spaceX*2; }
+    { return 126; }
+    
+    @ModifyConstant(method="drawWidgets", constant=@Constant(intValue = 140), require=1)
+    private int getWidgetsTop(int orig) // { return height - AI_spaceY*2; }
+    { return 70; }
+    
+    @Inject(method="render",
+            at=@At(value="INVOKE",
+                    target="net/minecraft/client/gui/screen/advancement/AdvancementsScreen.drawWidgets(Lnet/minecraft/client/util/math/MatrixStack;II)V"))
+    public void renderRightFrameBackground(MatrixStack stack, int x, int y, float delta, CallbackInfo ci) {
+        fill(stack, 
+                width-AI_spaceX-AdvancementInfo.AI_infoWidth+4, AI_spaceY+4, 
+                width-AI_spaceX-4, height-AI_spaceY-4, 0xffc0c0c0);
+    }
+    
+    @Inject(method="drawWidgets",
+            at=@At(value="INVOKE", 
+                    target="net/minecraft/client/gui/screen/advancement/AdvancementsScreen.drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"))
+    public void renderFrames(MatrixStack stack, int x, int y, CallbackInfo ci)
+    {
+        int iw = AdvancementInfo.AI_infoWidth;
+
+        drawTexture(stack, width-AI_spaceX-126 - iw,                   y, 127,  0, 126, 70);
+        drawTexture(stack,                   x,                                height-AI_spaceY-70,   0, 71, 126, 70);
+        drawTexture(stack, width-AI_spaceX-126 - iw, height-AI_spaceY-70, 127, 71, 126, 70);
+        
+        iterate(126, width-AI_spaceX-126 - iw, 200, (pos, len) -> drawTexture(stack, pos, y, 15, 0, len, 70));
+        iterate(126, width-AI_spaceX-126 - iw, 200, (pos, len) -> drawTexture(stack, pos, height-AI_spaceY-70, 15, 71, len, 70));
+        iterate(70, height-AI_spaceY-70, 100, (pos, len) -> drawTexture(stack, x, pos, 0, 25, 70, len));
+        iterate(70, height-AI_spaceY-70, 100, (pos, len) -> drawTexture(stack, width-AI_spaceX-126 - iw, pos, 127, 25, 126, len));
+
+
+        drawTexture(stack, width-AI_spaceX - iw  ,                   y,   0     ,  0, iw/2,   70);
+        drawTexture(stack, width-AI_spaceX - iw/2,                   y, 252-iw/2,  0, iw/2+1, 70);
+        drawTexture(stack, width-AI_spaceX - iw  , height-AI_spaceY-70,   0     , 71, iw/2,   70);
+        drawTexture(stack, width-AI_spaceX - iw/2, height-AI_spaceY-70, 252-iw/2, 71, iw/2+1, 70);
+        iterate(70, height-AI_spaceY-70, 100, (pos, len) -> drawTexture(stack, width-AI_spaceX - iw, pos,          0, 25, iw/2, len));
+        iterate(70, height-AI_spaceY-70, 100, (pos, len) -> drawTexture(stack, width-AI_spaceX - iw/2, pos, 252-iw/2, 25, iw/2, len));
+    }
+
+    private void iterate(int start, int end, int maxstep, IteratorReceiver func) {
+        int size;
+        for (int i=start; i<end; i+=maxstep) {
+            size=maxstep;
+            if (i+size > end) {
+                size = end - i;
+            }
+            func.accept(i, size);
+        }
+    }
+    
+    @Inject(method="drawWidgets", at=@At("RETURN"))
+    public void renderRightFrameTitle(MatrixStack stack, int x, int y, CallbackInfo ci) {
+        textRenderer.draw(stack, I18n.translate("advancementinfo.infopane"), width-AI_spaceX-AdvancementInfo.AI_infoWidth+8, y+6, 4210752);
+
+        if (AdvancementInfo.mouseClicked != null) {
+            renderCriteria(stack, AdvancementInfo.mouseClicked);
+        } else if (AdvancementInfo.mouseOver != null) {
+            renderCriteria(stack, AdvancementInfo.mouseOver);                    
+        }
+    }
+    
+    @Inject(method="mouseClicked", at=@At("HEAD"))
+    public void rememberClickedWidget(double x, double y, int button, CallbackInfoReturnable cir) {
+        AdvancementInfo.mouseClicked = AdvancementInfo.mouseOver;
+        scrollPos = 0;
+        if (AdvancementInfo.mouseClicked != null) {
+            AdvancementInfo.cachedClickList = AdvancementInfo.getCriteriaList((AdvancementProgressSupplier) AdvancementInfo.mouseClicked);
+        } else {
+            AdvancementInfo.cachedClickList = null;
+        }
+    }
+    
+    // @Inject(method="mouseScrolled", at=@At("HEAD"), cancellable = true)
+    @Override
+    public boolean mouseScrolled(double X, double Y, double amount /*, CallbackInfoReturnable cir */) {
+        if (amount > 0 && scrollPos > 0) {
+            scrollPos--;
+        } else if (amount < 0 && AdvancementInfo.cachedClickList != null 
+                && scrollPos < AdvancementInfo.cachedClickList.size() - (height-2*AI_spaceY)/textRenderer.fontHeight + 5) {
+            scrollPos++;
+        }
+        return false;
+    }
+    
+    private void renderCriteria(MatrixStack stack, AdvancementWidget widget) {
+        int y = AI_spaceY + 20;
+        int skip;
+        List<AdvancementCriterion> list;
+        if (widget == AdvancementInfo.mouseClicked) {
+            list = AdvancementInfo.cachedClickList;
+            skip = scrollPos;
+        } else {
+            list = AdvancementInfo.getCriteriaList((AdvancementProgressSupplier) widget);
+            skip = 0;
+        }
+        for (AdvancementCriterion entry: list) {
+            if (skip-- > 0) {
+                continue;
+            }
+            textRenderer.draw(stack, 
+                    textRenderer.trimToWidth(entry.getName(), AdvancementInfo.AI_infoWidth-24),
+                    width-AI_spaceX-AdvancementInfo.AI_infoWidth+12, y, 
+                    entry.getObtained() ? 0x00ff00 : 0xff0000);
+            y+=textRenderer.fontHeight;
+            if (y > height - AI_spaceY - textRenderer.fontHeight) {
+                break;
+            }
+        }
+    }
+}

+ 72 - 0
src/main/java/de/guntram/mcmod/advancementinfo/mixin/AdvancementTabMixin.java

@@ -0,0 +1,72 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.guntram.mcmod.advancementinfo.mixin;
+
+import de.guntram.mcmod.advancementinfo.AdvancementInfo;
+import static de.guntram.mcmod.advancementinfo.AdvancementInfo.AI_spaceX;
+import static de.guntram.mcmod.advancementinfo.AdvancementInfo.AI_spaceY;
+import net.minecraft.client.gui.screen.advancement.AdvancementTab;
+import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
+import net.minecraft.client.util.math.MatrixStack;
+import org.spongepowered.asm.mixin.Final;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Constant;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.ModifyConstant;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+/**
+ *
+ * @author gbl
+ */
+@Mixin(AdvancementTab.class)
+public class AdvancementTabMixin {
+    
+    @Shadow @Final AdvancementsScreen screen;
+
+    // space of the whole internal advancements widget
+    @ModifyConstant(method="render", constant=@Constant(intValue = 234), require = 1)
+    private int getAdvTreeXSize(int orig) { return screen.width - AI_spaceX*2 - 2*9 - AdvancementInfo.AI_infoWidth; }
+
+    @ModifyConstant(method="render", constant=@Constant(intValue = 113), require = 1)
+    private int getAdvTreeYSize(int orig) { return screen.height - AI_spaceY*2 - 3*9; }
+
+    // origin of the shown tree within the scrollable space
+    
+    @ModifyConstant(method="render", constant=@Constant(intValue = 117), require = 1)
+    private int getAdvTreeXOrig(int orig) { return screen.width/2 - AI_spaceX - AdvancementInfo.AI_infoWidth/2; }
+
+    @ModifyConstant(method="render", constant=@Constant(intValue = 56), require = 1)
+    private int getAdvTreeYOrig(int orig) { return screen.height/2 - AI_spaceY; }
+    
+    @ModifyConstant(method="move", constant=@Constant(intValue = 234), require = 2)
+    private int getMoveXCenter(int orig) { return screen.width - AI_spaceX*2 - 2*9 - AdvancementInfo.AI_infoWidth; }
+
+    @ModifyConstant(method="move", constant=@Constant(intValue = 113), require = 2)
+    private int getMoveYCenter(int orig) { return screen.height - AI_spaceY*2 - 3*9; }
+    
+    // need to repeat the texture inside the scrollable space more
+    
+    @ModifyConstant(method="render", constant=@Constant(intValue = 15), require = 1)
+    private int getXTextureRepeats(int orig) { return (screen.width-AI_spaceX*2 - AdvancementInfo.AI_infoWidth) / 16 + 1; }
+
+    @ModifyConstant(method="render", constant=@Constant(intValue = 8), require = 1)
+    private int getYTextureRepeats(int orig) { return (screen.height-AI_spaceY*2) / 16 + 1; }
+    
+    // area that can show a tooltip
+    @ModifyConstant(method="drawWidgetTooltip", constant=@Constant(intValue = 234), require = 2)
+    private int getTooltipXSize(int orig) { return screen.width - AI_spaceX*2 - 2*9 - AdvancementInfo.AI_infoWidth; }
+
+    @ModifyConstant(method="drawWidgetTooltip", constant=@Constant(intValue = 113), require = 2)
+    private int getTooltipYSize(int orig) { return screen.height - AI_spaceY*2 - 3*9; }
+    
+    @Inject(method="drawWidgetTooltip", at=@At("HEAD"))
+    private void forgetMouseOver(MatrixStack stack, int i, int j, int y, int k, CallbackInfo ci) {
+        AdvancementInfo.mouseOver = null;
+    }
+}

+ 14 - 0
src/main/java/de/guntram/mcmod/advancementinfo/mixin/AdvancementTabType.java

@@ -0,0 +1,14 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.guntram.mcmod.advancementinfo.mixin;
+
+/**
+ *
+ * @author gbl
+ */
+class AdvancementTabType {
+    
+}

+ 38 - 0
src/main/java/de/guntram/mcmod/advancementinfo/mixin/AdvancementWidgetMixin.java

@@ -0,0 +1,38 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package de.guntram.mcmod.advancementinfo.mixin;
+
+import de.guntram.mcmod.advancementinfo.AdvancementInfo;
+import de.guntram.mcmod.advancementinfo.AdvancementProgressSupplier;
+import net.minecraft.advancement.AdvancementProgress;
+import net.minecraft.client.gui.screen.advancement.AdvancementWidget;
+import net.minecraft.client.util.math.MatrixStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+/**
+ *
+ * @author gbl
+ */
+
+@Mixin(AdvancementWidget.class)
+public class AdvancementWidgetMixin implements AdvancementProgressSupplier {
+    
+    @Shadow private AdvancementProgress progress;
+    
+    @Inject(method="drawTooltip", at=@At("HEAD")) 
+    public void rememberTooltip(MatrixStack stack, int i, int j, float f, int y, int k, CallbackInfo ci) {
+        AdvancementInfo.mouseOver = (AdvancementWidget)(Object)this;
+    }
+    
+    @Override
+    public AdvancementProgress getProgress() {
+        return this.progress;
+    }
+}

+ 41 - 0
src/main/java/net/minecraft/client/gui/screen/advancement/AdvancementTabTypeMixin.java

@@ -0,0 +1,41 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package net.minecraft.client.gui.screen.advancement;
+
+
+import de.guntram.mcmod.advancementinfo.AdvancementInfo;
+import net.minecraft.client.MinecraftClient;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+/**
+ *
+ * @author gbl
+ */
+
+@Mixin(AdvancementTabType.class)
+public class AdvancementTabTypeMixin {
+    
+    @Inject(method="getTabX", at=@At("HEAD"), cancellable = true) 
+    public void getAdjustedTabX(int index, CallbackInfoReturnable cir) {
+        if ((AdvancementTabType)(Object)this == AdvancementTabType.RIGHT) {
+            cir.setReturnValue(MinecraftClient.getInstance().currentScreen.width - AdvancementInfo.AI_spaceX*2 - 4);
+            // System.out.println("X pos is "+cir.getReturnValueI());
+            cir.cancel();
+        }
+    }
+
+    @Inject(method="getTabY", at=@At("HEAD"), cancellable = true) 
+    public void getAdjustedTabY(int index, CallbackInfoReturnable cir) {
+        if ((AdvancementTabType)(Object)this == AdvancementTabType.BELOW) {
+            cir.setReturnValue(MinecraftClient.getInstance().currentScreen.height - AdvancementInfo.AI_spaceY*2 - 4);
+            // System.out.println("Y pos is "+cir.getReturnValueI());
+            cir.cancel();
+        }
+    }
+}

+ 35 - 0
src/main/resources/fabric.mod.json

@@ -0,0 +1,35 @@
+{
+    "schemaVersion": 1,
+    "id": "advancementinfo",
+    "version": "${version}",
+    "environment": "client",
+    "entrypoints": {
+        "client": [ "de.guntram.mcmod.advancementinfo.AdvancementInfo" ]
+    },
+    "custom": {
+        "modupdater": {
+            "strategy": "json",
+            "url": "https://raw.githubusercontent.com/gbl/ModVersionInfo/master/AdvancementInfo.json"
+        }
+    },
+    "mixins": [
+        "mixins.advancementtabtype.json",
+      	"mixins.advancementinfo.json"
+    ],
+    "depends": {
+      "fabric": "*"
+    },
+    "recommends": {
+        "modmenu" : "*",
+        "modupdater": ">=1.1.7"
+    },
+    "name": "AdvancementInfo",
+    "description": "Make it easier to see which advancements you have and what's missing.",
+    "icon": "icon.png",
+    "authors": [ "Giselbaer" ],
+    "contact": {
+        "homepage": "https://www.curseforge.com/minecraft/mc-mods/advancementinfo",
+        "sources": "https://github.com/gbl/AdvancementInfo",
+        "issues": "https://github.com/gbl/AdvancementInfo/issues"
+    }
+}

BIN
src/main/resources/icon.png


BIN
src/main/resources/logo.png


+ 12 - 0
src/main/resources/mixins.advancementinfo.json

@@ -0,0 +1,12 @@
+{
+    "required": true,
+    "package": "de.guntram.mcmod.advancementinfo.mixin",
+    "refmap": "advancementinfo-refmap.json",
+    "minVersion": "0.6",
+    "client": [
+        "AdvancementScreenMixin", "AdvancementTabMixin", "AdvancementWidgetMixin"
+    ],
+    "injectors": {
+        "defaultRequire": 1
+    }
+}

+ 12 - 0
src/main/resources/mixins.advancementtabtype.json

@@ -0,0 +1,12 @@
+{
+    "required": true,
+    "package": "net.minecraft.client.gui.screen.advancement",
+    "refmap": "advancementinfo-refmap.json",
+    "minVersion": "0.6",
+    "client": [
+        "AdvancementTabTypeMixin"
+    ],
+    "injectors": {
+        "defaultRequire": 1
+    }
+}