Skip to content

Commit b7236c2

Browse files
committed
srsly
1 parent 82db47f commit b7236c2

File tree

2 files changed

+46
-32
lines changed

2 files changed

+46
-32
lines changed

patches/net/minecraft/client/renderer/EntityRenderer.java.patch

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/net/minecraft/client/renderer/EntityRenderer.java
22
+++ b/net/minecraft/client/renderer/EntityRenderer.java
3-
@@ -1,27 +1,59 @@
3+
@@ -1,27 +1,60 @@
44
package net.minecraft.client.renderer;
55

66
-import com.google.gson.JsonSyntaxException;
@@ -54,6 +54,7 @@
5454
+import net.minecraft.client.gui.GuiWinGame;
5555
import net.minecraft.client.gui.MapItemRenderer;
5656
import net.minecraft.client.gui.ScaledResolution;
57+
+import net.minecraft.client.gui.inventory.GuiContainer;
5758
import net.minecraft.client.multiplayer.WorldClient;
5859
import net.minecraft.client.particle.EffectRenderer;
5960
import net.minecraft.client.particle.EntityRainFX;
@@ -62,7 +63,7 @@
6263
import net.minecraft.client.renderer.culling.Frustrum;
6364
import net.minecraft.client.renderer.entity.RenderManager;
6465
import net.minecraft.client.renderer.texture.DynamicTexture;
65-
@@ -29,10 +61,12 @@
66+
@@ -29,10 +62,12 @@
6667
import net.minecraft.client.resources.I18n;
6768
import net.minecraft.client.resources.IResourceManager;
6869
import net.minecraft.client.resources.IResourceManagerReloadListener;
@@ -75,7 +76,7 @@
7576
import net.minecraft.enchantment.EnchantmentHelper;
7677
import net.minecraft.entity.Entity;
7778
import net.minecraft.entity.EntityLivingBase;
78-
@@ -40,6 +74,9 @@
79+
@@ -40,6 +75,9 @@
7980
import net.minecraft.entity.item.EntityItemFrame;
8081
import net.minecraft.entity.player.EntityPlayer;
8182
import net.minecraft.init.Blocks;
@@ -85,7 +86,7 @@
8586
import net.minecraft.potion.Potion;
8687
import net.minecraft.server.integrated.IntegratedServer;
8788
import net.minecraft.src.Config;
88-
@@ -61,2593 +98,4849 @@
89+
@@ -61,2593 +99,4852 @@
8990
import net.minecraft.world.World;
9091
import net.minecraft.world.WorldProvider;
9192
import net.minecraft.world.biome.BiomeGenBase;
@@ -2294,8 +2295,9 @@
22942295
+
22952296
+
22962297
+ this.mc.mcProfiler.endStartSection("getPointedBlock");
2297-
+ this.getMouseOver(par1);
2298-
+
2298+
+ //this.getMouseOver(par1);
2299+
+ //dont call this cause soemthing might inherit it
2300+
+
22992301
+ if( this.mc.currentScreen == null )
23002302
+ {
23012303
+ if(mc.currentPass == renderPass.Left)
@@ -4550,11 +4552,12 @@
45504552
+ GL11.glDisable(GL11.GL_ALPHA_TEST);
45514553
+ }
45524554
+
4553-
+ if (this.mc.vrSettings.hudOcclusion == false || this.mc.currentScreen != null){
4555+
+ if (this.mc.vrSettings.hudOcclusion == false){
45544556
+ // Never use depth test for in game menu - so you can always see it!
45554557
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
4556-
+ }
4557-
+
4558+
+ } else GL11.glEnable(GL11.GL_DEPTH_TEST);
4559+
+ GL11.glDepthMask(true);
4560+
+
45584561
+ //the framebuffer has to be drawn with color blending transparency to support non-alpha cursors. Always has a black background.
45594562
+ GL11.glDisable(GL11.GL_BLEND);
45604563
+
@@ -4567,7 +4570,6 @@
45674570
+
45684571
+ if(mc.currentPass == renderPass.Third){
45694572
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
4570-
+ GL11.glDepthMask(true);
45714573
+ }
45724574
+
45734575
+ //Render framebuffer onto world projection
@@ -4704,19 +4706,23 @@
47044706
+
47054707
+ if (!drawScreenHandled)
47064708
+ {
4707-
+ this.mc.currentScreen.drawScreen(mouseX, mouseY, renderPartialTicks);
4709+
+ try {
4710+
+ this.mc.currentScreen.drawScreen(mouseX, mouseY, renderPartialTicks);
4711+
+ } catch (Exception e) {
4712+
+ //wtf LOTR?
4713+
+ }
47084714
+ }
47094715
+
47104716
+ if(mc.currentScreen !=null){ //wtf pixelmon?
4711-
+
4712-
+ if(Reflector.EventBus_post.exists()) Reflector.postForgeBusEvent(Reflector.DrawScreenEvent_Post_Constructor, new Object[] {this.mc.currentScreen, Integer.valueOf(mouseX), Integer.valueOf(mouseY), Float.valueOf(renderPartialTicks)});
4717+
+
4718+
+ if(Reflector.EventBus_post.exists()) Reflector.postForgeBusEvent(Reflector.DrawScreenEvent_Post_Constructor, new Object[] {this.mc.currentScreen, Integer.valueOf(mouseX), Integer.valueOf(mouseY), Float.valueOf(renderPartialTicks)});
47134719
+
4714-
+ // Draw GUI crosshair
4715-
+ if (mc.stereoProvider.isStereo()){
4716-
+ if(MCOpenVR.controllerMouseValid){
4717-
+ mc.ingameGUI.drawMouseMenuQuad(mc.currentScreen.getMouseX(),mc.currentScreen.getMouseY()) ;
4718-
+ }
4719-
+ } else mc.ingameGUI.drawMouseMenuQuad(mc.currentScreen.getMouseX(),mc.currentScreen.getMouseY()) ;
4720+
+ // Draw GUI crosshair
4721+
+ if (mc.stereoProvider.isStereo()){
4722+
+ if(MCOpenVR.controllerMouseValid){
4723+
+ mc.ingameGUI.drawMouseMenuQuad(this.mc.currentScreen.getMouseX(),this.mc.currentScreen.getMouseY());
4724+
+ }
4725+
+ } else mc.ingameGUI.drawMouseMenuQuad(this.mc.currentScreen.getMouseX(),this.mc.currentScreen.getMouseY());
47204726
+ }
47214727
+ }
47224728
+ catch (Throwable throwable)
@@ -5600,8 +5606,6 @@
56005606
+ }
56015607
+
56025608
+ if (mc.objectMouseOver == null) {
5603-
+
5604-
+
56055609
+ GL11.glRotatef(45, 0, 0, 1);
56065610
+ }
56075611
+

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ public class MCOpenVR
162162
public static boolean hudPopup = true;
163163

