Added cardinal direction names in the F3 debug menu

master
Wynd 2024-08-08 01:01:50 +03:00
parent 141217b365
commit 4f2151e5c7
3 changed files with 38 additions and 10 deletions

View File

@ -0,0 +1,29 @@
package xyz.pixelatedw.finalbeta;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.maths.MathsHelper;
public enum Direction {
SOUTH,
WEST,
NORTH,
EAST,
;
private String displayName;
private Direction() {
String name = this.name();
this.displayName = Character.toUpperCase(name.charAt(0)) + name.substring(1).toLowerCase();
}
public static Direction fromEntity(LivingEntity entity) {
int dir = MathsHelper.floor(entity.yaw / 90.0D + 0.5D) & 3;
return values()[Math.abs(dir) % values().length];
}
@Override
public String toString() {
return this.displayName;
}
}

View File

@ -8,8 +8,6 @@ import java.util.HashMap;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.Player; import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance;
import net.minecraft.item.ItemType;
public class WyHelper { public class WyHelper {
@ -90,11 +88,10 @@ public class WyHelper {
} }
public static void cheatCommand(Player player) { public static void cheatCommand(Player player) {
player.dropItem(new ItemInstance(ItemType.pickaxeIron, 1, 100)); // player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
player.dropItem(new ItemInstance(ItemType.pickaxeIron, 1, 150)); // player.dropItem(new ItemInstance(ItemType.minecartChest, 1));
player.dropItem(new ItemInstance(ItemType.pickaxeDiamond, 1, 150)); // player.dropItem(new ItemInstance(ItemType.coal, 64));
// player.dropItem(new ItemInstance(Tile.WOOD, 64)); // player.dropItem(new ItemInstance(Tile.WOODEN_PRESSURE_PLATE, 2));
// player.dropItem(new ItemInstance(ItemType.snowball, 60));
player.level.setLevelTime(0); player.level.setLevelTime(0);
player.level.getProperties().setRaining(false); player.level.getProperties().setRaining(false);

View File

@ -12,6 +12,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.Overlay; import net.minecraft.client.gui.Overlay;
import net.minecraft.client.render.TextRenderer; import net.minecraft.client.render.TextRenderer;
import xyz.pixelatedw.finalbeta.Direction;
import xyz.pixelatedw.finalbeta.ModConfig; import xyz.pixelatedw.finalbeta.ModConfig;
import xyz.pixelatedw.finalbeta.WyHelper; import xyz.pixelatedw.finalbeta.WyHelper;
@ -41,8 +42,9 @@ public class OverlayMixin extends DrawableHelper {
) )
) )
public void render(float f, boolean flag, int i, int j, CallbackInfo ci) { public void render(float f, boolean flag, int i, int j, CallbackInfo ci) {
if (ModConfig.ENABLE_TIME_TRACKING.get()) {
TextRenderer textRenderer = this.minecraft.textRenderer; TextRenderer textRenderer = this.minecraft.textRenderer;
this.drawTextWithShadow(textRenderer, "(" + Direction.fromEntity(this.minecraft.player).toString() + ")", 23, 88, 14737632);
if (ModConfig.ENABLE_TIME_TRACKING.get()) {
this.drawTextWithShadow(textRenderer, "Play Time: " + WyHelper.getGameDaysPlayed() + " (" + WyHelper.getRealDaysPlayed() + ")", 2, 96, 14737632); this.drawTextWithShadow(textRenderer, "Play Time: " + WyHelper.getGameDaysPlayed() + " (" + WyHelper.getRealDaysPlayed() + ")", 2, 96, 14737632);
} }
} }