Compare commits
No commits in common. "54806c33c76f35090e0e78e30670b6acff2cdf7a" and "2ebe7f30192ea745f2abb98464190f17c721f3c4" have entirely different histories.
54806c33c7
...
2ebe7f3019
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -13,5 +13,4 @@ desktopRuntime/crash-reports/*
|
||||||
desktopRuntime/options.txt
|
desktopRuntime/options.txt
|
||||||
desktopRuntime/_eagstorage*
|
desktopRuntime/_eagstorage*
|
||||||
desktopRuntime/filesystem/*
|
desktopRuntime/filesystem/*
|
||||||
desktopRuntime/downloads/*
|
desktopRuntime/downloads/*
|
||||||
javascript/Shadow_Client_en_US.zip
|
|
|
@ -6,12 +6,7 @@ import java.util.List;
|
||||||
import org.teavm.jso.browser.Navigator;
|
import org.teavm.jso.browser.Navigator;
|
||||||
import org.teavm.jso.browser.Window;
|
import org.teavm.jso.browser.Window;
|
||||||
import org.teavm.jso.dom.events.EventListener;
|
import org.teavm.jso.dom.events.EventListener;
|
||||||
import org.teavm.jso.dom.html.HTMLBodyElement;
|
|
||||||
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 org.teavm.jso.gamepad.Gamepad;
|
import org.teavm.jso.gamepad.Gamepad;
|
||||||
|
|
||||||
public class Controller {
|
public class Controller {
|
||||||
|
@ -33,8 +28,6 @@ public class Controller {
|
||||||
private static int activeController = -1;
|
private static int activeController = -1;
|
||||||
private static ButtonState[] states = new ButtonState[30];
|
private static ButtonState[] states = new ButtonState[30];
|
||||||
|
|
||||||
public static HTMLImageElement cursor;
|
|
||||||
|
|
||||||
public static final int getDX() {
|
public static final int getDX() {
|
||||||
if(dx < 0.0) {
|
if(dx < 0.0) {
|
||||||
if(dx < -cameraThreshold) {
|
if(dx < -cameraThreshold) {
|
||||||
|
@ -78,11 +71,11 @@ public class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean jump() {
|
public static boolean jump() {
|
||||||
return isButtonPressed(0) || isButtonDown(0);
|
return isButtonPressed(1) || isButtonDown(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean crouch() {
|
public static boolean crouch() {
|
||||||
return isButtonPressed(1) || isButtonDown(1) || isButtonPressed(11) || isButtonDown(11);
|
return isButtonPressed(0) || isButtonDown(0) || isButtonPressed(11) || isButtonDown(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean sprint() {
|
public static boolean sprint() {
|
||||||
|
@ -141,38 +134,6 @@ public class Controller {
|
||||||
*/
|
*/
|
||||||
dy = -axes[3] * multiplier;
|
dy = -axes[3] * multiplier;
|
||||||
|
|
||||||
if(cursor != null) {
|
|
||||||
double dx1;
|
|
||||||
double dy1 = dy;
|
|
||||||
|
|
||||||
if(dx1 < 0.0) {
|
|
||||||
if(dx1 < -cameraThreshold) {
|
|
||||||
dx1 = dx;
|
|
||||||
}
|
|
||||||
} else if(dx > 0.0) {
|
|
||||||
if(dx > cameraThreshold) {
|
|
||||||
dx1 = dx;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dx1 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(dy1 < 0.0) {
|
|
||||||
if(dy1 < -cameraThreshold) {
|
|
||||||
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;
|
||||||
backwards = axes[1] > threshold;
|
backwards = axes[1] > threshold;
|
||||||
left = axes[0] < -threshold;
|
left = axes[0] < -threshold;
|
||||||
|
@ -208,38 +169,6 @@ public class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addCursor(int x, int y) {
|
|
||||||
cursor = (HTMLImageElement) Window.current().getDocument().createElement("img");
|
|
||||||
cursor.setAttribute("id", "cursor");
|
|
||||||
cursor.setSrc(cursorSrc);
|
|
||||||
cursor.setAttribute("draggable", "false");
|
|
||||||
cursor.getStyle().setProperty("left", "0px");
|
|
||||||
cursor.getStyle().setProperty("top", "0px");
|
|
||||||
cursor.getStyle().setProperty("width", "auto");
|
|
||||||
cursor.getStyle().setProperty("height", "auto");
|
|
||||||
|
|
||||||
HTMLBodyElement body = (HTMLBodyElement) Window.current().getDocument().getBody();
|
|
||||||
body.appendChild(cursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeCursor() {
|
|
||||||
if (cursor != null) {
|
|
||||||
cursor.getParentNode().removeChild(cursor);
|
|
||||||
}
|
|
||||||
cursor = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void updateCursor(int dx, int dy) {
|
|
||||||
int dx1 = cursor.getAbsoluteLeft() + dx;
|
|
||||||
int dy1 = cursor.getAbsoluteTop() + dy;
|
|
||||||
|
|
||||||
int x = Math.min(Math.max(dx1, 0), Display.getWidth() - cursor.getWidth());
|
|
||||||
int y = Math.min(Math.max(dy1, 0), Display.getHeight() - cursor.getHeight());
|
|
||||||
|
|
||||||
cursor.getStyle().setProperty("left", dx1 + "px");
|
|
||||||
cursor.getStyle().setProperty("top", dy1 + "px");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Gamepad getGamepad(int index) {
|
private static Gamepad getGamepad(int index) {
|
||||||
return Navigator.getGamepads()[index];
|
return Navigator.getGamepads()[index];
|
||||||
}
|
}
|
||||||
|
@ -276,6 +205,4 @@ public class Controller {
|
||||||
|
|
||||||
resetButtonStates();
|
resetButtonStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String cursorSrc = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAWCAYA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Bo7EeH8N4vBJyWchfAVgHh3OYAnrUu3dhm5p/uiCob0jmH3pt3APCdc9ubnp0OgEYUdUFExY5pmhYOQjr37j9sA3gxM4DBzeUrd9rlGJ1zBTD0SigFAGoVbjsAPs4DeO8BgDi3vUoI5zYnbY6Xz69fWHCMHIXFD7PBln0/6ZSqAAAAAElFTkSuQmCC";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1292,16 +1292,6 @@ public class Minecraft extends ModData implements IThreadListener {
|
||||||
|
|
||||||
Controller.tick();
|
Controller.tick();
|
||||||
|
|
||||||
if(this.currentScreen != null) {
|
|
||||||
if(Controller.cursor == null) {
|
|
||||||
Controller.addCursor(0, 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(Controller.cursor != null) {
|
|
||||||
Controller.removeCursor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.rightClickDelayTimer > 0) {
|
if (this.rightClickDelayTimer > 0) {
|
||||||
--this.rightClickDelayTimer;
|
--this.rightClickDelayTimer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.minecraft.util;
|
package net.minecraft.util;
|
||||||
|
|
||||||
import net.PeytonPlayz585.shadow.input.Controller;
|
import net.PeytonPlayz585.shadow.input.Controller;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.settings.GameSettings;
|
import net.minecraft.client.settings.GameSettings;
|
||||||
|
|
||||||
/**+
|
/**+
|
||||||
|
@ -50,8 +49,8 @@ public class MovementInputFromOptions extends MovementInput {
|
||||||
--this.moveStrafe;
|
--this.moveStrafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.jump = this.gameSettings.keyBindJump.isKeyDown() || (Controller.jump() && Minecraft.getMinecraft().currentScreen == null);
|
this.jump = this.gameSettings.keyBindJump.isKeyDown() || Controller.jump();
|
||||||
this.sneak = this.gameSettings.keyBindSneak.isKeyDown() || (Controller.crouch() && Minecraft.getMinecraft().currentScreen == null);
|
this.sneak = this.gameSettings.keyBindSneak.isKeyDown() || Controller.crouch();
|
||||||
if (this.sneak) {
|
if (this.sneak) {
|
||||||
this.moveStrafe = (float) ((double) this.moveStrafe * 0.3D);
|
this.moveStrafe = (float) ((double) this.moveStrafe * 0.3D);
|
||||||
this.moveForward = (float) ((double) this.moveForward * 0.3D);
|
this.moveForward = (float) ((double) this.moveForward * 0.3D);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user