Skip to content

Commit

Permalink
update to 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
moehreag committed Jan 28, 2024
1 parent 008434f commit 0d70742
Show file tree
Hide file tree
Showing 35 changed files with 146 additions and 144 deletions.
4 changes: 0 additions & 4 deletions 1.20/src/main/java/io/github/axolotlclient/AxolotlClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
import org.quiltmc.loader.api.QuiltLoader;
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
import org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents;
import org.quiltmc.qsl.resource.loader.api.ResourceLoader;
import org.quiltmc.qsl.resource.loader.api.ResourcePackActivationType;

public class AxolotlClient implements ClientModInitializer {

Expand Down Expand Up @@ -187,8 +185,6 @@ public void onInitializeClient(ModContainer container) {

modules.forEach(Module::lateInit);

ResourceLoader.registerBuiltinResourcePack(new Identifier("axolotlclient", "axolotlclient-ui"), container,
ResourcePackActivationType.NORMAL);
ClientTickEvents.END.register(client -> tickClient());

FeatureDisabler.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ElementListWidget;
import net.minecraft.client.gui.widget.EntryListWidget;
import net.minecraft.client.gui.widget.button.ButtonWidget;
import net.minecraft.client.gui.widget.list.ElementListWidget;
import net.minecraft.client.gui.widget.list.EntryListWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.sound.SoundInstance;
Expand Down Expand Up @@ -75,16 +75,6 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float tickDelta
MinecraftClient.getInstance().getSoundManager().play(bgm);
}

renderBackground(graphics);
if (AxolotlClient.someNiceBackground.get()) { // Credit to pridelib for the colors
graphics.fill(0, 0, width, height / 6, 0xFFff0018);
graphics.fill(0, height / 6, width, height * 2 / 6, 0xFFffa52c);
graphics.fill(0, height * 2 / 6, width, height / 2, 0xFFffff41);
graphics.fill(0, height * 2 / 3, width, height * 5 / 6, 0xFF0000f9);
graphics.fill(0, height / 2, width, height * 2 / 3, 0xFF008018);
graphics.fill(0, height * 5 / 6, width, height, 0xFF86007d);
}

super.render(graphics, mouseX, mouseY, tickDelta);

DrawUtil.drawCenteredString(graphics, this.textRenderer, I18n.translate("credits"), width / 2, 20, -1, true);
Expand All @@ -96,6 +86,19 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float tickDelta
}
}

