Skip to content

Commit

Permalink
srsly
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbudda committed Aug 3, 2016
1 parent 82db47f commit b7236c2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 32 deletions.
46 changes: 25 additions & 21 deletions patches/net/minecraft/client/renderer/EntityRenderer.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/EntityRenderer.java
+++ b/net/minecraft/client/renderer/EntityRenderer.java
@@ -1,27 +1,59 @@
@@ -1,27 +1,60 @@
package net.minecraft.client.renderer;

-import com.google.gson.JsonSyntaxException;
Expand Down Expand Up @@ -54,6 +54,7 @@
+import net.minecraft.client.gui.GuiWinGame;
import net.minecraft.client.gui.MapItemRenderer;
import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityRainFX;
Expand All @@ -62,7 +63,7 @@
import net.minecraft.client.renderer.culling.Frustrum;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.DynamicTexture;
@@ -29,10 +61,12 @@
@@ -29,10 +62,12 @@
import net.minecraft.client.resources.I18n;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
Expand All @@ -75,7 +76,7 @@
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -40,6 +74,9 @@
@@ -40,6 +75,9 @@
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
Expand All @@ -85,7 +86,7 @@
import net.minecraft.potion.Potion;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.src.Config;
@@ -61,2593 +98,4849 @@
@@ -61,2593 +99,4852 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeGenBase;
Expand Down Expand Up @@ -2294,8 +2295,9 @@
+
+
+ this.mc.mcProfiler.endStartSection("getPointedBlock");
+ this.getMouseOver(par1);
+
+ //this.getMouseOver(par1);
+ //dont call this cause soemthing might inherit it
+
+ if( this.mc.currentScreen == null )
+ {
+ if(mc.currentPass == renderPass.Left)
Expand Down Expand Up @@ -4550,11 +4552,12 @@
+ GL11.glDisable(GL11.GL_ALPHA_TEST);
+ }
+
+ if (this.mc.vrSettings.hudOcclusion == false || this.mc.currentScreen != null){
+ if (this.mc.vrSettings.hudOcclusion == false){
+ // Never use depth test for in game menu - so you can always see it!
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+ }
+
+ } else GL11.glEnable(GL11.GL_DEPTH_TEST);
+ GL11.glDepthMask(true);
+
+ //the framebuffer has to be drawn with color blending transparency to support non-alpha cursors. Always has a black background.
+ GL11.glDisable(GL11.GL_BLEND);
+
Expand All @@ -4567,7 +4570,6 @@
+
+ if(mc.currentPass == renderPass.Third){
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ GL11.glDepthMask(true);
+ }
+
+ //Render framebuffer onto world projection
Expand Down Expand Up @@ -4704,19 +4706,23 @@
+
+ if (!drawScreenHandled)
+ {
+ this.mc.currentScreen.drawScreen(mouseX, mouseY, renderPartialTicks);
+ try {
+ this.mc.currentScreen.drawScreen(mouseX, mouseY, renderPartialTicks);
+ } catch (Exception e) {
+ //wtf LOTR?
+ }
+ }
+
+ if(mc.currentScreen !=null){ //wtf pixelmon?
+
+ 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)});
+
+ 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)});
+
+ // Draw GUI crosshair
+ if (mc.stereoProvider.isStereo()){
+ if(MCOpenVR.controllerMouseValid){
+ mc.ingameGUI.drawMouseMenuQuad(mc.currentScreen.getMouseX(),mc.currentScreen.getMouseY()) ;
+ }
+ } else mc.ingameGUI.drawMouseMenuQuad(mc.currentScreen.getMouseX(),mc.currentScreen.getMouseY()) ;
+ // Draw GUI crosshair
+ if (mc.stereoProvider.isStereo()){
+ if(MCOpenVR.controllerMouseValid){
+ mc.ingameGUI.drawMouseMenuQuad(this.mc.currentScreen.getMouseX(),this.mc.currentScreen.getMouseY());
+ }
+ } else mc.ingameGUI.drawMouseMenuQuad(this.mc.currentScreen.getMouseX(),this.mc.currentScreen.getMouseY());
+ }
+ }
+ catch (Throwable throwable)
Expand Down Expand Up @@ -5600,8 +5606,6 @@
+ }
+
+ if (mc.objectMouseOver == null) {
+
+
+ GL11.glRotatef(45, 0, 0, 1);
+ }
+
Expand Down
32 changes: 21 additions & 11 deletions src/com/mtbs3d/minecrift/provider/MCOpenVR.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ public class MCOpenVR
public static boolean hudPopup = true;

