Refactored and reformatted code to use less static variables

This commit is contained in:
CrushedPixel
2015-04-23 14:09:54 +02:00
parent f22416be2c
commit 0003f040ed
109 changed files with 9037 additions and 10229 deletions

View File

@@ -1,32 +1,31 @@
package eu.crushedpixel.replaymod.utils;
import java.awt.Point;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.input.Mouse;
import java.awt.*;
public class MouseUtils {
private static final Minecraft mc = Minecraft.getMinecraft();
public static Point getMousePos() {
Point scaled = getScaledDimensions();
int width = (int)scaled.getX();
int height = (int)scaled.getY();
private static final Minecraft mc = Minecraft.getMinecraft();
final int mouseX = (Mouse.getX() * width / mc.displayWidth);
final int mouseY = (height - Mouse.getY() * height / mc.displayHeight);
return new Point(mouseX, mouseY);
}
public static Point getScaledDimensions() {
ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
final int width = sr.getScaledWidth();
final int heigth = sr.getScaledHeight();
return new Point(width, heigth);
}
public static Point getMousePos() {
Point scaled = getScaledDimensions();
int width = (int) scaled.getX();
int height = (int) scaled.getY();
final int mouseX = (Mouse.getX() * width / mc.displayWidth);
final int mouseY = (height - Mouse.getY() * height / mc.displayHeight);
return new Point(mouseX, mouseY);
}
public static Point getScaledDimensions() {
ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
final int width = sr.getScaledWidth();
final int heigth = sr.getScaledHeight();
return new Point(width, heigth);
}
}