164164
// For mouse menu emulation
165-
private static float controllerMouseX = -1.0f;
166-
private static float controllerMouseY = -1.0f;
165+
public static float controllerMouseX = -1.0f;
166+
public static float controllerMouseY = -1.0f;
167167
public static boolean controllerMouseValid;
168168
public static int controllerMouseTicks;
169169

@@ -741,18 +741,21 @@ else if (controllerMouseX == -1.0f)
741741
}
742742
//end Shift
743743
}
744+
744745
if (controllerMouseX >= 0 && controllerMouseX < mc.displayWidth
745746
&& controllerMouseY >=0 && controllerMouseY < mc.displayHeight)
746747
{
747748
// clamp to screen
748-
int mouseX = Math.min(Math.max((int) controllerMouseX, 0), mc.displayWidth);
749-
int mouseY = Math.min(Math.max((int) controllerMouseY, 0), mc.displayHeight);
749+
int mouseX =(int) (controllerMouseX = Math.min(Math.max((int) controllerMouseX, 0), mc.displayWidth));
750+
int mouseY =(int) (controllerMouseY = Math.min(Math.max((int) controllerMouseY, 0), mc.displayHeight));
750751

751752
if (controllerDeviceIndex[RIGHT_CONTROLLER] != -1)
752753
{
753-
Mouse.setCursorPosition(mouseX, mouseY);
754+
755+
Mouse.setCursorPosition((int)controllerMouseX, (int)controllerMouseY);
754756
controllerMouseValid = true;
755757
//LMB
758+
756759
if (mc.currentScreen != null &&
757760
controllerStateReference[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold &&
758761
lastControllerState[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x <= triggerThreshold
@@ -1453,9 +1456,6 @@ private static void clearTouchpadSampleBuffer(int controller)
14531456

14541457
private static void processTouchpadSampleBuffer()
14551458
{
1456-
if (mc.thePlayer == null)
1457-
return;
1458-
14591459
if (mc.currentScreen != null){
14601460
// right touchpad controls mousewheel
14611461
int c =0;
@@ -1487,7 +1487,7 @@ private static void processTouchpadSampleBuffer()
14871487
inventory_swipe[c] += swipeDistancePerInventorySlot;
14881488
}
14891489
}
1490-
} else {
1490+
} else if (mc.thePlayer != null) {
14911491
// left touchpad controls inventory
14921492
int c =1;
14931493
boolean touchpadPressed = (controllerStateReference[c].ulButtonPressed & k_buttonTouchpad) > 0;
@@ -1506,11 +1506,21 @@ private static void processTouchpadSampleBuffer()
15061506
float swipeDistancePerInventorySlot = 0.4f;
15071507
if (inventory_swipe[c] > swipeDistancePerInventorySlot)
15081508
{
1509-
hotbarNext.pressKey();
1509+
if (Display.isActive()) {
1510+
KeyboardSimulator.robot.mouseWheel(25);
1511+
short duration = 250;
1512+
vrsystem.TriggerHapticPulse.apply(controllerDeviceIndex[1], 0, duration);
1513+
}
1514+
else hotbarNext.pressKey();
15101515
inventory_swipe[c] -= swipeDistancePerInventorySlot;
15111516
} else if (inventory_swipe[c] < -swipeDistancePerInventorySlot)
15121517
{
1513-
hotbarPrev.pressKey();
1518+
if (Display.isActive()) {
1519+
KeyboardSimulator.robot.mouseWheel(-25);
1520+
short duration = 250;
1521+
vrsystem.TriggerHapticPulse.apply(controllerDeviceIndex[1], 0, duration);
1522+
}
1523+
else hotbarPrev.pressKey();
15141524
inventory_swipe[c] += swipeDistancePerInventorySlot;
15151525
}
15161526
}

0 commit comments

Comments
 (0)