Fix mouse pointer and movement!
This commit is contained in:
parent
479252d9de
commit
1e4b0d3262
src/teavm/java/net/minecraft
|
@ -42,7 +42,6 @@ public final class Minecraft implements Runnable {
|
|||
private boolean fullscreen = false;
|
||||
public int displayWidth;
|
||||
public int displayHeight;
|
||||
private OpenGlCapsChecker glCapabilities;
|
||||
private Timer timer = new Timer(20.0F);
|
||||
public World theWorld;
|
||||
public RenderGlobal renderGlobal;
|
||||
|
@ -147,7 +146,6 @@ public final class Minecraft implements Runnable {
|
|||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
this.glCapabilities = new OpenGlCapsChecker();
|
||||
this.options = new GameSettings(this);
|
||||
this.renderEngine = new RenderEngine(this.options);
|
||||
this.fontRenderer = new FontRenderer(this.options, "/default.png", this.renderEngine);
|
||||
|
@ -357,6 +355,12 @@ public final class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
private void runTick() {
|
||||
|
||||
if(!this.inventoryScreen) {
|
||||
this.mouseHelper.ungrabMouse();
|
||||
GL11.mouseSetGrabbed(false);
|
||||
}
|
||||
|
||||
this.ingameGUI.addChatMessage();
|
||||
if(!this.isGamePaused && this.theWorld != null) {
|
||||
this.playerController.onUpdate();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.minecraft.client.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class GuiIngameMenu extends GuiScreen {
|
||||
public final void initGui() {
|
||||
this.controlList.clear();
|
||||
|
@ -37,6 +39,8 @@ public final class GuiIngameMenu extends GuiScreen {
|
|||
if(var1.id == 4) {
|
||||
this.mc.displayGuiScreen((GuiScreen)null);
|
||||
this.mc.setIngameFocus();
|
||||
this.mc.mouseHelper.grabMouse();
|
||||
GL11.mouseSetGrabbed(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -108,61 +108,18 @@ public final class EntityRenderer {
|
|||
}
|
||||
|
||||
this.anaglyphEnable = GL11.isFocused();
|
||||
int var5;
|
||||
int var6;
|
||||
if(this.mc.inventoryScreen) {
|
||||
GL11.mouseGetDX();
|
||||
byte var2 = 0;
|
||||
GL11.mouseGetDY();
|
||||
byte var3 = 0;
|
||||
this.mc.mouseHelper.ungrabMouse();
|
||||
byte var4 = 1;
|
||||
if(this.mc.options.invertMouse) {
|
||||
var4 = -1;
|
||||
}
|
||||
|
||||
var5 = var2 + this.mc.mouseHelper.deltaX;
|
||||
var6 = var3 - this.mc.mouseHelper.deltaY;
|
||||
if(var2 != 0 || this.entityRendererInt1 != 0) {
|
||||
System.out.println("xxo: " + var2 + ", " + this.entityRendererInt1 + ": " + this.entityRendererInt1 + ", xo: " + var5);
|
||||
}
|
||||
|
||||
if(this.entityRendererInt1 != 0) {
|
||||
this.entityRendererInt1 = 0;
|
||||
}
|
||||
|
||||
if(this.entityRendererInt2 != 0) {
|
||||
this.entityRendererInt2 = 0;
|
||||
}
|
||||
|
||||
if(var2 != 0) {
|
||||
this.entityRendererInt1 = var2;
|
||||
}
|
||||
|
||||
if(var3 != 0) {
|
||||
this.entityRendererInt2 = var3;
|
||||
}
|
||||
|
||||
float var10001 = (float)var5;
|
||||
float var11 = (float)(var6 * var4);
|
||||
float var9 = var10001;
|
||||
EntityPlayerSP var7 = this.mc.thePlayer;
|
||||
float var13 = var7.rotationPitch;
|
||||
float var14 = var7.rotationYaw;
|
||||
var7.rotationYaw = (float)((double)var7.rotationYaw + (double)var9 * 0.15D);
|
||||
var7.rotationPitch = (float)((double)var7.rotationPitch - (double)var11 * 0.15D);
|
||||
if(var7.rotationPitch < -90.0F) {
|
||||
var7.rotationPitch = -90.0F;
|
||||
}
|
||||
|
||||
if(var7.rotationPitch > 90.0F) {
|
||||
var7.rotationPitch = 90.0F;
|
||||
}
|
||||
|
||||
var7.prevRotationPitch += var7.rotationPitch - var13;
|
||||
var7.prevRotationYaw += var7.rotationYaw - var14;
|
||||
int var5 = GL11.mouseGetDX();
|
||||
int var6 = GL11.mouseGetDY();;
|
||||
byte var91 = 1;
|
||||
|
||||
if(this.mc.options.invertMouse) {
|
||||
var91 = -1;
|
||||
}
|
||||
|
||||
if(this.mc.inventoryScreen && this.mc.theWorld != null) {
|
||||
this.mc.thePlayer.turn((float)var5, (float)(var6 * var91));
|
||||
}
|
||||
|
||||
ScaledResolution var8 = new ScaledResolution(this.mc.displayWidth, this.mc.displayHeight);
|
||||
int var10 = var8.getScaledWidth();
|
||||
int var12 = var8.getScaledHeight();
|
||||
|
|
|
@ -542,4 +542,21 @@ public abstract class Entity {
|
|||
public boolean isEntityAlive() {
|
||||
return !this.isDead;
|
||||
}
|
||||
|
||||
public void turn(float var1, float var2) {
|
||||
float var3 = this.rotationPitch;
|
||||
float var4 = this.rotationYaw;
|
||||
this.rotationYaw = (float)((double)this.rotationYaw + (double)var1 * 0.15D);
|
||||
this.rotationPitch = (float)((double)this.rotationPitch - (double)var2 * 0.15D);
|
||||
if(this.rotationPitch < -90.0F) {
|
||||
this.rotationPitch = -90.0F;
|
||||
}
|
||||
|
||||
if(this.rotationPitch > 90.0F) {
|
||||
this.rotationPitch = 90.0F;
|
||||
}
|
||||
|
||||
this.prevRotationPitch += this.rotationPitch - var3;
|
||||
this.prevRotationYaw += this.rotationYaw - var4;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user