Added cardinal direction names in the F3 debug menu
parent
141217b365
commit
4f2151e5c7
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
||||||
|
@ -88,14 +86,13 @@ public class WyHelper {
|
||||||
public static float clamp(float val, float min, float max) {
|
public static float clamp(float val, float min, float max) {
|
||||||
return val < min ? min : Math.min(val, max);
|
return val < min ? min : Math.min(val, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
player.level.getProperties().setRainTime(0);
|
player.level.getProperties().setRainTime(0);
|
||||||
|
|
|
@ -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) {
|
||||||
|
TextRenderer textRenderer = this.minecraft.textRenderer;
|
||||||
|
this.drawTextWithShadow(textRenderer, "(" + Direction.fromEntity(this.minecraft.player).toString() + ")", 23, 88, 14737632);
|
||||||
if (ModConfig.ENABLE_TIME_TRACKING.get()) {
|
if (ModConfig.ENABLE_TIME_TRACKING.get()) {
|
||||||
TextRenderer textRenderer = this.minecraft.textRenderer;
|
|
||||||
this.drawTextWithShadow(textRenderer, "Play Time: " + WyHelper.getGameDaysPlayed() + " (" + WyHelper.getRealDaysPlayed() + ")", 2, 96, 14737632);
|
this.drawTextWithShadow(textRenderer, "Play Time: " + WyHelper.getGameDaysPlayed() + " (" + WyHelper.getRealDaysPlayed() + ")", 2, 96, 14737632);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue