mirror of
https://github.com/Shiewk/BedrockDeathScreen.git
synced 2026-04-27 22:44:17 +02:00
Use BedrockDeathScreen when entering worlds where the player is already dead (#4)
This commit is contained in:
@@ -185,7 +185,9 @@ public class BedrockDeathScreen extends DeathScreen {
|
|||||||
context.getMatrices().scale(2F, 2F, 2F);
|
context.getMatrices().scale(2F, 2F, 2F);
|
||||||
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();
|
context.getMatrices().pop();
|
||||||
context.drawCenteredTextWithShadow(this.textRenderer, this.message, this.width / 2, (int) (this.height / 3.5), new Color(255, 255, 255, textOpacity).getRGB());
|
if (message != null) {
|
||||||
|
context.drawCenteredTextWithShadow(this.textRenderer, this.message, this.width / 2, (int) (this.height / 3.5), new Color(255, 255, 255, textOpacity).getRGB());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final int scoreTextOpacity = (int) Math.min(255, (totalScreenTime - 1250f) / 3f);
|
final int scoreTextOpacity = (int) Math.min(255, (totalScreenTime - 1250f) / 3f);
|
||||||
if (scoreTextOpacity > 3){
|
if (scoreTextOpacity > 3){
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package de.shiewk.bedrockdeathscreen.mixin;
|
||||||
|
|
||||||
|
import de.shiewk.bedrockdeathscreen.client.screen.BedrockDeathScreen;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
|
@Mixin(MinecraftClient.class)
|
||||||
|
public class MixinMinecraftClient {
|
||||||
|
|
||||||
|
@Shadow @Nullable public ClientWorld world;
|
||||||
|
|
||||||
|
@ModifyVariable(
|
||||||
|
method = "setScreen",
|
||||||
|
at = @At("STORE"),
|
||||||
|
name = "screen",
|
||||||
|
index = 1,
|
||||||
|
argsOnly = true
|
||||||
|
)
|
||||||
|
public Screen onCreateDeathScreen(Screen value){
|
||||||
|
assert world != null; // Always true
|
||||||
|
return new BedrockDeathScreen(null, world.getLevelProperties().isHardcore());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,7 +8,8 @@
|
|||||||
"client": [
|
"client": [
|
||||||
"MixinCamera",
|
"MixinCamera",
|
||||||
"MixinClientPlayNetworkHandler",
|
"MixinClientPlayNetworkHandler",
|
||||||
"MixinGameRenderer"
|
"MixinGameRenderer",
|
||||||
|
"MixinMinecraftClient"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
Reference in New Issue
Block a user