// For mouse menu emulation
private static float controllerMouseX = -1.0f;
private static float controllerMouseY = -1.0f;
public static float controllerMouseX = -1.0f;
public static float controllerMouseY = -1.0f;
public static boolean controllerMouseValid;
public static int controllerMouseTicks;

Expand Down Expand Up @@ -741,18 +741,21 @@ else if (controllerMouseX == -1.0f)
}
//end Shift
}

if (controllerMouseX >= 0 && controllerMouseX < mc.displayWidth
&& controllerMouseY >=0 && controllerMouseY < mc.displayHeight)
{
// clamp to screen
int mouseX = Math.min(Math.max((int) controllerMouseX, 0), mc.displayWidth);
int mouseY = Math.min(Math.max((int) controllerMouseY, 0), mc.displayHeight);
int mouseX =(int) (controllerMouseX = Math.min(Math.max((int) controllerMouseX, 0), mc.displayWidth));
int mouseY =(int) (controllerMouseY = Math.min(Math.max((int) controllerMouseY, 0), mc.displayHeight));

if (controllerDeviceIndex[RIGHT_CONTROLLER] != -1)
{
Mouse.setCursorPosition(mouseX, mouseY);

Mouse.setCursorPosition((int)controllerMouseX, (int)controllerMouseY);
controllerMouseValid = true;
//LMB

if (mc.currentScreen != null &&
controllerStateReference[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x > triggerThreshold &&
lastControllerState[RIGHT_CONTROLLER].rAxis[k_EAxis_Trigger].x <= triggerThreshold
Expand Down Expand Up @@ -1453,9 +1456,6 @@ private static void clearTouchpadSampleBuffer(int controller)

private static void processTouchpadSampleBuffer()
{
if (mc.thePlayer == null)
return;

if (mc.currentScreen != null){
// right touchpad controls mousewheel
int c =0;
Expand Down Expand Up @@ -1487,7 +1487,7 @@ private static void processTouchpadSampleBuffer()
inventory_swipe[c] += swipeDistancePerInventorySlot;
}
}
} else {
} else if (mc.thePlayer != null) {
// left touchpad controls inventory
int c =1;
boolean touchpadPressed = (controllerStateReference[c].ulButtonPressed & k_buttonTouchpad) > 0;
Expand All @@ -1506,11 +1506,21 @@ private static void processTouchpadSampleBuffer()
float swipeDistancePerInventorySlot = 0.4f;
if (inventory_swipe[c] > swipeDistancePerInventorySlot)
{
hotbarNext.pressKey();
if (Display.isActive()) {
KeyboardSimulator.robot.mouseWheel(25);
short duration = 250;
vrsystem.TriggerHapticPulse.apply(controllerDeviceIndex[1], 0, duration);
}
else hotbarNext.pressKey();
inventory_swipe[c] -= swipeDistancePerInventorySlot;
} else if (inventory_swipe[c] < -swipeDistancePerInventorySlot)
{
hotbarPrev.pressKey();
if (Display.isActive()) {
KeyboardSimulator.robot.mouseWheel(-25);
short duration = 250;
vrsystem.TriggerHapticPulse.apply(controllerDeviceIndex[1], 0, duration);
}
else hotbarPrev.pressKey();
inventory_swipe[c] += swipeDistancePerInventorySlot;
}
}
Expand Down

0 comments on commit b7236c2

Please sign in to comment.