From 71a9c57bcf72e787e45daf1733379aa3938ebd87 Mon Sep 17 00:00:00 2001 From: Ryan Garrett Date: Sun, 7 Jan 2024 02:15:22 -0500 Subject: [PATCH] Fix easter egg logo --- .../vistas/mixin/GameRendererMixin.java | 28 +++++++++---------- .../vistas/mixin/LogoDrawerMixin.java | 6 ++-- .../vistas/mixin/MinecraftClientMixin.java | 22 +++++++-------- .../SplashTextResourceSupplierMixin.java | 14 ++++------ 4 files changed, 32 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/terraformersmc/vistas/mixin/GameRendererMixin.java b/src/main/java/com/terraformersmc/vistas/mixin/GameRendererMixin.java index 1810d8c..20baae3 100644 --- a/src/main/java/com/terraformersmc/vistas/mixin/GameRendererMixin.java +++ b/src/main/java/com/terraformersmc/vistas/mixin/GameRendererMixin.java @@ -7,25 +7,10 @@ */ package com.terraformersmc.vistas.mixin; -import java.io.File; -import java.nio.file.Path; -import java.util.Optional; - -import net.minecraft.text.Text; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - import com.mojang.datafixers.util.Pair; import com.terraformersmc.vistas.Vistas; import com.terraformersmc.vistas.config.VistasConfig; import com.terraformersmc.vistas.resource.PanoramicScreenshots; - import net.minecraft.client.MinecraftClient; import net.minecraft.client.gl.Framebuffer; import net.minecraft.client.gl.SimpleFramebuffer; @@ -34,9 +19,22 @@ import net.minecraft.client.util.ScreenshotRecorder; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.ClickEvent; +import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.Util; import net.minecraft.util.math.Direction; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.io.File; +import java.nio.file.Path; +import java.util.Optional; // TODO: rewrite; i dont know what im doing! @Mixin(GameRenderer.class) diff --git a/src/main/java/com/terraformersmc/vistas/mixin/LogoDrawerMixin.java b/src/main/java/com/terraformersmc/vistas/mixin/LogoDrawerMixin.java index 9164bcb..6ea8416 100644 --- a/src/main/java/com/terraformersmc/vistas/mixin/LogoDrawerMixin.java +++ b/src/main/java/com/terraformersmc/vistas/mixin/LogoDrawerMixin.java @@ -24,7 +24,7 @@ public abstract class LogoDrawerMixin implements LogoDrawerAccessor { @Shadow @Final public static Identifier LOGO_TEXTURE; @Unique - private boolean isVistas = false; + private boolean isVistas = true; @Redirect(method = "draw(Lnet/minecraft/client/gui/DrawContext;IFI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIFFIIII)V", ordinal = 0)) private void vistas$render$drawOutline(DrawContext context, Identifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight, DrawContext _context, int screenWidth) { @@ -39,7 +39,7 @@ public abstract class LogoDrawerMixin implements LogoDrawerAccessor { matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees((float) logo.getLogoRot())); matrices.translate(-(screenWidth / 2.0D), -(y * 2.0D) + (y / 2.0D), 0.0D); - // TODO: Vistas logo is squished + // TODO: Outline rendering no longer works if (!logo.getLogoId().equals(LOGO_TEXTURE) || this.isVistas) { //RenderSystem.setShaderTexture(0, this.isVistas ? Vistas.id("textures/vistas_logo.png") : logo.getLogoId()); int rx = (screenWidth / 2) - 256; @@ -59,7 +59,7 @@ public abstract class LogoDrawerMixin implements LogoDrawerAccessor { // renderAction.accept(x, y); // } - context.drawTexture( Vistas.id("textures/vistas_logo.png"), x, y, u, v, width, height, textureWidth, textureHeight); + context.drawTexture(logo.getLogoId(), x, y, u, v, width, height, textureWidth, textureHeight); } diff --git a/src/main/java/com/terraformersmc/vistas/mixin/MinecraftClientMixin.java b/src/main/java/com/terraformersmc/vistas/mixin/MinecraftClientMixin.java index 90d2728..24254e2 100644 --- a/src/main/java/com/terraformersmc/vistas/mixin/MinecraftClientMixin.java +++ b/src/main/java/com/terraformersmc/vistas/mixin/MinecraftClientMixin.java @@ -1,20 +1,8 @@ package com.terraformersmc.vistas.mixin; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - import com.terraformersmc.vistas.access.MinecraftClientAccess; import com.terraformersmc.vistas.resource.PanoramaResourceReloader; import com.terraformersmc.vistas.title.VistasTitle; - import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; @@ -22,6 +10,16 @@ import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.resource.ReloadableResourceManagerImpl; import net.minecraft.sound.MusicSound; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Environment(EnvType.CLIENT) @Mixin(MinecraftClient.class) diff --git a/src/main/java/com/terraformersmc/vistas/mixin/SplashTextResourceSupplierMixin.java b/src/main/java/com/terraformersmc/vistas/mixin/SplashTextResourceSupplierMixin.java index 82201b7..dff77d5 100644 --- a/src/main/java/com/terraformersmc/vistas/mixin/SplashTextResourceSupplierMixin.java +++ b/src/main/java/com/terraformersmc/vistas/mixin/SplashTextResourceSupplierMixin.java @@ -1,21 +1,19 @@ package com.terraformersmc.vistas.mixin; +import com.terraformersmc.vistas.access.MinecraftClientAccess; +import com.terraformersmc.vistas.resource.PanoramaResourceReloader; import com.terraformersmc.vistas.title.VistasTitle; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.SplashTextRenderer; +import net.minecraft.client.resource.SplashTextResourceSupplier; import net.minecraft.util.Identifier; 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; -import com.terraformersmc.vistas.access.MinecraftClientAccess; -import com.terraformersmc.vistas.resource.PanoramaResourceReloader; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.resource.SplashTextResourceSupplier; - @Environment(EnvType.CLIENT) @Mixin(SplashTextResourceSupplier.class) public class SplashTextResourceSupplierMixin {