@Override
public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
super.renderBackground(graphics, mouseX, mouseY, delta);
if (AxolotlClient.someNiceBackground.get()) { // Credit to pridelib for the colors
graphics.fill(0, 0, width, height / 6, 0xFFff0018);
graphics.fill(0, height / 6, width, height * 2 / 6, 0xFFffa52c);
graphics.fill(0, height * 2 / 6, width, height / 2, 0xFFffff41);
graphics.fill(0, height * 2 / 3, width, height * 5 / 6, 0xFF0000f9);
graphics.fill(0, height / 2, width, height * 2 / 3, 0xFF008018);
graphics.fill(0, height * 5 / 6, width, height, 0xFF86007d);
}
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == InputUtil.KEY_ESCAPE_CODE) {
Expand Down Expand Up @@ -125,9 +128,9 @@ public void init() {
initCredits();

creditsList = new CreditsList(client, width, height, 50, height - 50, 25);
addSelectableChild(creditsList);
addSelectableElement(creditsList);

this.addDrawableChild(new ButtonWidget.Builder(CommonTexts.BACK, buttonWidget -> {
this.addDrawableSelectableElement(new ButtonWidget.Builder(CommonTexts.BACK, buttonWidget -> {
if (creditOverlay == null) {
MinecraftClient.getInstance().setScreen(parent);
stopBGM();
Expand All @@ -136,7 +139,7 @@ public void init() {
}
}).positionAndSize(width / 2 - 75, height - 50 + 22, 150, 20).build());

this.addDrawableChild(new ButtonWidget.Builder(Text.translatable("creditsBGM").append(": ")
this.addDrawableSelectableElement(new ButtonWidget.Builder(Text.translatable("creditsBGM").append(": ")
.append(Text.translatable(AxolotlClient.CONFIG.creditsBGM.get() ? "options.on" : "options.off")),
buttonWidget -> {
AxolotlClient.CONFIG.creditsBGM.toggle();
Expand Down Expand Up @@ -207,8 +210,8 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double del
}

@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
return super.mouseScrolled(mouseX, mouseY, amount) || creditsList.mouseScrolled(mouseX, mouseY, amount);
public boolean mouseScrolled(double mouseX, double mouseY, double amountX, double amountY) {
return super.mouseScrolled(mouseX, mouseY, amountX, amountY) || creditsList.mouseScrolled(mouseX, mouseY, amountX, amountY);
}

private class CreditsList extends ElementListWidget<Credit> {
Expand All @@ -218,7 +221,6 @@ public CreditsList(MinecraftClient minecraftClient, int width, int height, int t
super(minecraftClient, width, height, top, bottom, entryHeight);

this.setRenderBackground(false);
this.setRenderHorizontalShadows(false);
this.setRenderHeader(false, 0);

for (Credit c : credits) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.Map;
import java.util.UUID;

import net.minecraft.client.gui.hud.BossBarHud;
import net.minecraft.client.gui.hud.ClientBossBar;
import net.minecraft.client.gui.hud.boss_bar.BossBarHud;
import net.minecraft.client.gui.hud.boss_bar.ClientBossBar;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(net.minecraft.client.gui.hud.BossBarHud.class)
@Mixin(net.minecraft.client.gui.hud.boss_bar.BossBarHud.class)
public abstract class BossBarHudMixin {

@Inject(method = "render", at = @At("HEAD"), cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import io.github.axolotlclient.modules.hypixel.nickhider.NickHider;
import io.github.axolotlclient.util.events.Events;
import io.github.axolotlclient.util.events.impl.ReceiveChatMessageEvent;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.gui.hud.ChatMessageTag;
import net.minecraft.client.gui.hud.chat.ChatHud;
import net.minecraft.client.gui.hud.chat.ChatMessageTag;
import net.minecraft.network.message.MessageSignature;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -39,14 +39,14 @@
@Mixin(ChatHud.class)
public abstract class ChatHudMixin {

@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;Lnet/minecraft/client/gui/hud/ChatMessageTag;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;logChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/hud/ChatMessageTag;)V"), cancellable = true)
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;Lnet/minecraft/client/gui/hud/chat/ChatMessageTag;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/chat/ChatHud;logChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/hud/chat/ChatMessageTag;)V"), cancellable = true)
public void axolotlclient$autoThings(Text message, MessageSignature signature, ChatMessageTag tag, CallbackInfo ci) {
if (message == null) {
ci.cancel();
}
}

@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;Lnet/minecraft/client/gui/hud/ChatMessageTag;)V", at = @At("HEAD"), argsOnly = true)
@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;Lnet/minecraft/client/gui/hud/chat/ChatMessageTag;)V", at = @At("HEAD"), argsOnly = true)
private Text axolotlclient$onChatMessage(Text message) {
ReceiveChatMessageEvent event = new ReceiveChatMessageEvent(false, message.getString(), message);
Events.RECEIVE_CHAT_MESSAGE_EVENT.invoker().invoke(event);
Expand All @@ -58,7 +58,7 @@ public abstract class ChatHudMixin {
return message;
}

@ModifyArg(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;Lnet/minecraft/client/gui/hud/ChatMessageTag;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;ILnet/minecraft/client/gui/hud/ChatMessageTag;Z)V"), index = 0)
@ModifyArg(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;Lnet/minecraft/client/gui/hud/chat/ChatMessageTag;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/chat/ChatHud;addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignature;ILnet/minecraft/client/gui/hud/chat/ChatMessageTag;Z)V"), index = 0)
public Text axolotlclient$editChat(Text message) {
return NickHider.getInstance().editMessage(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import io.github.axolotlclient.modules.hud.HudManager;
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.CrosshairHud;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.hud.DebugHud;
import net.minecraft.client.gui.hud.debug.DebugHud;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.github.axolotlclient.modules.hypixel.HypixelMods;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.button.ButtonWidget;
import net.minecraft.text.Text;
import org.quiltmc.loader.api.QuiltLoader;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -42,7 +42,7 @@
@Mixin(GameMenuScreen.class)
public abstract class GameMenuScreenMixin {

@Redirect(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/GameMenuScreen;createLinkConfirmationButton(Lnet/minecraft/text/Text;Ljava/lang/String;)Lnet/minecraft/client/gui/widget/ButtonWidget;", ordinal = 1))
@Redirect(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/GameMenuScreen;createLinkConfirmationButton(Lnet/minecraft/text/Text;Ljava/lang/String;)Lnet/minecraft/client/gui/widget/button/ButtonWidget;", ordinal = 1))
private ButtonWidget axolotlclient$addClientOptionsButton(GameMenuScreen instance, Text text, String string) {
if (axolotlclient$hasModMenu())
return createLinkConfirmationButton(text, string);
Expand All @@ -60,7 +60,7 @@ public abstract class GameMenuScreenMixin {
@Shadow
protected abstract ButtonWidget createButton(Text par1, Supplier<Screen> par2);

@ModifyArg(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/ButtonWidget;builder(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/ButtonWidget$PressAction;)Lnet/minecraft/client/gui/widget/ButtonWidget$Builder;", ordinal = 1), index = 1)
@ModifyArg(method = "initWidgets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/button/ButtonWidget;builder(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/button/ButtonWidget$PressAction;)Lnet/minecraft/client/gui/widget/button/ButtonWidget$Builder;", ordinal = 1), index = 1)
private ButtonWidget.PressAction axolotlclient$clearFeatureRestrictions(ButtonWidget.PressAction onPress) {
return (buttonWidget) -> {
if (Objects.equals(HypixelMods.getInstance().cacheMode.get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public abstract class GameRendererMixin {
}
}

@Inject(method = "bobViewWhenHurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getCameraEntity()Lnet/minecraft/entity/Entity;", ordinal = 1), cancellable = true)
@Inject(method = "bobViewWhenHurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getCameraEntity()Lnet/minecraft/entity/Entity;"), cancellable = true)
private void axolotlclient$noHurtCam(MatrixStack matrixStack, float f, CallbackInfo ci){
if(AxolotlClient.CONFIG.noHurtCam.get()){
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.gui.hud.in_game.InGameHud;
import net.minecraft.entity.Entity;
import net.minecraft.scoreboard.ScoreboardObjective;
import net.minecraft.text.StringVisitable;
Expand All @@ -62,7 +62,7 @@ public abstract class InGameHudMixin {
@Shadow
private int overlayRemaining;

@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderStatusEffectOverlay(Lnet/minecraft/client/gui/GuiGraphics;)V"))
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/in_game/InGameHud;renderStatusEffectOverlay(Lnet/minecraft/client/gui/GuiGraphics;)V"))
private void axolotlclient$onHudRender(GuiGraphics graphics, float tickDelta, CallbackInfo ci) {
if (!MinecraftClient.getInstance().options.hudHidden) {
HudManager.getInstance().render(graphics, tickDelta);
Expand All @@ -81,7 +81,7 @@ public abstract class InGameHudMixin {
public void axolotlclient$renderCrosshair(GuiGraphics graphics, CallbackInfo ci) {
CrosshairHud hud = (CrosshairHud) HudManager.getInstance().get(CrosshairHud.ID);
if (hud != null && hud.isEnabled()) {
if (MinecraftClient.getInstance().options.debugEnabled && !hud.overridesF3()) {
if (MinecraftClient.getInstance().method_53526().chartsVisible() && !hud.overridesF3()) {
return;
}
ci.cancel();
Expand All @@ -98,7 +98,7 @@ public abstract class InGameHudMixin {
}
}

@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;overlayMessage:Lnet/minecraft/text/Text;", ordinal = 0))
@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/in_game/InGameHud;overlayMessage:Lnet/minecraft/text/Text;", ordinal = 0))
public void axolotlclient$clearActionBar(GuiGraphics graphics, float tickDelta, CallbackInfo ci) {
ActionBarHud hud = (ActionBarHud) HudManager.getInstance().get(ActionBarHud.ID);
if (hud != null && hud.isEnabled()) {
Expand Down Expand Up @@ -138,7 +138,7 @@ public abstract class InGameHudMixin {
}
}

@ModifyArgs(method = "renderMountJumpBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"))
@ModifyArgs(method = "renderMountJumpBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"))
public void axolotlclient$moveHorseHealth(Args args) {
HotbarHUD hud = (HotbarHUD) HudManager.getInstance().get(HotbarHUD.ID);
if (hud.isEnabled()) {
Expand All @@ -147,7 +147,7 @@ public abstract class InGameHudMixin {
}
}

@ModifyArgs(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"))
@ModifyArgs(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"))
public void axolotlclient$moveXPBar(Args args) {
HotbarHUD hud = (HotbarHUD) HudManager.getInstance().get(HotbarHUD.ID);
if (hud.isEnabled()) {
Expand All @@ -156,7 +156,7 @@ public abstract class InGameHudMixin {
}
}

@Redirect(method = "renderExperienceBar", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledHeight:I"))
@Redirect(method = "renderExperienceBar", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/in_game/InGameHud;scaledHeight:I"))
public int axolotlclient$moveXPBarHeight(InGameHud instance) {
HotbarHUD hud = (HotbarHUD) HudManager.getInstance().get(HotbarHUD.ID);
if (hud.isEnabled()) {
Expand All @@ -165,7 +165,7 @@ public abstract class InGameHudMixin {
return scaledHeight;
}

@Redirect(method = "renderExperienceBar", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledWidth:I"))
@Redirect(method = "renderExperienceBar", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/in_game/InGameHud;scaledWidth:I"))
public int axolotlclient$moveXPBarWidth(InGameHud instance) {
HotbarHUD hud = (HotbarHUD) HudManager.getInstance().get(HotbarHUD.ID);
if (hud.isEnabled()) {
Expand All @@ -174,7 +174,7 @@ public abstract class InGameHudMixin {
return scaledWidth;
}

@Redirect(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledHeight:I"))
@Redirect(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/in_game/InGameHud;scaledHeight:I"))
public int axolotlclient$moveStatusBarsHeight(InGameHud instance) {
HotbarHUD hud = (HotbarHUD) HudManager.getInstance().get(HotbarHUD.ID);
if (hud.isEnabled()) {
Expand All @@ -183,7 +183,7 @@ public abstract class InGameHudMixin {
return scaledHeight;
}

@Redirect(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledWidth:I"))
@Redirect(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/in_game/InGameHud;scaledWidth:I"))
public int axolotlclient$moveStatusBarsWidth(InGameHud instance) {
HotbarHUD hud = (HotbarHUD) HudManager.getInstance().get(HotbarHUD.ID);
if (hud.isEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import io.github.axolotlclient.AxolotlClient;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.InGameOverlayRenderer;
import net.minecraft.client.gui.hud.in_game.InGameOverlayRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package io.github.axolotlclient.mixin;

import com.mojang.authlib.minecraft.UserApiService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.multiplayer.report.chat.ChatReportingContext;
import net.minecraft.client.network.SocialInteractionsManager;
Expand Down Expand Up @@ -59,4 +60,7 @@ static int getCurrentFps() {
@Accessor
@Mutable
void setUserApiService(UserApiService service);

@Accessor
YggdrasilAuthenticationService getAuthService();
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class MouseMixin {
}
}

@Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDD)Z"))
@Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDDD)Z"))
public void axolotlclient$scrollTooltips(long window, double scrollDeltaX, double scrollDeltaY, CallbackInfo ci) {
if (ScrollableTooltips.getInstance().enabled.get() && Math.signum(scrollDeltaY) != 0) {
ScrollableTooltips.getInstance().onScroll(Math.signum(scrollDeltaY) > 0);
Expand Down
Loading

0 comments on commit 0d70742

Please sign in to comment.