From e85849b97d3b6713113e03cec8be33f24ebf8210 Mon Sep 17 00:00:00 2001 From: jrbudda Date: Thu, 12 Jan 2017 15:03:33 -0500 Subject: [PATCH] 35 --- installer/Installer.java | 32 +++---- minecriftversion.py | 2 +- .../net/minecraft/client/Minecraft.java.patch | 2 +- .../renderer/entity/RenderFish.java.patch | 2 +- .../renderer/entity/RenderLiving.java.patch | 35 +++++++ .../mtbs3d/minecrift/provider/MCOpenVR.java | 8 +- .../minecrift/provider/OpenVRPlayer.java | 96 ++++++++++--------- 7 files changed, 106 insertions(+), 71 deletions(-) create mode 100644 patches/net/minecraft/client/renderer/entity/RenderLiving.java.patch diff --git a/installer/Installer.java b/installer/Installer.java index 78d0b528..a5fb0db3 100644 --- a/installer/Installer.java +++ b/installer/Installer.java @@ -317,7 +317,7 @@ private boolean downloadFile(String surl, File fo, String md5) } if (success) { if (!checkMD5(fo, md5)){ - System.out.println("Bad md5 for " + fo.getName() + "!" + " actual: " + GetMd5(fo)); + JOptionPane.showMessageDialog(null, "Bad md5 for " + fo.getName() + "!" + " actual: " + GetMd5(fo).toLowerCase(),"Error downloading", JOptionPane.ERROR_MESSAGE); fo.delete(); success = false; } @@ -565,12 +565,12 @@ private boolean SetupMinecraftAsLibrary() { String minecriftVersionName = "vivecraft-" + version + mod; s+= minecriftVersionName; File tar = new File(targetDir, "versions" + File.separator + minecriftVersionName + File.separator + minecriftVersionName + ".jar"); - s+=MC_MD5 + " " + GetMd5(tar); + s+= " " + MC_MD5 + " " + GetMd5(tar); if(checkMD5(tar, MC_MD5)) return true; if(mc_jar == null){ File vanilla = new File(targetDir, "versions" + File.separator + MINECRAFT_VERSION + File.separator + MINECRAFT_VERSION+".jar"); - s+=MC_MD5 + " " + GetMd5(vanilla); + s+= " " + MC_MD5 + " " + GetMd5(vanilla); if(checkMD5(vanilla, MC_MD5)) mc_jar = vanilla; } @@ -589,10 +589,6 @@ private boolean SetupMinecraftAsLibrary() { if(mc_jar == null) return false; - - - - InputStream src = new FileInputStream(mc_jar); return copyInputStreamToFile(src, tar); @@ -1016,15 +1012,6 @@ public Void doInBackground() } monitor.setProgress(50); - monitor.setNote("Checking for base game..."); - - - if(!SetupMinecraftAsLibrary()) - { - JOptionPane.showMessageDialog(null, - "Could not locate or download base game. The Mincraft Launcher will attempt to download it.", - "Warning!",JOptionPane.WARNING_MESSAGE); - } // VIVE START - install openVR monitor.setProgress(52); @@ -1049,13 +1036,22 @@ public Void doInBackground() installedForge = installForge(forgeInstaller); } monitor.setProgress(75); - monitor.setNote("Extracting correct Minecrift version..."); - finalMessage = "Failed: Couldn't extract Minecrift. Try redownloading this installer."; + monitor.setNote("Extracting correct Vivecraft version..."); + finalMessage = "Failed: Couldn't extract Vivecraft. Try redownloading this installer."; if(!ExtractVersion()) { monitor.close(); return null; } + + monitor.setNote("Checking for base game..."); + if(!SetupMinecraftAsLibrary()) + { + JOptionPane.showMessageDialog(null, + "Could not locate or download base game. The Mincraft Launcher will attempt to download it.", + "Warning!",JOptionPane.WARNING_MESSAGE); + } + if(useHrtf.isSelected()) { monitor.setProgress(85); diff --git a/minecriftversion.py b/minecriftversion.py index 07fcb54c..8a0a472f 100644 --- a/minecriftversion.py +++ b/minecriftversion.py @@ -4,7 +4,7 @@ of_json_name = "1.7.10_HD_U_D1" of_file_md5 = "57c724fe8335c82aef8d54c101043e60" minecrift_version_num = "1.7.10" -minecrift_build = "jrbudda-35pre" +minecrift_build = "jrbudda-35" of_file_extension = ".jar" mcp_version = "mcp908" mcp_uses_generics = False diff --git a/patches/net/minecraft/client/Minecraft.java.patch b/patches/net/minecraft/client/Minecraft.java.patch index 9f1d265b..ce373d02 100644 --- a/patches/net/minecraft/client/Minecraft.java.patch +++ b/patches/net/minecraft/client/Minecraft.java.patch @@ -1244,7 +1244,7 @@ + * The minecriftVerString will be automatically updated by the build scripts, do not modify here. + * Modify minecriftversion.py in root minecrift dir. + */ -+ public final String minecriftVerString = "Vivecraft 1.7.10 jrbudda-35pre"; ++ public final String minecriftVerString = "Vivecraft 1.7.10 jrbudda-35"; + private boolean trigger; + /* end version */ + /** END MINECRIFT */ diff --git a/patches/net/minecraft/client/renderer/entity/RenderFish.java.patch b/patches/net/minecraft/client/renderer/entity/RenderFish.java.patch index 49e96c50..a5f306ae 100644 --- a/patches/net/minecraft/client/renderer/entity/RenderFish.java.patch +++ b/patches/net/minecraft/client/renderer/entity/RenderFish.java.patch @@ -16,7 +16,7 @@ + // VIVE START - use controller for fishing rod start point + if (p_76986_1_.angler == Minecraft.getMinecraft().thePlayer) + { -+ Vec3 aimSource = Minecraft.getMinecraft().roomScale.getControllerPos_World(0); ++ Vec3 aimSource = Minecraft.getMinecraft().entityRenderer.getControllerRenderPos(0); + Vec3 aimRotation = Minecraft.getMinecraft().roomScale.getControllerMainDir_World(); + var23= aimSource.xCoord + aimRotation.xCoord * 0.28f; + var25= aimSource.yCoord - aimRotation.yCoord * 0.28f; diff --git a/patches/net/minecraft/client/renderer/entity/RenderLiving.java.patch b/patches/net/minecraft/client/renderer/entity/RenderLiving.java.patch new file mode 100644 index 00000000..fc1df993 --- /dev/null +++ b/patches/net/minecraft/client/renderer/entity/RenderLiving.java.patch @@ -0,0 +1,35 @@ +--- a/net/minecraft/client/renderer/entity/RenderLiving.java ++++ b/net/minecraft/client/renderer/entity/RenderLiving.java +@@ -1,11 +1,14 @@ + package net.minecraft.client.renderer.entity; + ++import net.minecraft.client.Minecraft; + import net.minecraft.client.model.ModelBase; + import net.minecraft.client.renderer.Tessellator; + import net.minecraft.entity.Entity; + import net.minecraft.entity.EntityHanging; + import net.minecraft.entity.EntityLiving; + import net.minecraft.entity.EntityLivingBase; ++import net.minecraft.util.Vec3; ++ + import org.lwjgl.opengl.GL11; + + public abstract class RenderLiving extends RendererLivingEntity +@@ -68,6 +71,17 @@ + double var26 = this.func_110828_a(var10.prevPosY + (double)var10.getEyeHeight() * 0.7D, var10.posY + (double)var10.getEyeHeight() * 0.7D, (double)p_110827_9_) - var20 * 0.5D - 0.25D; + double var28 = this.func_110828_a(var10.prevPosZ, var10.posZ, (double)p_110827_9_) - var18 * 0.7D + var16 * 0.5D * var22; + double var30 = this.func_110828_a((double)p_110827_1_.prevRenderYawOffset, (double)p_110827_1_.renderYawOffset, (double)p_110827_9_) * 0.01745329238474369D + (Math.PI / 2D); ++ ++ // VIVE START ++ if (var10 == Minecraft.getMinecraft().thePlayer) ++ { ++ Vec3 aimSource = Minecraft.getMinecraft().entityRenderer.getControllerRenderPos(0); ++ var24 = aimSource.xCoord; ++ var26 = aimSource.yCoord; ++ var28 = aimSource.zCoord; ++ } ++ // VIVE END ++ + var16 = Math.cos(var30) * (double)p_110827_1_.width * 0.4D; + var18 = Math.sin(var30) * (double)p_110827_1_.width * 0.4D; + double var32 = this.func_110828_a(p_110827_1_.prevPosX, p_110827_1_.posX, (double)p_110827_9_) + var16; diff --git a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java index 85db33e9..c8f2209a 100644 --- a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java +++ b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java @@ -1717,7 +1717,7 @@ private static void processControllerButtons(boolean sleeping, boolean gui) } if(pressedRAppMenu && !lastpressedRAppMenu) { - if(mc.gameSettings.keyBindSneak.getIsKeyPressed() && mc.vrSettings.displayMirrorMode == mc.vrSettings.MIRROR_MIXED_REALITY){ + if(mc.gameSettings.keyBindPickBlock.getIsKeyPressed() && mc.vrSettings.displayMirrorMode == mc.vrSettings.MIRROR_MIXED_REALITY){ VRHotkeys.snapMRCam(mc); } } @@ -2018,7 +2018,7 @@ private static void processControllerButtonsOculus(boolean sleeping, boolean gui } if(pressedA && !lastpressedA) { //handle menu directly - if(mc.gameSettings.keyBindSneak.getIsKeyPressed() && mc.vrSettings.displayMirrorMode == mc.vrSettings.MIRROR_MIXED_REALITY){ + if(mc.gameSettings.keyBindPickBlock.getIsKeyPressed() && mc.vrSettings.displayMirrorMode == mc.vrSettings.MIRROR_MIXED_REALITY){ VRHotkeys.snapMRCam(mc); } } @@ -2167,7 +2167,6 @@ private static void pollInputEvents() while (vrsystem.PollNextEvent.apply(event, event.size() ) > 0) { - switch (event.eventType) { case EVREventType.EVREventType_VREvent_KeyboardClosed: //'huzzah' @@ -2863,7 +2862,8 @@ private static void updateAim() { controllerRotation[0].M[2][2] = temp.m22; } - // Calculate aim angles from controller orientation + // Calculate aim angles from controller orientationevent + // Minecraft entities don't have a roll, so just base it on a direction controllerDirection = controllerRotation[0].transform(forward); aimPitch = (float)Math.toDegrees(Math.asin(controllerDirection.y/controllerDirection.length())); diff --git a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java index dfe8baa4..9eab8ae8 100644 --- a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java +++ b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java @@ -1087,68 +1087,72 @@ else if(item !=null && Reflector.forgeExists()){ } - if(!inAnEntity){ - Block block = mc.theWorld.getBlock(bx, by, bz); - Material material = block.getMaterial(); + if(!inAnEntity){ + Block block = mc.theWorld.getBlock(bx, by, bz); + Material material = block.getMaterial(); - // every time end of weapon enters a solid for the first time, trace from our previous air position - // and damage the block it collides with... + // every time end of weapon enters a solid for the first time, trace from our previous air position + // and damage the block it collides with... - MovingObjectPosition col = mc.theWorld.rayTraceBlocks(lastWeaponEndAir, weaponEnd, true, false, true); - if (shouldIlookatMyHand || (col != null && col.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)) - { - this.shouldIlookatMyHand = false; - if (!(block.getMaterial() == material.air)) + MovingObjectPosition col = mc.theWorld.rayTraceBlocks(lastWeaponEndAir, weaponEnd, true, false, true); + if (shouldIlookatMyHand || (col != null && col.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)) { - if (block.getMaterial().isLiquid()) { - if(item == Items.bucket) { - //mc.playerController.onPlayerRightClick(player, player.worldObj,is, col.blockX, col.blockY, col.blockZ, col.sideHit,col.hitVec); - this.shouldIlookatMyHand = true; - if (IAmLookingAtMyHand){ - if(mc.playerController.sendUseItem(player, player.worldObj, is)){ - mc.entityRenderer.itemRenderer.resetEquippedProgress2(); + this.shouldIlookatMyHand = false; + if (!(block.getMaterial() == material.air)) + { + if (block.getMaterial().isLiquid()) { + if(item == Items.bucket) { + //mc.playerController.onPlayerRightClick(player, player.worldObj,is, col.blockX, col.blockY, col.blockZ, col.sideHit,col.hitVec); + this.shouldIlookatMyHand = true; + if (IAmLookingAtMyHand){ + if(mc.playerController.sendUseItem(player, player.worldObj, is)){ + mc.entityRenderer.itemRenderer.resetEquippedProgress2(); + } } } - } - } else { - if(canact && (!mc.vrSettings.realisticClimbEnabled || block != Blocks.ladder)) { - int p = 3; - p += (speed - speedthresh) / 2; - - for (int i = 0; i < p; i++) - { - //set delay to 0 - clearBlockHitDelay(); + } else { + if(canact && (!mc.vrSettings.realisticClimbEnabled || block != Blocks.ladder)) { + int p = 3; + if(item instanceof ItemHoe){ + Minecraft.getMinecraft().playerController.onPlayerRightClick(player, player.worldObj, is, bx, by, bz, col.sideHit, col.hitVec); + + }else{ + p += (speed - speedthresh) / 2; - //all this comes from plaeyrControllerMP clickMouse and friends. + for (int i = 0; i < p; i++) + { + //set delay to 0 + clearBlockHitDelay(); - //all this does is sets the blocking you're currently hitting, has no effect in survival mode after that. - //but if in creaive mode will clickCreative on the block - mc.playerController.clickBlock(col.blockX, col.blockY, col.blockZ, col.sideHit); + //all this comes from plaeyrControllerMP clickMouse and friends. - if(!getIsHittingBlock()) //seems to be the only way to tell it broke. - break; + //all this does is sets the blocking you're currently hitting, has no effect in survival mode after that. + //but if in creaive mode will clickCreative on the block + mc.playerController.clickBlock(col.blockX, col.blockY, col.blockZ, col.sideHit); - //apply destruction for survival only - mc.playerController.onPlayerDamageBlock(col.blockX, col.blockY, col.blockZ, col.sideHit); + if(!getIsHittingBlock()) //seems to be the only way to tell it broke. + break; - if(!getIsHittingBlock()) //seems to be the only way to tell it broke. - break; + //apply destruction for survival only + mc.playerController.onPlayerDamageBlock(col.blockX, col.blockY, col.blockZ, col.sideHit); - //something effects - mc.effectRenderer.addBlockHitEffects(col.blockX, col.blockY, col.blockZ, col.sideHit); + if(!getIsHittingBlock()) //seems to be the only way to tell it broke. + break; - } + //something effects + mc.effectRenderer.addBlockHitEffects(col.blockX, col.blockY, col.blockZ, col.sideHit); - this.triggerHapticPulse(0, 1000); - // System.out.println("Hit block speed =" + speed + " mot " + mot + " thresh " + speedthresh) ; - lastWeaponSolid = true; + } + } + this.triggerHapticPulse(0, 1000); + // System.out.println("Hit block speed =" + speed + " mot " + mot + " thresh " + speedthresh) ; + lastWeaponSolid = true; + } + insolidBlock = true; } - insolidBlock = true; } } - } - } + } if ((!inAnEntity && !insolidBlock ) || lastWeaponEndAir.lengthVector() ==0) {