Skip to content

Commit

Permalink
death coord
Browse files Browse the repository at this point in the history
  • Loading branch information
AutumnVN committed Jul 10, 2024
1 parent ea029b1 commit 68757a7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client/java/autumnvn/autumn/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Options {
public SimpleOption<Boolean> ignorePlayer;
public SimpleOption<Boolean> betterChat;
public SimpleOption<Boolean> betterNametag;
public SimpleOption<Boolean> deathCoord;
public SimpleOption<Boolean> fullBright;
public SimpleOption<Boolean> horseSwim;
public SimpleOption<Boolean> infoHud;
Expand Down Expand Up @@ -54,6 +55,8 @@ public Options() {
options.put("betterChat", betterChat);
betterNametag = SimpleOption.ofBoolean("Better Nametag", value -> Tooltip.of(Text.of("Add health & gamemode to nametag, make nametag always visible & show targeted entity nametag")), true);
options.put("betterNametag", betterNametag);
deathCoord = SimpleOption.ofBoolean("Death Coord", value -> Tooltip.of(Text.of("Show death coordinates in chat")), true);
options.put("deathCoord", deathCoord);
fullBright = SimpleOption.ofBoolean("Full Bright", value -> Tooltip.of(Text.of("No more darkness")), true);
options.put("fullBright", fullBright);
horseSwim = SimpleOption.ofBoolean("Horse Swim", value -> Tooltip.of(Text.of("Make riding horse swim in water")), true);
Expand Down
1 change: 1 addition & 0 deletions src/client/java/autumnvn/autumn/SettingsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class SettingsScreen extends Screen {
AutumnClient.options.ignorePlayer,
AutumnClient.options.betterChat,
AutumnClient.options.betterNametag,
AutumnClient.options.deathCoord,
AutumnClient.options.fullBright,
AutumnClient.options.horseSwim,
AutumnClient.options.infoHud,
Expand Down
26 changes: 26 additions & 0 deletions src/client/java/autumnvn/autumn/mixin/client/DeathScreenMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package autumnvn.autumn.mixin.client;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import autumnvn.autumn.AutumnClient;
import net.minecraft.client.gui.screen.DeathScreen;
import net.minecraft.text.Text;

@Mixin(DeathScreen.class)
public class DeathScreenMixin {

// DeathCoord
@Inject(method = "init", at = @At("HEAD"))
private void init(CallbackInfo ci) {
if (AutumnClient.options.deathCoord.getValue()) {
AutumnClient.client.player.sendMessage(Text.of(String.format("You died at §a%d %d %d §rin §a%s",
AutumnClient.client.player.getBlockX(),
AutumnClient.client.player.getBlockY(),
AutumnClient.client.player.getBlockZ(),
AutumnClient.client.world.getRegistryKey().getValue().toString().split(":")[1])));
}
}

}
1 change: 1 addition & 0 deletions src/client/resources/autumn.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ChatHudMixin",
"ClientPlayerInteractionManagerMixin",
"ClientPlayNetworkHandlerMixin",
"DeathScreenMixin",
"EntityMixin",
"EntityRendererMixin",
"FishingBobberEntityRendererMixin",
Expand Down

0 comments on commit 68757a7

Please sign in to comment.