mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 05:02:25 +00:00
#1000 Travel anchor close distance clicking problem
This commit is contained in:
1 parent
605a8b7ce5
commit
01b83ad4a7
1 file changed
+18
-5
@@ -549,11 +549,24 @@ public class TravelController {
|
||||
}
|
||||
|
||||
if(selectedCoord != null) {
|
||||
Vector2d sp = currentView.getScreenPoint(new Vector3d(selectedCoord.x + 0.5, selectedCoord.y + 0.5, selectedCoord.z + 0.5));
|
||||
Vector2d mid = new Vector2d(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
|
||||
mid.scale(0.5);
|
||||
double ratio = sp.distance(mid) / Minecraft.getMinecraft().displayWidth;
|
||||
if(ratio > 0.2) {
|
||||
|
||||
Vector3d blockCenter = new Vector3d(selectedCoord.x + 0.5, selectedCoord.y + 0.5, selectedCoord.z + 0.5);
|
||||
Vector2d blockCenterPixel = currentView.getScreenPoint(blockCenter);
|
||||
|
||||
Vector2d screenMidPixel = new Vector2d(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
|
||||
screenMidPixel.scale(0.5);
|
||||
double ratio = blockCenterPixel.distance(screenMidPixel) / Minecraft.getMinecraft().displayWidth;
|
||||
|
||||
Vector3d blockLeft = new Vector3d();
|
||||
blockLeft.cross(currentView.getEyePoint(), new Vector3d(0,1,0));
|
||||
blockLeft.normalize();
|
||||
blockLeft.scale(0.5);
|
||||
blockLeft.add(blockCenter);
|
||||
|
||||
Vector2d blockLeftPixel = currentView.getScreenPoint(blockLeft);
|
||||
double blockSizeRatio = blockCenterPixel.distance(blockLeftPixel)/ Minecraft.getMinecraft().displayWidth;
|
||||
double maxRatio = Math.max(0.2, blockSizeRatio);
|
||||
if(ratio > maxRatio) {
|
||||
selectedCoord = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user