mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-08-16 16:26:12 +00:00
fix offset in studio map and some other issues
This commit is contained in:
parent
834b214fbf
commit
3e1143112a
@ -30,7 +30,6 @@ import com.volmit.iris.engine.object.IrisWorld;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
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.format.Form;
|
||||||
import com.volmit.iris.util.math.BlockPosition;
|
import com.volmit.iris.util.math.BlockPosition;
|
||||||
import com.volmit.iris.util.math.M;
|
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.O;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -415,8 +413,7 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double getWorldX(double screenX) {
|
private double getWorldX(double screenX) {
|
||||||
//return (mscale * screenX) + ((oxp / scale) * mscale);
|
return (mscale * screenX) + ((oxp / scale) * mscale);
|
||||||
return (mscale * screenX) + ((oxp / scale));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getWorldZ(double screenZ) {
|
private double getWorldZ(double screenZ) {
|
||||||
@ -486,6 +483,13 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
hz += Math.abs(hz - lz) * 0.36;
|
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()) {
|
if (centities.flip()) {
|
||||||
J.s(() -> {
|
J.s(() -> {
|
||||||
synchronized (lastEntities) {
|
synchronized (lastEntities) {
|
||||||
@ -510,8 +514,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
int iscale = (int) scale;
|
int iscale = (int) scale;
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
g.clearRect(0, 0, w, h);
|
g.clearRect(0, 0, w, h);
|
||||||
int posX = (int) oxp;
|
double offsetX = oxp / scale;
|
||||||
int posZ = (int) ozp;
|
double offsetZ = ozp / scale;
|
||||||
m.set(3);
|
m.set(3);
|
||||||
|
|
||||||
for (int r = 0; r < Math.max(w, h); r += iscale) {
|
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 a = i - (w / 2);
|
||||||
int b = j - (h / 2);
|
int b = j - (h / 2);
|
||||||
if (a * a + b * b <= r * r) {
|
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) {
|
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) {
|
private void animateTo(double wx, double wz) {
|
||||||
double cx = getWorldX(getWidth() / 2);
|
double cx = getWorldX(getWidth() / 2);
|
||||||
double cz = getWorldZ(getHeight() / 2);
|
double cz = getWorldZ(getHeight() / 2);
|
||||||
ox += (wx - cx);
|
ox += ((wx - cx) / mscale) * scale;
|
||||||
oz += (wz - cz);
|
oz += ((wz - cz) / mscale) * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderPosition(Graphics2D g, double x, double z) {
|
private void renderPosition(Graphics2D g, double x, double z) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user