Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PATCHED.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| Basic | [MC-46503](https://bugs.mojang.com/browse/MC-46503) | You can retain a mob's shader in spectator mode by running /kill |
| Basic | [MC-46766](https://bugs.mojang.com/browse/MC-46766) | Mining a block in Survival, then changing to Spectator creates a breaking animation and sound |
| Basic | [MC-59810](https://bugs.mojang.com/browse/MC-59810) | Cannot break blocks while sprinting (Ctrl+Click = right click on macOS) *(macOS only)* |
| Basic | [MC-61489](https://bugs.mojang.com/browse/MC-61489) | Book GUI is not vertically centered |
| Basic | [MC-79545](https://bugs.mojang.com/browse/MC-79545) | The experience bar disappears when too many levels are given to the player |
| Basic | [MC-80859](https://bugs.mojang.com/browse/MC-80859) | Starting to drag item stacks over other compatible stacks makes the latter invisible until appearance change (stack size increases) |
| Basic | [MC-90683](https://bugs.mojang.com/browse/MC-90683) | "Received unknown passenger" - Entities with differing render distances as passengers outputs error |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package dev.isxander.debugify.client.mixins.basic.mc61489;

import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.BookEditScreen;
import net.minecraft.network.chat.Component;
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.ModifyArg;

// Compared to the original patch, we use / 3 here since it seems to line up better. Else, in a windowed screen the Done button appears at the very bottom / slightly off-screen.
@BugFix(id = "MC-61489", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, modConflicts = "fixbookgui", description = "Book GUI is not vertically centered")
@Mixin(BookEditScreen.class)
public class BookEditScreenMixin extends Screen {
@Shadow
@Final
public static int IMAGE_HEIGHT;

protected BookEditScreenMixin(Component component) {
super(component);
}

@ModifyArg(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/MultiLineEditBox$Builder;setY(I)Lnet/minecraft/client/gui/components/MultiLineEditBox$Builder;"))
private int modifyHeight(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/PageButton;<init>(IIZLnet/minecraft/client/gui/components/Button$OnPress;Z)V"), index = 1)
private int modifyPageButtonsYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button$Builder;bounds(IIII)Lnet/minecraft/client/gui/components/Button$Builder;"), index = 1)
private int modifyButtonsYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIZ)V"), index = 3)
private int modifyStringYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "renderBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"), index = 3)
private int modifyBlitYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package dev.isxander.debugify.client.mixins.basic.mc61489;

import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.BookViewScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
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.ModifyArg;

// Compared to the original patch, we use / 3 here since it seems to line up better. Else, in a windowed screen the Done button appears at the very bottom / slightly off-screen.
@BugFix(id = "MC-61489", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, modConflicts = "fixbookgui", description = "Book GUI is not vertically centered")
@Mixin(BookViewScreen.class)
public class BookViewScreenMixin extends Screen {
@Shadow
@Final
protected static int IMAGE_HEIGHT;

protected BookViewScreenMixin(Component component) {
super(component);
}

@ModifyArg(method = "createMenuControls", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button$Builder;bounds(IIII)Lnet/minecraft/client/gui/components/Button$Builder;"), index = 1)
private int modifyMenuControlsYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "createPageControlButtons", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/PageButton;<init>(IIZLnet/minecraft/client/gui/components/Button$OnPress;Z)V"), index = 1)
private int modifyPageControlsYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIZ)V"), index = 3)
private int modifyPageMessageYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/util/FormattedCharSequence;IIIZ)V"), index = 3)
private int modifyPageComponentsYPos(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@ModifyArg(method = "renderBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/resources/ResourceLocation;IIFFIIII)V"), index = 3)
private int translateRenderBackground(int original) {
return original + (this.height - IMAGE_HEIGHT) / 3;
}

@WrapMethod(method = "getClickedComponentStyleAt")
private Style modifyClickedComponentStyleAtYPos(double x, double y, Operation<Style> original) {
return original.call(x, y - (this.height - IMAGE_HEIGHT) / 3);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dev.isxander.debugify.client.mixins.basic.mc61489;

import dev.isxander.debugify.fixes.BugFix;
import dev.isxander.debugify.fixes.FixCategory;
import net.minecraft.client.gui.screens.inventory.BookViewScreen;
import net.minecraft.client.gui.screens.inventory.LecternScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

// Compared to the original patch, we use / 3 here since it seems to line up better. Else, in a windowed screen the Done button appears at the very bottom / slightly off-screen.
@BugFix(id = "MC-61489", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, modConflicts = "fixbookgui", description = "Book GUI is not vertically centered")
@Mixin(LecternScreen.class)
public class LecternScreenMixin extends BookViewScreen {
@ModifyArg(method = "createMenuControls", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button$Builder;bounds(IIII)Lnet/minecraft/client/gui/components/Button$Builder;"), index = 1)
private int modifyMenuControlsYPos(int original) {
return original + (this.height - BookViewScreen.IMAGE_HEIGHT) / 3;
}
}
3 changes: 3 additions & 0 deletions src/client/resources/debugify.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"basic.mc46766.MinecraftMixin",
"basic.mc577.AbstractContainerScreenMixin",
"basic.mc59810.MouseHandlerMixin",
"basic.mc61489.BookEditScreenMixin",
"basic.mc61489.BookViewScreenMixin",
"basic.mc61489.LecternScreenMixin",
"basic.mc79545.ExperienceBarRendererMixin",
"basic.mc80859.AbstractContainerScreenMixin",
"basic.mc90683.ClientPacketListenerMixin",
Expand Down