Skip to content

Commit 00bcb6f

Browse files
committed
38 pre
1 parent eae0d76 commit 00bcb6f

File tree

9 files changed

+349
-36
lines changed

9 files changed

+349
-36
lines changed

minecriftversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
of_json_name = "1.7.10_HD_U_D1"
55
of_file_md5 = "57c724fe8335c82aef8d54c101043e60"
66
minecrift_version_num = "1.7.10"
7-
minecrift_build = "jrbudda-37r1"
7+
minecrift_build = "jrbudda-38pre"
88
of_file_extension = ".jar"
99
mcp_version = "mcp908"
1010
mcp_uses_generics = False

patches/net/minecraft/client/Minecraft.java.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@
12461246
+ * The minecriftVerString will be automatically updated by the build scripts, do not modify here.
12471247
+ * Modify minecriftversion.py in root minecrift dir.
12481248
+ */
1249-
+ public final String minecriftVerString = "Vivecraft 1.7.10 jrbudda-37r1";
1249+
+ public final String minecriftVerString = "Vivecraft 1.7.10 jrbudda-38pre";
12501250
+ private boolean trigger;
12511251
+ /* end version */
12521252
+ /** END MINECRIFT */
@@ -5157,11 +5157,11 @@
51575157
+ this.reinitFramebuffers = true;
51585158
+ }
51595159
+
5160-
+ if (!Display.isActive() && this.fullscreen)
5161-
+ {
5162-
+ this.toggleFullscreen();
5163-
+ this.reinitFramebuffers = true;
5164-
+ }
5160+
+// if (!Display.isActive() && this.fullscreen)
5161+
+// {
5162+
+// this.toggleFullscreen();
5163+
+// this.reinitFramebuffers = true;
5164+
+// }
51655165
+
51665166
+ if (wasDisplayResized())
51675167
+ {

patches/net/minecraft/client/gui/GuiChat.java.patch

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
--- a/net/minecraft/client/gui/GuiChat.java
22
+++ b/net/minecraft/client/gui/GuiChat.java
3-
@@ -118,9 +118,9 @@
3+
@@ -3,6 +3,8 @@
4+
import com.google.common.base.Splitter;
5+
import com.google.common.collect.Lists;
6+
import com.google.common.collect.Sets;
7+
+import com.mtbs3d.minecrift.provider.MCOpenVR;
8+
+
9+
import java.io.File;
10+
import java.net.URI;
11+
import java.net.URISyntaxException;
12+
@@ -118,9 +120,9 @@
413
this.playerNamesFound = false;
514
}
615

@@ -12,7 +21,7 @@
1221
}
1322
else if (keyCode != 28 && keyCode != 156)
1423
{
15-
@@ -153,8 +153,11 @@
24+
@@ -153,8 +155,15 @@
1625
{
1726
this.submitChatMessage(var3);
1827
}
@@ -21,12 +30,16 @@
2130
+
2231
+ //VIVE DONT CLOSE ON RETURN
2332
+ // this.mc.displayGuiScreen((GuiScreen)null);
24-
+ this.inputField.setText("");
33+
+ if (MCOpenVR.keyboardShowing) {
34+
+ this.inputField.setText("");
35+
+ } else {
36+
+ this.mc.displayGuiScreen((GuiScreen)null);
37+
+ }
2538
+
2639
}
2740
}
2841

29-
@@ -184,7 +187,7 @@
42+
@@ -184,7 +193,7 @@
3043
var1 = -1;
3144
}
3245

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--- a/net/minecraft/client/main/Main.java
2+
+++ b/net/minecraft/client/main/Main.java
3+
@@ -77,8 +77,8 @@
4+
ArgumentAcceptingOptionSpec var12 = var1.accepts("uuid").withRequiredArg();
5+
ArgumentAcceptingOptionSpec var13 = var1.accepts("accessToken").withRequiredArg().required();
6+
ArgumentAcceptingOptionSpec var14 = var1.accepts("version").withRequiredArg().required();
7+
- ArgumentAcceptingOptionSpec var15 = var1.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(854), new Integer[0]);
8+
- ArgumentAcceptingOptionSpec var16 = var1.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(480), new Integer[0]);
9+
+ ArgumentAcceptingOptionSpec var15 = var1.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(1280), new Integer[0]);
10+
+ ArgumentAcceptingOptionSpec var16 = var1.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(720), new Integer[0]);
11+
ArgumentAcceptingOptionSpec var17 = var1.accepts("userProperties").withRequiredArg().required();
12+
ArgumentAcceptingOptionSpec var18 = var1.accepts("assetIndex").withRequiredArg();
13+
ArgumentAcceptingOptionSpec var19 = var1.accepts("userType").withRequiredArg().defaultsTo("legacy", new String[0]);

