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 {
|
||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.8.9'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.21
|
||||
yarn_mappings=1.21+build.9
|
||||
loader_version=0.15.11
|
||||
minecraft_version=1.21.3
|
||||
yarn_mappings=1.21.3+build.2
|
||||
loader_version=0.16.8
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.2.0
|
||||
mod_version = 1.2.2
|
||||
maven_group = de.shiewk
|
||||
archives_base_name = BedrockDeathScreen
|
||||
|
||||
# Dependencies
|
||||
# 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
|
||||
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
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -17,6 +18,7 @@ import java.awt.*;
|
||||
public class BedrockDeathScreen extends DeathScreen {
|
||||
|
||||
private int ticksSinceDeath = 0;
|
||||
private long screenTime = 0;
|
||||
private final Text message;
|
||||
private Text scoreText = Text.empty();
|
||||
private static final Text menuMessage = Text.translatable("deathScreen.titleScreen");
|
||||
@@ -31,6 +33,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
||||
super(message, isHardcore);
|
||||
this.message = message;
|
||||
this.hardcore = isHardcore;
|
||||
screenTime = Util.getMeasuringTimeNano();
|
||||
}
|
||||
|
||||
private boolean hoversRespawn(int mouseX, int mouseY){
|
||||
@@ -38,7 +41,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
||||
int startY = height - height / 3 - 9;
|
||||
int endX = width/2 + 75;
|
||||
int endY = height - height / 3 + 13;
|
||||
return getTotalDelta(0) > 1050 &&
|
||||
return getTotalDelta() > 1050 &&
|
||||
mouseX > startX &&
|
||||
mouseX < endX &&
|
||||
mouseY > startY &&
|
||||
@@ -50,7 +53,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
||||
final int startY = height - height / 3 - 9 + 30;
|
||||
final int endX = width/2 + 75;
|
||||
final int endY = height - height / 3 + 13 + 30;
|
||||
return getTotalDelta(0) > 1050 &&
|
||||
return getTotalDelta() > 1050 &&
|
||||
mouseX > startX &&
|
||||
mouseX < endX &&
|
||||
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);
|
||||
}
|
||||
|
||||
public float getTotalDelta(float delta){
|
||||
return ticksSinceDeath * 50f + delta;
|
||||
public float getTotalDelta(){
|
||||
return (Util.getMeasuringTimeNano() - screenTime) / 1000000f;
|
||||
}
|
||||
|
||||
@Override
|
||||
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());
|
||||
if (totalDelta > 750.0f){
|
||||
final int backOpacity = (int) Math.min(255, (totalDelta - 750f) / 10f);
|
||||
@@ -263,7 +266,7 @@ public class BedrockDeathScreen extends DeathScreen {
|
||||
|
||||
public float calcCameraOffset(float delta){
|
||||
final double e = Math.E;
|
||||
final double del = getTotalDelta(delta) / 600d;
|
||||
final double del = getTotalDelta() / 600d;
|
||||
final double ep = Math.pow(e, del);
|
||||
return (float) (ep / (1d + ep) * 7d + 2d);
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(GameRenderer.class)
|
||||
public abstract class MixinGameRenderer {
|
||||
|
||||
@Shadow @Final MinecraftClient client;
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
@Shadow protected abstract void renderHand(Camera camera, float tickDelta, Matrix4f matrix4f);
|
||||
|
||||
@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){
|
||||
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