Skip to content

Commit dba9fc8

Browse files
authored
[1.20.4] [All] Bug: Logo not found even it was found (#92)
Closes #91 This pull request fixes the lambda banner mixin by redirecting the splash overlay `LogoTexture` class' `loadTextureData` which uses internal path segments to resolve resources ![image](https://github.com/user-attachments/assets/a8ce5c98-6f5c-4e90-b4b8-93c0c30d238e)
1 parent f9d6b60 commit dba9fc8

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

common/src/main/java/com/lambda/mixin/render/SplashOverlayMixin.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
package com.lambda.mixin.render;
1919

20+
import com.lambda.util.LambdaResource;
2021
import net.minecraft.client.gui.screen.SplashOverlay;
22+
import net.minecraft.client.texture.ResourceTexture;
23+
import net.minecraft.resource.DefaultResourcePack;
24+
import net.minecraft.resource.InputSupplier;
25+
import net.minecraft.resource.ResourceType;
2126
import net.minecraft.util.Identifier;
2227
import net.minecraft.util.math.ColorHelper;
2328
import org.spongepowered.asm.mixin.Final;
@@ -29,6 +34,7 @@
2934
import org.spongepowered.asm.mixin.injection.Redirect;
3035
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3136

37+
import java.io.InputStream;
3238
import java.util.function.IntSupplier;
3339

3440
@Mixin(SplashOverlay.class)
@@ -47,4 +53,16 @@ private int redirectBrandArgb(IntSupplier originalSupplier) {
4753
private void onInit(CallbackInfo ci) {
4854
LOGO = Identifier.of("lambda", "textures/lambda_banner.png");
4955
}
56+
57+
@Mixin(SplashOverlay.LogoTexture.class)
58+
static class LogoTextureMixin extends ResourceTexture {
59+
@Redirect(method = "loadTextureData", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/DefaultResourcePack;open(Lnet/minecraft/resource/ResourceType;Lnet/minecraft/util/Identifier;)Lnet/minecraft/resource/InputSupplier;"))
60+
InputSupplier<InputStream> loadTextureData(DefaultResourcePack instance, ResourceType type, Identifier id) {
61+
return () -> new LambdaResource("textures/lambda_banner.png").getStream();
62+
}
63+
64+
public LogoTextureMixin(Identifier location) {
65+
super(location);
66+
}
67+
}
5068
}

common/src/main/resources/lambda.accesswidener

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ accessible method net/minecraft/client/render/Camera setRotation (FF)V
3535
accessible field com/mojang/blaze3d/systems/RenderSystem$ShapeIndexBuffer id I
3636
accessible field net/minecraft/client/render/BufferRenderer currentVertexBuffer Lnet/minecraft/client/gl/VertexBuffer;
3737
accessible field net/minecraft/client/texture/NativeImage pointer J
38+
accessible class net/minecraft/client/gui/screen/SplashOverlay$LogoTexture
3839

3940
# Text
4041
accessible field net/minecraft/text/Style color Lnet/minecraft/text/TextColor;

common/src/main/resources/lambda.mixins.common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"render.RenderTickCounterMixin",
4242
"render.ScreenHandlerMixin",
4343
"render.SplashOverlayMixin",
44+
"render.SplashOverlayMixin$LogoTextureMixin",
4445
"render.VertexBufferMixin",
4546
"render.WorldRendererMixin",
4647
"world.BlockCollisionSpliteratorMixin",

0 commit comments

Comments
 (0)