Skip to content

Commit

Permalink
35
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbudda committed Jan 12, 2017
1 parent 1a716eb commit e85849b
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 71 deletions.
32 changes: 14 additions & 18 deletions installer/Installer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand All @@ -589,10 +589,6 @@ private boolean SetupMinecraftAsLibrary() {

if(mc_jar == null) return false;





InputStream src = new FileInputStream(mc_jar);
return copyInputStreamToFile(src, tar);

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion minecriftversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion patches/net/minecraft/client/Minecraft.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
8 changes: 4 additions & 4 deletions src/com/mtbs3d/minecrift/provider/MCOpenVR.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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()));
Expand Down
96 changes: 50 additions & 46 deletions src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit e85849b

Please sign in to comment.