aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
diff options
context:
space:
mode:
authorBuildTools <james.jenour@protonmail.com>2021-01-28 23:36:00 +0800
committerBuildTools <james.jenour@protonmail.com>2021-01-28 23:36:00 +0800
commit659a0e4981640802058d9eef35fec16fab82c5f2 (patch)
tree062c599660c17cdbc843cb2734f3b797a017dfee /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
parent64959d248b383375274628b5e8d83cd7f9c4e96d (diff)
downloadnotenoughupdates-659a0e4981640802058d9eef35fec16fab82c5f2.tar.gz
notenoughupdates-659a0e4981640802058d9eef35fec16fab82c5f2.tar.bz2
notenoughupdates-659a0e4981640802058d9eef35fec16fab82c5f2.zip
PRE12
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
index 2c1d1fab..9e97cfc0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalOverlay.java
@@ -108,6 +108,10 @@ public class CrystalOverlay {
int radius;
}
+ private static double posLastUpdateX;
+ private static double posLastUpdateY;
+ private static double posLastUpdateZ;
+
private static HashMap<String, CrystalType> skullId = new HashMap<>();
static {
skullId.put("d9c3168a-8654-3dd8-b297-4d3b7e55b95a", CrystalType.FARMING_MINION);
@@ -118,6 +122,8 @@ public class CrystalOverlay {
public static long displayMillis = 0;
+ public static long lastMiningUpdate = 0;
+
public static HashMap<CrystalType, BlockPos> crystals = new HashMap<>();
private static ExecutorService es = Executors.newSingleThreadExecutor();
@@ -131,6 +137,7 @@ public class CrystalOverlay {
long currentTime = System.currentTimeMillis();
if(currentTime - displayMillis > 10*1000) {
+ crystals.clear();
displayMillis = -1;
}
@@ -191,11 +198,35 @@ public class CrystalOverlay {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
+ if(displayMillis < 0) {
+ return;
+ }
+
EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
if(p == null) return;
if(event.phase == TickEvent.Phase.START) {
+ double dX = p.posX - posLastUpdateX;
+ double dY = p.posY - posLastUpdateY;
+ double dZ = p.posZ - posLastUpdateZ;
+
+ if(dX*dX + dY*dY + dZ*dZ < 1) {
+ return;
+ }
+
+ posLastUpdateX = p.posX;
+ posLastUpdateY = p.posY;
+ posLastUpdateZ = p.posZ;
+
for(CrystalType type : crystals.keySet()) {
+ if(type == CrystalType.MINING_MINION) {
+ long currentTime = System.currentTimeMillis();
+ if(currentTime - lastMiningUpdate < 1000) {
+ continue;
+ }
+ lastMiningUpdate = currentTime;
+ }
+
ReverseWorldRenderer worldRenderer = type.getOverlayVBO();
if(worldRenderer != null) {
BlockPos crystal = crystals.get(type);
@@ -205,6 +236,11 @@ public class CrystalOverlay {
(float)p.posX-crystal.getX(),
(float)p.posY-crystal.getY(),
(float)p.posZ-crystal.getZ());
+ /*es.submit(() -> worldRenderer.sortVertexData(
+ (float)p.posX-crystal.getX(),
+ (float)p.posY-crystal.getY(),
+ (float)p.posZ-crystal.getZ()));*/
+
}
}
}