1
mirror of https://github.com/Shiewk/BedrockDeathScreen.git synced 2026-04-27 22:44:17 +02:00

(1.3.1) 1.21.6-1.21.8 support

This commit is contained in:
Shy
2025-07-25 13:00:25 +02:00
parent 6d02013dc4
commit 5a35e1e8f5
4 changed files with 28 additions and 27 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "maven.modrinth:modmenu:14.0.0-rc.2" modImplementation "maven.modrinth:modmenu:15.0.0-beta.3"
} }
processResources { processResources {
+5 -5
View File
@@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.5 minecraft_version=1.21.6
yarn_mappings=1.21.5+build.1 yarn_mappings=1.21.6+build.1
loader_version=0.16.12 loader_version=0.16.13
# Mod Properties # Mod Properties
mod_version = 1.3.0 mod_version = 1.3.1
maven_group = de.shiewk maven_group = de.shiewk
archives_base_name = BedrockDeathScreen archives_base_name = BedrockDeathScreen
# Dependencies # Dependencies
# check this on https://modmuss50.me/fabric.html # check this on https://modmuss50.me/fabric.html
fabric_version=0.119.5+1.21.5 fabric_version=0.127.0+1.21.6
@@ -3,17 +3,18 @@ package de.shiewk.bedrockdeathscreen.client.screen;
import de.shiewk.bedrockdeathscreen.client.BedrockDeathScreenClient; import de.shiewk.bedrockdeathscreen.client.BedrockDeathScreenClient;
import de.shiewk.bedrockdeathscreen.client.screen.components.BedrockDeathScreenButton; import de.shiewk.bedrockdeathscreen.client.screen.components.BedrockDeathScreenButton;
import de.shiewk.bedrockdeathscreen.config.BedrockDeathScreenConfig; import de.shiewk.bedrockdeathscreen.config.BedrockDeathScreenConfig;
import net.minecraft.client.gl.RenderPipelines;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.DeathScreen; import net.minecraft.client.gui.screen.DeathScreen;
import net.minecraft.client.gui.screen.MessageScreen;
import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.world.ClientWorld;
import net.minecraft.text.MutableText; import net.minecraft.text.MutableText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.joml.Matrix3x2fStack;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import java.awt.*; import java.awt.*;
@@ -58,7 +59,7 @@ public class BedrockDeathScreen extends DeathScreen {
if (totalScreenTime > 750.0f){ if (totalScreenTime > 750.0f){
final int backOpacity = (int) Math.min(255, (totalScreenTime - 750f) / 10f); final int backOpacity = (int) Math.min(255, (totalScreenTime - 750f) / 10f);
context.drawTexture( context.drawTexture(
RenderLayer::getGuiTextured, RenderPipelines.GUI_TEXTURED,
VIGNETTE, VIGNETTE,
0, 0,
0, 0,
@@ -74,10 +75,10 @@ public class BedrockDeathScreen extends DeathScreen {
final int textOpacity = (int) Math.min(255, (totalScreenTime - 750f) / 3f); final int textOpacity = (int) Math.min(255, (totalScreenTime - 750f) / 3f);
if (textOpacity > 3){ if (textOpacity > 3){
context.getMatrices().push(); Matrix3x2fStack stack = context.getMatrices().pushMatrix();
context.getMatrices().scale(2F, 2F, 2F); stack.scale(2F, 2F, stack);
context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2 / 2, (int) (this.height / 3.5 / 2 - 10), new Color(255, 255, 255, textOpacity).getRGB()); context.drawCenteredTextWithShadow(this.textRenderer, this.title, this.width / 2 / 2, (int) (this.height / 3.5 / 2 - 10), new Color(255, 255, 255, textOpacity).getRGB());
context.getMatrices().pop(); stack.popMatrix();
if (message != null) { if (message != null) {
context.drawCenteredTextWithShadow(this.textRenderer, this.message, this.width / 2, (int) (this.height / 3.5), new Color(255, 255, 255, textOpacity).getRGB()); context.drawCenteredTextWithShadow(this.textRenderer, this.message, this.width / 2, (int) (this.height / 3.5), new Color(255, 255, 255, textOpacity).getRGB());
} }
@@ -173,16 +174,6 @@ public class BedrockDeathScreen extends DeathScreen {
return true; return true;
} }
private void quitLevel(){
if (this.client != null && this.client.world != null) {
this.client.world.disconnect();
}
if (this.client != null) {
this.client.disconnect(new MessageScreen(Text.translatable("menu.savingLevel")));
this.client.setScreen(new TitleScreen());
}
}
public float calcCamPitch() { public float calcCamPitch() {
return 20; return 20;
} }
@@ -216,7 +207,7 @@ public class BedrockDeathScreen extends DeathScreen {
private void clickQuitButton() { private void clickQuitButton() {
if (confirmingExit) { if (confirmingExit) {
this.quitLevel(); quitLevel();
} else { } else {
confirmingExit = true; confirmingExit = true;
int y = menuButton.getY(); int y = menuButton.getY();
@@ -227,4 +218,14 @@ public class BedrockDeathScreen extends DeathScreen {
respawnButton.resetClickedState(); respawnButton.resetClickedState();
} }
} }
private void quitLevel() {
assert this.client != null;
if (this.client.world != null) {
this.client.world.disconnect(ClientWorld.QUITTING_MULTIPLAYER_TEXT);
}
this.client.disconnectWithSavingScreen();
this.client.setScreen(new TitleScreen());
}
} }
@@ -20,7 +20,7 @@ public abstract class MixinGameRenderer {
@Shadow @Final private MinecraftClient client; @Shadow @Final private MinecraftClient client;
@Shadow protected abstract void renderHand(Camera camera, float tickDelta, Matrix4f matrix4f); @Shadow protected abstract void renderHand(float tickProgress, boolean sleeping, Matrix4f positionMatrix);
@Inject(at = @At("TAIL"), method = "getFov", cancellable = true) @Inject(at = @At("TAIL"), method = "getFov", cancellable = true)
public void onFovGet(Camera camera, float tickDelta, boolean changingFov, CallbackInfoReturnable<Float> cir){ public void onFovGet(Camera camera, float tickDelta, boolean changingFov, CallbackInfoReturnable<Float> cir){
@@ -38,10 +38,10 @@ public abstract class MixinGameRenderer {
} }
} }
@Redirect(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;renderHand(Lnet/minecraft/client/render/Camera;FLorg/joml/Matrix4f;)V")) @Redirect(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;renderHand(FZLorg/joml/Matrix4f;)V"))
public void onCameraUpdate(GameRenderer instance, Camera camera, float tickDelta, Matrix4f matrix4f){ public void onCameraUpdate(GameRenderer instance, float tickProgress, boolean sleeping, Matrix4f positionMatrix){
if (!(instance.getClient().currentScreen instanceof BedrockDeathScreen)){ if (!(instance.getClient().currentScreen instanceof BedrockDeathScreen)){
renderHand(camera, tickDelta, matrix4f); renderHand(tickProgress, sleeping, positionMatrix);
} }
} }
} }