mirror of
https://github.com/Shiewk/BedrockDeathScreen.git
synced 2026-04-27 22:44:17 +02:00
Use main branch for development from now on (#2)
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id 'fabric-loom' version '1.8.9'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -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
|
minecraft_version=1.21.3
|
||||||
yarn_mappings=1.21+build.9
|
yarn_mappings=1.21.3+build.2
|
||||||
loader_version=0.15.11
|
loader_version=0.16.8
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2.0
|
mod_version = 1.2.2
|
||||||
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.100.6+1.21
|
fabric_version=0.106.1+1.21.3
|
||||||
|
|||||||
+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.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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 org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -17,6 +18,7 @@ import java.awt.*;
|
|||||||
public class BedrockDeathScreen extends DeathScreen {
|
public class BedrockDeathScreen extends DeathScreen {
|
||||||
|
|
||||||
private int ticksSinceDeath = 0;
|
private int ticksSinceDeath = 0;
|
||||||
|
private long screenTime = 0;
|
||||||
private final Text message;
|
private final Text message;
|
||||||
private Text scoreText = Text.empty();
|
private Text scoreText = Text.empty();
|
||||||
private static final Text menuMessage = Text.translatable("deathScreen.titleScreen");
|
private static final Text menuMessage = Text.translatable("deathScreen.titleScreen");
|
||||||
@@ -31,6 +33,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
super(message, isHardcore);
|
super(message, isHardcore);
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.hardcore = isHardcore;
|
this.hardcore = isHardcore;
|
||||||
|
screenTime = Util.getMeasuringTimeNano();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hoversRespawn(int mouseX, int mouseY){
|
private boolean hoversRespawn(int mouseX, int mouseY){
|
||||||
@@ -38,7 +41,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
int startY = height - height / 3 - 9;
|
int startY = height - height / 3 - 9;
|
||||||
int endX = width/2 + 75;
|
int endX = width/2 + 75;
|
||||||
int endY = height - height / 3 + 13;
|
int endY = height - height / 3 + 13;
|
||||||
return getTotalDelta(0) > 1050 &&
|
return getTotalDelta() > 1050 &&
|
||||||
mouseX > startX &&
|
mouseX > startX &&
|
||||||
mouseX < endX &&
|
mouseX < endX &&
|
||||||
mouseY > startY &&
|
mouseY > startY &&
|
||||||
@@ -50,7 +53,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
final int startY = height - height / 3 - 9 + 30;
|
final int startY = height - height / 3 - 9 + 30;
|
||||||
final int endX = width/2 + 75;
|
final int endX = width/2 + 75;
|
||||||
final int endY = height - height / 3 + 13 + 30;
|
final int endY = height - height / 3 + 13 + 30;
|
||||||
return getTotalDelta(0) > 1050 &&
|
return getTotalDelta() > 1050 &&
|
||||||
mouseX > startX &&
|
mouseX > startX &&
|
||||||
mouseX < endX &&
|
mouseX < endX &&
|
||||||
mouseY > startY &&
|
mouseY > startY &&
|
||||||
@@ -149,13 +152,13 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
context.drawText(textRenderer, menuMessage, (width/2) - (textRenderer.getWidth(menuMessage)/2), height - height/3 - 1, textColor, false);
|
context.drawText(textRenderer, menuMessage, (width/2) - (textRenderer.getWidth(menuMessage)/2), height - height/3 - 1, textColor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTotalDelta(float delta){
|
public float getTotalDelta(){
|
||||||
return ticksSinceDeath * 50f + delta;
|
return (Util.getMeasuringTimeNano() - screenTime) / 1000000f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
final float totalDelta = getTotalDelta(delta);
|
final float totalDelta = getTotalDelta();
|
||||||
context.fill(0, 0, width, height, new Color(0, 0, 0, (int) Math.min(80, totalDelta/4f)).getRGB());
|
context.fill(0, 0, width, height, new Color(0, 0, 0, (int) Math.min(80, totalDelta/4f)).getRGB());
|
||||||
if (totalDelta > 750.0f){
|
if (totalDelta > 750.0f){
|
||||||
final int backOpacity = (int) Math.min(255, (totalDelta - 750f) / 10f);
|
final int backOpacity = (int) Math.min(255, (totalDelta - 750f) / 10f);
|
||||||
@@ -263,7 +266,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
|
|
||||||
public float calcCameraOffset(float delta){
|
public float calcCameraOffset(float delta){
|
||||||
final double e = Math.E;
|
final double e = Math.E;
|
||||||
final double del = getTotalDelta(delta) / 600d;
|
final double del = getTotalDelta() / 600d;
|
||||||
final double ep = Math.pow(e, del);
|
final double ep = Math.pow(e, del);
|
||||||
return (float) (ep / (1d + ep) * 7d + 2d);
|
return (float) (ep / (1d + ep) * 7d + 2d);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
@Mixin(GameRenderer.class)
|
@Mixin(GameRenderer.class)
|
||||||
public abstract class MixinGameRenderer {
|
public abstract class MixinGameRenderer {
|
||||||
|
|
||||||
@Shadow @Final MinecraftClient client;
|
@Shadow @Final private MinecraftClient client;
|
||||||
|
|
||||||
@Shadow protected abstract void renderHand(Camera camera, float tickDelta, Matrix4f matrix4f);
|
@Shadow protected abstract void renderHand(Camera camera, float tickDelta, Matrix4f matrix4f);
|
||||||
|
|
||||||
@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<Double> cir){
|
public void onFovGet(Camera camera, float tickDelta, boolean changingFov, CallbackInfoReturnable<Float> cir){
|
||||||
if (client.currentScreen instanceof BedrockDeathScreen bedrockDeathScreen){
|
if (client.currentScreen instanceof BedrockDeathScreen bedrockDeathScreen){
|
||||||
cir.setReturnValue(Math.min(60 + bedrockDeathScreen.getTotalDelta(client.getRenderTickCounter().getTickDelta(true)) / (405d), 80));
|
cir.setReturnValue(Math.min(60 + bedrockDeathScreen.getTotalDelta() / (405f), 80));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user