patches/net/minecraft/network/NetHandlerPlayServer.java.patch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@
102102
{
103103
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, var11, var12);
104104
return;
105+
@@ -468,7 +472,7 @@
106+
double var11 = this.playerEntity.posZ - ((double)var6 + 0.5D);
107+
double var13 = var7 * var7 + var9 * var9 + var11 * var11;
108+
109+
- if (var13 > 36.0D)
110+
+ if (var13 > 262144.0D)
111+
{
112+
return;
113+
}
105114
@@ -1129,20 +1133,20 @@
106115
{
107116
var3 = var2.readItemStackFromBuffer();

src/com/mtbs3d/minecrift/provider/MCOpenVR.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.mtbs3d.minecrift.settings.VRHotkeys;
88
import com.mtbs3d.minecrift.settings.VRSettings;
99
import com.mtbs3d.minecrift.utils.KeyboardSimulator;
10+
import com.mtbs3d.minecrift.utils.MCReflection;
1011
import com.sun.jna.Memory;
1112
import com.sun.jna.NativeLibrary;
1213
import com.sun.jna.Pointer;
@@ -999,7 +1000,7 @@ else if (controllerMouseX == -1.0f)
9991000

10001001
if (pressedLMB || pressedRMB)
10011002
{
1002-
{mc.thePlayer.closeScreen();}
1003+
// {mc.thePlayer.closeScreen();}
10031004
}
10041005
}
10051006
}
@@ -1846,6 +1847,16 @@ private static void pollInputEvents()
18461847
case EVREventType.EVREventType_VREvent_KeyboardClosed:
18471848
//'huzzah'
18481849
keyboardShowing = false;
1850+
if (mc.currentScreen instanceof GuiChat) {
1851+
GuiTextField field = (GuiTextField)MCReflection.getField(MCReflection.chatInputField, mc.currentScreen);
1852+
if (field != null) {
1853+
String s = field.getText().trim();
1854+
if (!s.isEmpty()) {
1855+
((GuiChat)mc.currentScreen).submitChatMessage(s);
1856+
}
1857+
}
1858+
mc.displayGuiScreen((GuiScreen)null);
1859+
}
18491860
break;
18501861
case EVREventType.EVREventType_VREvent_KeyboardCharInput:
18511862
byte[] inbytes = event.data.getPointer().getByteArray(0, 8);
@@ -1857,18 +1868,9 @@ private static void pollInputEvents()
18571868
if (mc.currentScreen != null) { // experimental, needs testing
18581869
try {
18591870
for (char ch : str.toCharArray()) {
1860-
switch (ch) {
1861-
case '\r':
1862-
case '\n':
1863-
case '\t':
1864-
case '\b':
1865-
KeyboardSimulator.type(ch);
1866-
break;
1867-
default:
1868-
int[] codes = KeyboardSimulator.getCodes(ch);
1869-
mc.currentScreen.keyTypedPublic(ch, codes.length > 0 ? codes[codes.length - 1] : 0);
1870-
break;
1871-
}
1871+
int[] codes = KeyboardSimulator.getLWJGLCodes(ch);
1872+
mc.currentScreen.keyTypedPublic(ch, codes.length > 0 ? codes[codes.length - 1] : 0);
1873+
break;
18721874
}
18731875
} catch (Exception e) {
18741876
e.printStackTrace();

src/com/mtbs3d/minecrift/provider/OpenVRStereoRenderer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public RenderTextureInfo getRenderTextureSizes(float renderScaleFactor)
4242

4343
RenderTextureInfo info = new RenderTextureInfo();
4444
info.HmdNativeResolution.w = rtx.getValue();
45-
info.HmdNativeResolution.h = rtx.getValue();
45+
info.HmdNativeResolution.h = rty.getValue();
4646
info.LeftFovTextureResolution.w = (int) (rtx.getValue());
47-
info.LeftFovTextureResolution.h = (int) (rtx.getValue());
47+
info.LeftFovTextureResolution.h = (int) (rty.getValue());
4848
info.RightFovTextureResolution.w = (int) (rtx.getValue());
49-
info.RightFovTextureResolution.h = (int) (rtx.getValue());
49+
info.RightFovTextureResolution.h = (int) (rty.getValue());
5050
if ( info.LeftFovTextureResolution.w % 2 != 0) info.LeftFovTextureResolution.w++;
5151
if ( info.LeftFovTextureResolution.h % 2 != 0) info.LeftFovTextureResolution.w++;
5252
if ( info.RightFovTextureResolution.w % 2 != 0) info.LeftFovTextureResolution.w++;

src/com/mtbs3d/minecrift/utils/KeyboardSimulator.java

Lines changed: 121 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
package com.mtbs3d.minecrift.utils;
22

3+
import net.minecraft.client.Minecraft;
4+
5+
import org.lwjgl.input.Keyboard;
6+
import org.lwjgl.opengl.Display;
7+
38
import static java.awt.event.KeyEvent.*;
49

510
import java.awt.AWTException;
611
import java.awt.Robot;
712

13+
814
public class KeyboardSimulator {
915
public static Robot robot;
1016

1117
static{
1218
try {
1319
robot = new Robot();
1420
} catch (AWTException e) {
21+
e.printStackTrace();
1522
}
1623
}
1724

@@ -143,8 +150,114 @@ public static int[] getCodes(char character) {
143150
case ' ': return codes(VK_SPACE);
144151
case '\b': return codes(VK_BACK_SPACE);
145152
case '\r': return codes(VK_ENTER);
146-
default:
147-
throw new IllegalArgumentException("Cannot type character " + character);
153+
default: return codes();
154+
//default: throw new IllegalArgumentException("Cannot type character " + character);
155+
}
156+
}
157+
158+
public static int[] getLWJGLCodes(char character) {
159+
switch (character) {
160+
case 'a': return codes(Keyboard.KEY_A);
161+
case 'b': return codes(Keyboard.KEY_B);
162+
case 'c': return codes(Keyboard.KEY_C);
163+
case 'd': return codes(Keyboard.KEY_D);
164+
case 'e': return codes(Keyboard.KEY_E);
165+
case 'f': return codes(Keyboard.KEY_F);
166+
case 'g': return codes(Keyboard.KEY_G);
167+
case 'h': return codes(Keyboard.KEY_H);
168+
case 'i': return codes(Keyboard.KEY_I);
169+
case 'j': return codes(Keyboard.KEY_J);
170+
case 'k': return codes(Keyboard.KEY_K);
171+
case 'l': return codes(Keyboard.KEY_L);
172+
case 'm': return codes(Keyboard.KEY_M);
173+
case 'n': return codes(Keyboard.KEY_N);
174+
case 'o': return codes(Keyboard.KEY_O);
175+
case 'p': return codes(Keyboard.KEY_P);
176+
case 'q': return codes(Keyboard.KEY_Q);
177+
case 'r': return codes(Keyboard.KEY_R);
178+
case 's': return codes(Keyboard.KEY_S);
179+
case 't': return codes(Keyboard.KEY_T);
180+
case 'u': return codes(Keyboard.KEY_U);
181+
case 'v': return codes(Keyboard.KEY_V);
182+
case 'w': return codes(Keyboard.KEY_W);
183+
case 'x': return codes(Keyboard.KEY_X);
184+
case 'y': return codes(Keyboard.KEY_Y);
185+
case 'z': return codes(Keyboard.KEY_Z);
186+
case 'A': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_A);
187+
case 'B': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_B);
188+
case 'C': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_C);
189+
case 'D': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_D);
190+
case 'E': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_E);
191+
case 'F': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_F);
192+
case 'G': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_G);
193+
case 'H': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_H);
194+
case 'I': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_I);
195+
case 'J': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_J);
196+
case 'K': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_K);
197+
case 'L': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_L);
198+
case 'M': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_M);
199+
case 'N': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_N);
200+
case 'O': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_O);
201+
case 'P': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_P);
202+
case 'Q': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_Q);
203+
case 'R': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_R);
204+
case 'S': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_S);
205+
case 'T': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_T);
206+
case 'U': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_U);
207+
case 'V': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_V);
208+
case 'W': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_W);
209+
case 'X': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_X);
210+
case 'Y': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_Y);
211+
case 'Z': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_Z);
212+
case '`': return codes(Keyboard.KEY_GRAVE);
213+
case '0': return codes(Keyboard.KEY_0);
214+
case '1': return codes(Keyboard.KEY_1);
215+
case '2': return codes(Keyboard.KEY_2);
216+
case '3': return codes(Keyboard.KEY_3);
217+
case '4': return codes(Keyboard.KEY_4);
218+
case '5': return codes(Keyboard.KEY_5);
219+
case '6': return codes(Keyboard.KEY_6);
220+
case '7': return codes(Keyboard.KEY_7);
221+
case '8': return codes(Keyboard.KEY_8);
222+
case '9': return codes(Keyboard.KEY_9);
223+
case '-': return codes(Keyboard.KEY_MINUS);
224+
case '=': return codes(Keyboard.KEY_EQUALS);
225+
case '~': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_B);
226+
case '!': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_1);
227+
case '@': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_2);
228+
case '#': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_3);
229+
case '$': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_4);
230+
case '%': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_5);
231+
case '^': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_6);
232+
case '&': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_7);
233+
case '*': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_8);
234+
case '(': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_9);
235+
case ')': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_0);
236+
case '_': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_MINUS);
237+
case '+': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_EQUALS);
238+
case '\t': return codes(Keyboard.KEY_TAB);
239+
case '\n': return codes(Keyboard.KEY_RETURN);
240+
case '[': return codes(Keyboard.KEY_LBRACKET);
241+
case ']': return codes(Keyboard.KEY_RBRACKET);
242+
case '\\': return codes(Keyboard.KEY_BACKSLASH);
243+
case '{': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_LBRACKET);
244+
case '}': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_RBRACKET);
245+
case '|': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_BACKSLASH);
246+
case ';': return codes(Keyboard.KEY_SEMICOLON);
247+
case ':': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_SEMICOLON);
248+
case '\'': return codes(Keyboard.KEY_APOSTROPHE);
249+
case '"': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_APOSTROPHE);
250+
case ',': return codes(Keyboard.KEY_COMMA);
251+
case '<': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_COMMA);
252+
case '.': return codes(Keyboard.KEY_PERIOD);
253+
case '>': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_PERIOD);
254+
case '/': return codes(Keyboard.KEY_SLASH);
255+
case '?': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_SLASH);
256+
case ' ': return codes(Keyboard.KEY_SPACE);
257+
case '\b': return codes(Keyboard.KEY_BACK);
258+
case '\r': return codes(Keyboard.KEY_RETURN);
259+
default: return codes();
260+
//default: throw new IllegalArgumentException("Cannot type character " + character);
148261
}
149262
}
150263

@@ -154,13 +267,12 @@ private static int[] codes(int... keyCodes) {
154267

155268
private static void doType(int[] keyCodes, int offset, int length) {
156269
try {
157-
158-
if (length == 0) {
159-
return;
160-
}
161-
robot.keyPress(keyCodes[offset]);
162-
doType(keyCodes, offset + 1, length - 1);
163-
robot.keyRelease(keyCodes[offset]);
270+
if (length == 0) {
271+
return;
272+
}
273+
robot.keyPress(keyCodes[offset]);
274+
doType(keyCodes, offset + 1, length - 1);
275+
robot.keyRelease(keyCodes[offset]);
164276
} catch (Exception e) {
165277
System.out.println("Cannot type keycode: " + keyCodes[offset]);
166278
}

0 commit comments

Comments
 (0)