Fix for retina displays: could not select buildmodes.

This commit is contained in:
Christian Knaapen
2020-08-26 21:01:54 +02:00
parent 7b4a2f6bdd
commit 61561f6d29
3 changed files with 12 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.14.4-2.19'
version = '1.14.4-2.21'
group = 'nl.requios.effortlessbuilding' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'effortlessbuilding'
@@ -89,7 +89,7 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.14.4-28.1.102'
minecraft 'net.minecraftforge:forge:1.14.4-28.2.23'
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"

View File

@@ -46,7 +46,7 @@ public class EffortlessBuilding
{
public static final String MODID = "effortlessbuilding";
public static final String NAME = "Effortless Building";
public static final String VERSION = "1.14.4-2.19";
public static final String VERSION = "1.14.4-2.21";
public static EffortlessBuilding instance;

View File

@@ -140,8 +140,14 @@ public class RadialMenu extends Screen {
final double middleX = width / 2.0;
final double middleY = height / 2.0;
final double mouseXCenter = mouseX - middleX;
final double mouseYCenter = -mouseY + middleY;
//Fix for high def (retina) displays: use custom mouse coordinates
//Borrowed from GameRenderer::updateCameraAndRender
Minecraft mc = Minecraft.getInstance();
int mouseXX = (int)(mc.mouseHelper.getMouseX() * (double)mc.mainWindow.getScaledWidth() / (double)mc.mainWindow.getWidth());
int mouseYY = (int)(mc.mouseHelper.getMouseY() * (double)mc.mainWindow.getScaledHeight() / (double)mc.mainWindow.getHeight());
final double mouseXCenter = mouseXX - middleX;
final double mouseYCenter = mouseYY - middleY;
double mouseRadians = Math.atan2(mouseYCenter, mouseXCenter);
final double ringInnerEdge = 30;