mirror of
https://github.com/Shiewk/BedrockDeathScreen.git
synced 2026-04-27 22:44:17 +02:00
1.21.9 support
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.10.1'
|
id 'fabric-loom' version "1.11-SNAPSHOT"
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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:15.0.0-beta.3"
|
modImplementation "maven.modrinth:modmenu:${project.modmenu_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|||||||
+5
-4
@@ -3,9 +3,9 @@ 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.6
|
minecraft_version=1.21.9
|
||||||
yarn_mappings=1.21.6+build.1
|
yarn_mappings=1.21.9+build.1
|
||||||
loader_version=0.16.13
|
loader_version=0.17.2
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.3.1
|
mod_version = 1.3.1
|
||||||
@@ -14,4 +14,5 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# check this on https://modmuss50.me/fabric.html
|
# check this on https://modmuss50.me/fabric.html
|
||||||
fabric_version=0.127.0+1.21.6
|
fabric_version=0.134.0+1.21.9
|
||||||
|
modmenu_version=16.0.0-rc.1
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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.gl.RenderPipelines;
|
||||||
|
import net.minecraft.client.gui.Click;
|
||||||
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.TitleScreen;
|
import net.minecraft.client.gui.screen.TitleScreen;
|
||||||
@@ -15,13 +16,11 @@ 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.joml.Matrix3x2fStack;
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class BedrockDeathScreen extends DeathScreen {
|
public class BedrockDeathScreen extends DeathScreen {
|
||||||
|
|
||||||
public static final long CURSOR_HAND = GLFW.glfwCreateStandardCursor(GLFW.GLFW_POINTING_HAND_CURSOR);
|
|
||||||
public static final Identifier VIGNETTE = Identifier.of("bedrockdeathscreen", "textures/gui/death_vignette.png");
|
public static final Identifier VIGNETTE = Identifier.of("bedrockdeathscreen", "textures/gui/death_vignette.png");
|
||||||
|
|
||||||
private final BedrockDeathScreenConfig config;
|
private final BedrockDeathScreenConfig config;
|
||||||
@@ -100,13 +99,6 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
boolean hoveringButton = menuButton.isHovered() || respawnButton.isHovered();
|
boolean hoveringButton = menuButton.isHovered() || respawnButton.isHovered();
|
||||||
if (hoveringButton != wasHoveringButtons){
|
if (hoveringButton != wasHoveringButtons){
|
||||||
wasHoveringButtons = hoveringButton;
|
wasHoveringButtons = hoveringButton;
|
||||||
assert client != null;
|
|
||||||
long window = client.getWindow().getHandle();
|
|
||||||
if (hoveringButton){
|
|
||||||
GLFW.glfwSetCursor(window, CURSOR_HAND);
|
|
||||||
} else {
|
|
||||||
GLFW.glfwSetCursor(window, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -162,15 +154,15 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
public boolean mouseClicked(Click click, boolean doubled) {
|
||||||
if (respawnButton.mouseClicked(mouseX, mouseY, button)) return true;
|
if (respawnButton.mouseClicked(click, doubled)) return true;
|
||||||
return menuButton.mouseClicked(mouseX, mouseY, button);
|
return menuButton.mouseClicked(click, doubled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
public boolean mouseReleased(Click click) {
|
||||||
respawnButton.mouseReleased(mouseX, mouseY, button);
|
respawnButton.mouseReleased(click);
|
||||||
menuButton.mouseReleased(mouseX, mouseY, button);
|
menuButton.mouseReleased(click);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,22 +181,6 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
return (float) (ep / (1d + ep) * 7d + 2d);
|
return (float) (ep / (1d + ep) * 7d + 2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
assert client != null;
|
|
||||||
long window = client.getWindow().getHandle();
|
|
||||||
GLFW.glfwSetCursor(window, 0);
|
|
||||||
super.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removed() {
|
|
||||||
assert client != null;
|
|
||||||
long window = client.getWindow().getHandle();
|
|
||||||
GLFW.glfwSetCursor(window, 0);
|
|
||||||
super.removed();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clickQuitButton() {
|
private void clickQuitButton() {
|
||||||
if (confirmingExit) {
|
if (confirmingExit) {
|
||||||
quitLevel();
|
quitLevel();
|
||||||
|
|||||||
+14
-8
@@ -1,7 +1,9 @@
|
|||||||
package de.shiewk.bedrockdeathscreen.client.screen.components;
|
package de.shiewk.bedrockdeathscreen.client.screen.components;
|
||||||
|
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.Click;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.cursor.StandardCursors;
|
||||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||||
import net.minecraft.client.sound.SoundManager;
|
import net.minecraft.client.sound.SoundManager;
|
||||||
@@ -57,6 +59,10 @@ public class BedrockDeathScreenButton extends ClickableWidget {
|
|||||||
protected void renderWidget(DrawContext context, int mouseX, int mouseY, float deltaTicks) {
|
protected void renderWidget(DrawContext context, int mouseX, int mouseY, float deltaTicks) {
|
||||||
final boolean mouseHover = isHovered();
|
final boolean mouseHover = isHovered();
|
||||||
|
|
||||||
|
if (mouseHover) {
|
||||||
|
context.setCursor(StandardCursors.POINTING_HAND);
|
||||||
|
}
|
||||||
|
|
||||||
final int opacity = getOpacity();
|
final int opacity = getOpacity();
|
||||||
if (opacity < 4) return;
|
if (opacity < 4) return;
|
||||||
final int startX = getX();
|
final int startX = getX();
|
||||||
@@ -67,13 +73,13 @@ public class BedrockDeathScreenButton extends ClickableWidget {
|
|||||||
boolean shouldAppearPressed = pressed || clicked;
|
boolean shouldAppearPressed = pressed || clicked;
|
||||||
if (shouldAppearPressed){
|
if (shouldAppearPressed){
|
||||||
context.fill(startX+2, startY+4, endX-2, endY+2, changeColorOpacity(colorPrimaryPressed, opacity));
|
context.fill(startX+2, startY+4, endX-2, endY+2, changeColorOpacity(colorPrimaryPressed, opacity));
|
||||||
context.drawBorder(startX+1, startY+3, (endX-1) - (startX+1), (endY+1) - (startY+1), changeColorOpacity(colorBorderPressed, opacity));
|
context.drawStrokedRectangle(startX+1, startY+3, (endX-1) - (startX+1), (endY+1) - (startY+1), changeColorOpacity(colorBorderPressed, opacity));
|
||||||
context.drawBorder(startX, startY+2, endX - startX, (endY+2) - startY, changeColorOpacity(colorBlack, opacity));
|
context.drawStrokedRectangle(startX, startY+2, endX - startX, (endY+2) - startY, changeColorOpacity(colorBlack, opacity));
|
||||||
} else {
|
} else {
|
||||||
context.fill(startX+2, startY+2, endX-2, endY-1, (mouseHover ? changeColorOpacity(colorHover, opacity) : changeColorOpacity(colorPrimary, opacity)));
|
context.fill(startX+2, startY+2, endX-2, endY-1, (mouseHover ? changeColorOpacity(colorHover, opacity) : changeColorOpacity(colorPrimary, opacity)));
|
||||||
context.drawBorder(startX+1, startY+1, (endX-1) - (startX+1), (endY) - (startY+1), changeColorOpacity(colorBorder, opacity));
|
context.drawStrokedRectangle(startX+1, startY+1, (endX-1) - (startX+1), (endY) - (startY+1), changeColorOpacity(colorBorder, opacity));
|
||||||
context.fill(startX+1, endY, endX-1, endY+3, changeColorOpacity(colorSecondary, opacity));
|
context.fill(startX+1, endY, endX-1, endY+3, changeColorOpacity(colorSecondary, opacity));
|
||||||
context.drawBorder(startX, startY, endX - startX, (endY+4) - startY, changeColorOpacity(colorBlack, opacity));
|
context.drawStrokedRectangle(startX, startY, endX - startX, (endY+4) - startY, changeColorOpacity(colorBlack, opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textShadow){
|
if (textShadow){
|
||||||
@@ -97,12 +103,12 @@ public class BedrockDeathScreenButton extends ClickableWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(double mouseX, double mouseY) {
|
public void onClick(Click click, boolean doubled) {
|
||||||
pressed = true;
|
pressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRelease(double mouseX, double mouseY) {
|
public void onRelease(Click click) {
|
||||||
if (pressed && hovered) {
|
if (pressed && hovered) {
|
||||||
clicked = true;
|
clicked = true;
|
||||||
clickAction.run();
|
clickAction.run();
|
||||||
@@ -119,9 +125,9 @@ public class BedrockDeathScreenButton extends ClickableWidget {
|
|||||||
protected void appendClickableNarrations(NarrationMessageBuilder builder) {}
|
protected void appendClickableNarrations(NarrationMessageBuilder builder) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
public boolean mouseClicked(Click click, boolean doubled) {
|
||||||
if (getOpacity() > 0){
|
if (getOpacity() > 0){
|
||||||
return super.mouseClicked(mouseX, mouseY, button);
|
return super.mouseClicked(click, doubled);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,32 +2,28 @@ package de.shiewk.bedrockdeathscreen.mixin;
|
|||||||
|
|
||||||
import de.shiewk.bedrockdeathscreen.client.screen.BedrockDeathScreen;
|
import de.shiewk.bedrockdeathscreen.client.screen.BedrockDeathScreen;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.DeathScreen;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
@Mixin(MinecraftClient.class)
|
@Mixin(MinecraftClient.class)
|
||||||
public class MixinMinecraftClient {
|
public class MixinMinecraftClient {
|
||||||
|
|
||||||
@Shadow @Nullable public ClientWorld world;
|
@Shadow
|
||||||
|
@Nullable
|
||||||
|
public ClientWorld world;
|
||||||
|
|
||||||
@ModifyVariable(
|
@Redirect(
|
||||||
method = "setScreen",
|
method = "setScreen",
|
||||||
at = @At("STORE"),
|
at = @At(value = "NEW", target = "(Lnet/minecraft/text/Text;Z)Lnet/minecraft/client/gui/screen/DeathScreen;")
|
||||||
name = "screen",
|
|
||||||
index = 1,
|
|
||||||
argsOnly = true
|
|
||||||
)
|
)
|
||||||
public Screen onCreateDeathScreen(Screen value){
|
public DeathScreen bedrockdeathscreen$createModifiedDeathScreen(Text message, boolean isHardcore){
|
||||||
if (world != null){
|
return new BedrockDeathScreen(null, world != null && world.getLevelProperties().isHardcore());
|
||||||
return new BedrockDeathScreen(null, world.getLevelProperties().isHardcore());
|
|
||||||
} else {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user