nosingleplayer 1.1.1: fond custom via blit + log debug widgets
This commit is contained in:
@@ -5,7 +5,7 @@ loader_version=0.20.0
|
||||
loom_version=1.19.1
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.1.0
|
||||
mod_version=1.1.1
|
||||
maven_group=fr.surviepote
|
||||
archives_base_name=nosingleplayer
|
||||
|
||||
|
||||
+9
@@ -48,6 +48,15 @@ public abstract class TitleScreenMixin {
|
||||
boolean foundMulti = false;
|
||||
|
||||
List<GuiEventListener> toRemove = new ArrayList<>();
|
||||
// TODO DEBUG temporaire : lister les widgets du menu titre.
|
||||
NoSingleplayer.LOGGER.info("[SurviePote] init TAIL, {} widgets:", self.children().size());
|
||||
for (GuiEventListener c : self.children()) {
|
||||
String desc = c.getClass().getSimpleName();
|
||||
if (c instanceof Button b) {
|
||||
desc += " msg=[" + b.getMessage().getString() + "]";
|
||||
}
|
||||
NoSingleplayer.LOGGER.info("[SurviePote] - {}", desc);
|
||||
}
|
||||
for (GuiEventListener child : new ArrayList<>(self.children())) {
|
||||
if (child instanceof Button button) {
|
||||
String msg = button.getMessage().getString();
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package fr.surviepote.nosingleplayer.mixin;
|
||||
|
||||
import com.mojang.realmsclient.gui.screens.RealmsNotificationsScreen;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.components.LogoRenderer;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.resources.Identifier;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public abstract class TitleScreenRenderMixin {
|
||||
|
||||
@Shadow
|
||||
protected int width;
|
||||
|
||||
@Shadow
|
||||
protected int height;
|
||||
|
||||
@Unique
|
||||
private static final Identifier SURVIEPOTE_BACKGROUND = Identifier.fromNamespaceAndPath(
|
||||
"nosingleplayer", "textures/gui/background.png");
|
||||
|
||||
// Taille réelle de background.png (fond plein écran étiré).
|
||||
@Unique
|
||||
private static final int BACKGROUND_TEX_W = 3840;
|
||||
@Unique
|
||||
private static final int BACKGROUND_TEX_H = 2400;
|
||||
|
||||
// Pas de panorama dynamique : fond statique.
|
||||
@Inject(method = "extractPanorama", at = @At("HEAD"), cancellable = true)
|
||||
private void surviepote$skipPanorama(GuiGraphicsExtractor extractor, float partialTick, CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
// Fond plein écran dessiné à la place du panorama (avant widgets/logo/textes).
|
||||
@Inject(method = "extractRenderState",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/gui/screens/TitleScreen;extractPanorama(Lnet/minecraft/client/gui/GuiGraphicsExtractor;F)V",
|
||||
shift = At.Shift.AFTER))
|
||||
private void surviepote$drawBackground(GuiGraphicsExtractor extractor, int mouseX, int mouseY, float partialTick,
|
||||
CallbackInfo ci) {
|
||||
extractor.blit(RenderPipelines.GUI_TEXTURED, SURVIEPOTE_BACKGROUND, 0, 0, 0.0F, 0.0F,
|
||||
this.width, this.height, BACKGROUND_TEX_W, BACKGROUND_TEX_H, -1);
|
||||
}
|
||||
|
||||
// Pas de logo Minecraft.
|
||||
@Redirect(method = "extractRenderState",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/gui/components/LogoRenderer;extractRenderState(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IF)V"))
|
||||
private void surviepote$skipLogo(LogoRenderer logo, GuiGraphicsExtractor extractor, int width, float fade) {
|
||||
}
|
||||
|
||||
// Pas d'overlay Realms.
|
||||
@Redirect(method = "extractRenderState",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lcom/mojang/realmsclient/gui/screens/RealmsNotificationsScreen;extractRenderState(Lnet/minecraft/client/gui/GuiGraphicsExtractor;IIF)V"))
|
||||
private void surviepote$skipRealmsOverlay(RealmsNotificationsScreen notifs, GuiGraphicsExtractor extractor,
|
||||
int mouseX, int mouseY, float partialTick) {
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
"compatibilityLevel": "JAVA_25",
|
||||
"client": [
|
||||
"TitleScreenMixin",
|
||||
"TitleScreenRenderMixin",
|
||||
"TitleScreenTextMixin",
|
||||
"RealmsNotificationsMixin",
|
||||
"ScreenAccessor"
|
||||
|
||||
@@ -42,6 +42,22 @@ tasks.register('downloadMcLibs') {
|
||||
new File(outDir, 'slf4j-api.jar'))
|
||||
dl('https://libraries.minecraft.net/com/mojang/brigadier/1.3.11/brigadier-1.3.11.jar',
|
||||
new File(outDir, 'brigadier.jar'))
|
||||
// Dependances transitives du jar client requises pour compiler contre les classes Mojang
|
||||
// (verifie au javac : sans elles, "class file for Keyable/Nullable not found").
|
||||
dl('https://libraries.minecraft.net/com/mojang/datafixerupper/10.0.21/datafixerupper-10.0.21.jar',
|
||||
new File(outDir, 'datafixerupper.jar'))
|
||||
dl('https://libraries.minecraft.net/org/jspecify/jspecify/1.0.0/jspecify-1.0.0.jar',
|
||||
new File(outDir, 'jspecify.jar'))
|
||||
// fabric-api est un bundle de modules imbriqués (META-INF/jars) : on l'éclate pour le classpath.
|
||||
def fapiBundle = new File(outDir, 'fabric-api-bundle.jar')
|
||||
dl('https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/0.163.0+26.3/fabric-api-0.163.0+26.3.jar',
|
||||
fapiBundle)
|
||||
copy {
|
||||
from { zipTree(fapiBundle) }
|
||||
include 'META-INF/jars/*.jar'
|
||||
into outDir
|
||||
eachFile { it.path = it.name }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user