]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/PlayerCoords.java
Upgrade to 1.13.2
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / PlayerCoords.java
1 package com.irtimaled.bbor.client;
2
3 import com.irtimaled.bbor.common.models.Coords;
4 import net.minecraft.entity.player.EntityPlayer;
5
6 public class PlayerCoords {
7     private static double x;
8     private static double y;
9     private static double z;
10     private static double activeY;
11     private static int dimensionId;
12
13     public static void setPlayerPosition(double partialTicks, EntityPlayer entityPlayer) {
14         x = entityPlayer.lastTickPosX + (entityPlayer.posX - entityPlayer.lastTickPosX) * partialTicks;
15         y = entityPlayer.lastTickPosY + (entityPlayer.posY - entityPlayer.lastTickPosY) * partialTicks;
16         z = entityPlayer.lastTickPosZ + (entityPlayer.posZ - entityPlayer.lastTickPosZ) * partialTicks;
17         dimensionId = entityPlayer.dimension.getId();
18     }
19
20     static void setActiveY() {
21         activeY = y;
22     }
23
24     public static double getX() {
25         return x;
26     }
27
28     public static double getY() {
29         return y;
30     }
31
32     public static double getZ() {
33         return z;
34     }
35
36     public static double getMaxY(double configMaxY) {
37         if (configMaxY == -1) {
38             return activeY;
39         }
40         if (configMaxY == 0) {
41             return y;
42         }
43         return configMaxY;
44     }
45
46     public static int getDimensionId() {
47         return dimensionId;
48     }
49
50     public static Coords get() {
51         return new Coords(x, y, z);
52     }
53 }