Compare commits
3 Commits
54806c33c7
...
f20012c33f
Author | SHA1 | Date | |
---|---|---|---|
|
f20012c33f | ||
|
f91cdb2101 | ||
|
af42bbe2fa |
|
@ -164,7 +164,7 @@ public class CustomItemProperties {
|
||||||
int j = Config.parseInt(s, -1);
|
int j = Config.parseInt(s, -1);
|
||||||
|
|
||||||
if (j >= 0) {
|
if (j >= 0) {
|
||||||
set.add(new Integer(j));
|
set.add(Integer.valueOf(j));
|
||||||
} else {
|
} else {
|
||||||
if (s.contains("-")) {
|
if (s.contains("-")) {
|
||||||
String[] astring1 = Config.tokenize(s, "-");
|
String[] astring1 = Config.tokenize(s, "-");
|
||||||
|
@ -183,7 +183,7 @@ public class CustomItemProperties {
|
||||||
continue label45;
|
continue label45;
|
||||||
}
|
}
|
||||||
|
|
||||||
set.add(new Integer(k1));
|
set.add(Integer.valueOf(k1));
|
||||||
++k1;
|
++k1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public class CustomItemProperties {
|
||||||
if (i2 <= 0) {
|
if (i2 <= 0) {
|
||||||
Config.warn("Item not found: " + s);
|
Config.warn("Item not found: " + s);
|
||||||
} else {
|
} else {
|
||||||
set.add(new Integer(i2));
|
set.add(Integer.valueOf(i2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.teavm.jso.dom.html.HTMLImageElement;
|
||||||
import org.teavm.jso.gamepad.GamepadEvent;
|
import org.teavm.jso.gamepad.GamepadEvent;
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.v1_8.Display;
|
import net.lax1dude.eaglercraft.v1_8.Display;
|
||||||
|
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
||||||
|
|
||||||
import org.teavm.jso.gamepad.Gamepad;
|
import org.teavm.jso.gamepad.Gamepad;
|
||||||
|
|
||||||
|
@ -29,9 +30,10 @@ public class Controller {
|
||||||
private static double threshold = 0.3;
|
private static double threshold = 0.3;
|
||||||
//Fixes 'slight' issues of stick drift people have been complaining about
|
//Fixes 'slight' issues of stick drift people have been complaining about
|
||||||
private static double cameraThreshold = 4.0;
|
private static double cameraThreshold = 4.0;
|
||||||
|
private static double cursorThreshold = 0.4;
|
||||||
|
|
||||||
private static int activeController = -1;
|
private static int activeController = -1;
|
||||||
private static ButtonState[] states = new ButtonState[30];
|
private static ButtonState[] button = new ButtonState[30];
|
||||||
|
|
||||||
public static HTMLImageElement cursor;
|
public static HTMLImageElement cursor;
|
||||||
|
|
||||||
|
@ -90,39 +92,39 @@ public class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean itemChangeLeft() {
|
public static boolean itemChangeLeft() {
|
||||||
return states[4] == ButtonState.PRESSED;
|
return button[4] == ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean itemChangeRight() {
|
public static boolean itemChangeRight() {
|
||||||
return states[5] == ButtonState.PRESSED;
|
return button[5] == ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inventory() {
|
public static boolean inventory() {
|
||||||
return states[2] == ButtonState.PRESSED || states[3] == ButtonState.PRESSED;
|
return button[2] == ButtonState.PRESSED || button[3] == ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean togglePerspective() {
|
public static boolean togglePerspective() {
|
||||||
return states[12] == ButtonState.PRESSED;
|
return button[12] == ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean playerList() {
|
public static boolean playerList() {
|
||||||
return states[15] == ButtonState.HELD;
|
return button[15] == ButtonState.HELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean smoothCamera() {
|
public static boolean smoothCamera() {
|
||||||
return states[14] == ButtonState.PRESSED;
|
return button[14] == ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean dropItem() {
|
public static boolean dropItem() {
|
||||||
return states[13] == ButtonState.PRESSED;
|
return button[13] == ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isButtonPressed(int i) {
|
public static boolean isButtonPressed(int i) {
|
||||||
return states[i] == ButtonState.PRESSED;
|
return button[i] == ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isButtonDown(int i) {
|
public static boolean isButtonDown(int i) {
|
||||||
return states[i] == ButtonState.HELD;
|
return button[i] == ButtonState.HELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateAxes(Gamepad gamePad) {
|
private static void updateAxes(Gamepad gamePad) {
|
||||||
|
@ -142,35 +144,16 @@ public class Controller {
|
||||||
dy = -axes[3] * multiplier;
|
dy = -axes[3] * multiplier;
|
||||||
|
|
||||||
if(cursor != null) {
|
if(cursor != null) {
|
||||||
double dx1;
|
int dx1 = getDX();
|
||||||
double dy1 = dy;
|
int dy1 = getDY();
|
||||||
|
|
||||||
if(dx1 < 0.0) {
|
if(dx1 > 0 || dx1 < 0) {
|
||||||
if(dx1 < -cameraThreshold) {
|
updateCursorX(dx1);
|
||||||
dx1 = dx;
|
|
||||||
}
|
|
||||||
} else if(dx > 0.0) {
|
|
||||||
if(dx > cameraThreshold) {
|
|
||||||
dx1 = dx;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dx1 = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dy1 < 0.0) {
|
if(dy1 > 0 || dy1 < 0) {
|
||||||
if(dy1 < -cameraThreshold) {
|
updateCursorY(-dy1);
|
||||||
dy1 = dy;
|
|
||||||
}
|
|
||||||
} else if(dy1 > 0.0) {
|
|
||||||
if(dy1 > cameraThreshold) {
|
|
||||||
dy1 = dy;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dy1 = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateCursor((int)dx1, (int)dy1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forward = axes[1] < -threshold;
|
forward = axes[1] < -threshold;
|
||||||
|
@ -187,15 +170,15 @@ public class Controller {
|
||||||
resetButtonStates();
|
resetButtonStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(states[i] == ButtonState.PRESSED) {
|
if(button[i] == ButtonState.PRESSED) {
|
||||||
states[i] = ButtonState.HELD;
|
button[i] = ButtonState.HELD;
|
||||||
} else {
|
} else {
|
||||||
if(!(states[i] == ButtonState.HELD)) {
|
if(!(button[i] == ButtonState.HELD)) {
|
||||||
states[i] = ButtonState.PRESSED;
|
button[i] = ButtonState.PRESSED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(!gamePad.getButtons()[i].isPressed() && index == activeController) {
|
} else if(!gamePad.getButtons()[i].isPressed() && index == activeController) {
|
||||||
states[i] = ButtonState.DEFAULT;
|
button[i] = ButtonState.DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,10 +196,11 @@ public class Controller {
|
||||||
cursor.setAttribute("id", "cursor");
|
cursor.setAttribute("id", "cursor");
|
||||||
cursor.setSrc(cursorSrc);
|
cursor.setSrc(cursorSrc);
|
||||||
cursor.setAttribute("draggable", "false");
|
cursor.setAttribute("draggable", "false");
|
||||||
cursor.getStyle().setProperty("left", "0px");
|
cursor.getStyle().setProperty("position", "fixed");
|
||||||
cursor.getStyle().setProperty("top", "0px");
|
cursor.getStyle().setProperty("top", "0");
|
||||||
cursor.getStyle().setProperty("width", "auto");
|
cursor.getStyle().setProperty("left", "0");
|
||||||
cursor.getStyle().setProperty("height", "auto");
|
cursor.getStyle().setProperty("width", "auto");
|
||||||
|
cursor.getStyle().setProperty("height", "auto");
|
||||||
|
|
||||||
HTMLBodyElement body = (HTMLBodyElement) Window.current().getDocument().getBody();
|
HTMLBodyElement body = (HTMLBodyElement) Window.current().getDocument().getBody();
|
||||||
body.appendChild(cursor);
|
body.appendChild(cursor);
|
||||||
|
@ -229,15 +213,18 @@ public class Controller {
|
||||||
cursor = null;
|
cursor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateCursor(int dx, int dy) {
|
private static void updateCursorX(int x) {
|
||||||
int dx1 = cursor.getAbsoluteLeft() + dx;
|
int newX = cursor.getOffsetLeft() + x;
|
||||||
int dy1 = cursor.getAbsoluteTop() + dy;
|
|
||||||
|
|
||||||
int x = Math.min(Math.max(dx1, 0), Display.getWidth() - cursor.getWidth());
|
newX = Math.max(0, Math.min(newX, PlatformRuntime.canvas.getClientWidth() - cursor.getWidth()));
|
||||||
int y = Math.min(Math.max(dy1, 0), Display.getHeight() - cursor.getHeight());
|
cursor.getStyle().setProperty("left", Integer.toString(newX) + "px");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void updateCursorY(int y) {
|
||||||
|
int newY = cursor.getOffsetTop() + y;
|
||||||
|
|
||||||
cursor.getStyle().setProperty("left", dx1 + "px");
|
newY = Math.max(0, Math.min(newY, PlatformRuntime.canvas.getClientHeight() - cursor.getHeight()));
|
||||||
cursor.getStyle().setProperty("top", dy1 + "px");
|
cursor.getStyle().setProperty("top", Integer.toString(newY) + "px");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Gamepad getGamepad(int index) {
|
private static Gamepad getGamepad(int index) {
|
||||||
|
@ -245,8 +232,8 @@ public class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void resetButtonStates() {
|
private static void resetButtonStates() {
|
||||||
for(int i = 0; i < states.length; i++) {
|
for(int i = 0; i < button.length; i++) {
|
||||||
states[i] = ButtonState.DEFAULT;
|
button[i] = ButtonState.DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,6 +256,7 @@ public class Controller {
|
||||||
int index = arg0.getGamepad().getIndex();
|
int index = arg0.getGamepad().getIndex();
|
||||||
if(connectedControllers.contains(index)) {
|
if(connectedControllers.contains(index)) {
|
||||||
connectedControllers.remove(index);
|
connectedControllers.remove(index);
|
||||||
|
resetButtonStates();
|
||||||
System.out.println("Controller disconnected!");
|
System.out.println("Controller disconnected!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -33,7 +33,7 @@ public class PlatformOpenGL {
|
||||||
|
|
||||||
private static final Logger logger = LogManager.getLogger("PlatformOpenGL");
|
private static final Logger logger = LogManager.getLogger("PlatformOpenGL");
|
||||||
|
|
||||||
static WebGL2RenderingContext ctx = null;
|
public static WebGL2RenderingContext ctx = null;
|
||||||
|
|
||||||
static boolean hasDebugRenderInfoExt = false;
|
static boolean hasDebugRenderInfoExt = false;
|
||||||
static boolean hasFramebufferHDR16FSupport = false;
|
static boolean hasFramebufferHDR16FSupport = false;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package net.minecraft.client;
|
package net.minecraft.client;
|
||||||
|
|
||||||
import static net.eaglerforge.EaglerForge.removeanvil;
|
import net.eaglerforge.EaglerForge;
|
||||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||||
|
|
||||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL._wglBindFramebuffer;
|
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL._wglBindFramebuffer;
|
||||||
|
@ -393,7 +393,6 @@ public class Minecraft extends ModData implements IThreadListener {
|
||||||
* settings, etcetera.
|
* settings, etcetera.
|
||||||
*/
|
*/
|
||||||
private void startGame() throws IOException {
|
private void startGame() throws IOException {
|
||||||
EaglerForge.init();
|
|
||||||
this.modapi = new ModAPI(theMinecraft);
|
this.modapi = new ModAPI(theMinecraft);
|
||||||
this.gameSettings = new GameSettings(this);
|
this.gameSettings = new GameSettings(this);
|
||||||
Config.initDisplay();
|
Config.initDisplay();
|
||||||
|
@ -506,11 +505,13 @@ public class Minecraft extends ModData implements IThreadListener {
|
||||||
|
|
||||||
this.displayGuiScreen(new GuiScreenEditProfile(mainMenu));
|
this.displayGuiScreen(new GuiScreenEditProfile(mainMenu));
|
||||||
|
|
||||||
removeanvil();
|
EaglerForge.removeanvil();
|
||||||
this.renderEngine.deleteTexture(this.mojangLogo);
|
this.renderEngine.deleteTexture(this.mojangLogo);
|
||||||
this.mojangLogo = null;
|
this.mojangLogo = null;
|
||||||
this.loadingScreen = new LoadingScreenRenderer(this);
|
this.loadingScreen = new LoadingScreenRenderer(this);
|
||||||
|
|
||||||
|
EaglerForge.log.info("Loading mods!");
|
||||||
|
|
||||||
//(EaglerForge bug)
|
//(EaglerForge bug)
|
||||||
modapi.onFrame(); //Mods were loaded before onFrame is called
|
modapi.onFrame(); //Mods were loaded before onFrame is called
|
||||||
ModAPI.setGlobal("settings", this.gameSettings.makeModData());
|
ModAPI.setGlobal("settings", this.gameSettings.makeModData());
|
||||||
|
@ -670,6 +671,13 @@ public class Minecraft extends ModData implements IThreadListener {
|
||||||
GlStateManager.enableAlpha();
|
GlStateManager.enableAlpha();
|
||||||
GlStateManager.alphaFunc(GL_GREATER, 0.1F);
|
GlStateManager.alphaFunc(GL_GREATER, 0.1F);
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(1l);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
EaglerForge.displayanvil();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void func_181536_a(int parInt1, int parInt2, int parInt3, int parInt4, int parInt5, int parInt6, int parInt7,
|
public void func_181536_a(int parInt1, int parInt2, int parInt3, int parInt4, int parInt5, int parInt6, int parInt7,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user