From 3e1143112a171075001f62b2fecd850e418d496d Mon Sep 17 00:00:00 2001 From: Julian Krings Date: Fri, 8 Aug 2025 21:38:26 +0200 Subject: [PATCH] fix offset in studio map and some other issues --- .../com/volmit/iris/core/gui/VisionGUI.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/volmit/iris/core/gui/VisionGUI.java b/core/src/main/java/com/volmit/iris/core/gui/VisionGUI.java index 24cc09f73..f954f0c6d 100644 --- a/core/src/main/java/com/volmit/iris/core/gui/VisionGUI.java +++ b/core/src/main/java/com/volmit/iris/core/gui/VisionGUI.java @@ -30,7 +30,6 @@ import com.volmit.iris.engine.object.IrisWorld; import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.collection.KSet; -import com.volmit.iris.util.data.registry.Attributes; import com.volmit.iris.util.format.Form; import com.volmit.iris.util.math.BlockPosition; import com.volmit.iris.util.math.M; @@ -40,7 +39,6 @@ import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.O; import com.volmit.iris.util.scheduling.PrecisionStopwatch; import org.bukkit.Location; -import org.bukkit.attribute.Attribute; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -415,8 +413,7 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener } private double getWorldX(double screenX) { - //return (mscale * screenX) + ((oxp / scale) * mscale); - return (mscale * screenX) + ((oxp / scale)); + return (mscale * screenX) + ((oxp / scale) * mscale); } private double getWorldZ(double screenZ) { @@ -486,6 +483,13 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener hz += Math.abs(hz - lz) * 0.36; } + if (Math.abs(lx - hx) < 0.5) { + hx = lx; + } + if (Math.abs(lz - hz) < 0.5) { + hz = lz; + } + if (centities.flip()) { J.s(() -> { synchronized (lastEntities) { @@ -510,8 +514,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener int iscale = (int) scale; g.setColor(Color.white); g.clearRect(0, 0, w, h); - int posX = (int) oxp; - int posZ = (int) ozp; + double offsetX = oxp / scale; + double offsetZ = ozp / scale; m.set(3); for (int r = 0; r < Math.max(w, h); r += iscale) { @@ -520,10 +524,14 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener int a = i - (w / 2); int b = j - (h / 2); if (a * a + b * b <= r * r) { - BufferedImage t = getTile(gg, iscale, Math.floorDiv((posX / iscale) + i, iscale) * iscale, Math.floorDiv((posZ / iscale) + j, iscale) * iscale, m); + int tx = (int) (Math.floor((offsetX + i) / iscale) * iscale); + int tz = (int) (Math.floor((offsetZ + j) / iscale) * iscale); + BufferedImage t = getTile(gg, iscale, tx, tz, m); if (t != null) { - g.drawImage(t, i - ((posX / iscale) % (iscale)), j - ((posZ / iscale) % (iscale)), iscale, iscale, (img, infoflags, x, y, width, height) -> true); + int rx = Math.floorMod((int) Math.floor(offsetX), iscale); + int rz = Math.floorMod((int) Math.floor(offsetZ), iscale); + g.drawImage(t, i - rx, j - rz, iscale, iscale, (img, infoflags, x, y, width, height) -> true); } } } @@ -651,8 +659,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener private void animateTo(double wx, double wz) { double cx = getWorldX(getWidth() / 2); double cz = getWorldZ(getHeight() / 2); - ox += (wx - cx); - oz += (wz - cz); + ox += ((wx - cx) / mscale) * scale; + oz += ((wz - cz) / mscale) * scale; } private void renderPosition(Graphics2D g, double x, double z) {