From fb9f1a45d31472896576161da1da272ec40614f1 Mon Sep 17 00:00:00 2001 From: jrbudda Date: Sat, 27 May 2017 04:18:05 -0400 Subject: [PATCH] 10pre5 --- minecriftversion.py | 2 +- .../net/minecraft/client/Minecraft.java.patch | 81 ++++--- .../client/entity/EntityPlayerSP.java.patch | 55 +++-- .../minecraft/client/gui/GuiChat.java.patch | 11 + .../client/gui/GuiTextField.java.patch | 43 ++-- .../network/NetHandlerPlayClient.java.patch | 17 +- .../client/renderer/EntityRenderer.java.patch | 88 ++++---- .../client/renderer/ItemRenderer.java.patch | 56 +++-- .../client/renderer/RenderGlobal.java.patch | 153 +++++++++++--- .../entity/layers/LayerHeldItem.java.patch | 200 ++++++++++-------- .../net/minecraft/world/ChunkCache.java.patch | 88 ++++++++ .../minecrift/gameplay/BackpackTracker.java | 2 +- .../mtbs3d/minecrift/gameplay/BowTracker.java | 11 +- .../minecrift/gameplay/ClimbTracker.java | 5 +- .../mtbs3d/minecrift/main/VivecraftMain.java | 11 +- .../mtbs3d/minecrift/provider/MCOpenVR.java | 87 ++++++-- .../minecrift/provider/OpenVRPlayer.java | 77 +++++-- 17 files changed, 688 insertions(+), 299 deletions(-) create mode 100644 patches/net/minecraft/world/ChunkCache.java.patch diff --git a/minecriftversion.py b/minecriftversion.py index 5210f86..7497d6f 100644 --- a/minecriftversion.py +++ b/minecriftversion.py @@ -4,7 +4,7 @@ of_json_name = "1.10.2_HD_U_D8" of_file_md5 = "d2a99a8d96d1067cb9e384bbdc560c70" minecrift_version_num = "1.10.2" -minecrift_build = "jrbudda-10pre2" +minecrift_build = "jrbudda-10pre5" of_file_extension = ".jar" mcp_version = "mcp931" mcp_uses_generics = True diff --git a/patches/net/minecraft/client/Minecraft.java.patch b/patches/net/minecraft/client/Minecraft.java.patch index 6d363f0..2beec1e 100644 --- a/patches/net/minecraft/client/Minecraft.java.patch +++ b/patches/net/minecraft/client/Minecraft.java.patch @@ -306,7 +306,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.10.2 jrbudda-10pre2"; ++ public final String minecriftVerString = "Vivecraft 1.10.2 jrbudda-10pre5"; + /* end version */ + /** END MINECRIFT */ + @@ -1151,7 +1151,7 @@ - this.debugUpdateTime += 1000L; - this.fpsCounter = 0; - this.usageSnooper.addMemoryStatsToSnooper(); -- + - if (!this.usageSnooper.isSnooperRunning()) - { - this.usageSnooper.startSnooper(); @@ -1164,7 +1164,7 @@ - Display.sync(this.getLimitFramerate()); - this.mcProfiler.endSection(); - } - +- - this.mcProfiler.endSection(); + this.debugUpdateTime += 1000L; + this.fpsCounter = 0; @@ -1672,7 +1672,7 @@ while (this.gameSettings.keyBindInventory.isPressed()) { this.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.OPEN_INVENTORY_ACHIEVEMENT)); -@@ -2242,11 +2882,26 @@ +@@ -2242,22 +2882,42 @@ if (flag) { @@ -1704,8 +1704,13 @@ if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed()) { this.displayGuiScreen(new GuiChat("/")); -@@ -2255,9 +2910,10 @@ + } + } ++ boolean nope = false; ++ if(climbTracker.isClimbeyClimb() && (this.objectMouseOver==null || this.objectMouseOver.entityHit==null)) nope = true; ++ ++ if (this.player.isHandActive()) { - if (!this.gameSettings.keyBindUseItem.isKeyDown()) @@ -1717,7 +1722,7 @@ } label472: -@@ -2283,17 +2939,30 @@ +@@ -2283,17 +2943,27 @@ } } } @@ -1728,12 +1733,10 @@ - { - this.clickMouse(); - } -+ boolean nope = false; -+ if(climbTracker.isClimbeyClimb() && (this.objectMouseOver==null || this.objectMouseOver.entityHit==null)) nope = true; - +- - while (this.gameSettings.keyBindUseItem.isPressed()) -+ //VIVE SUPPORT HAND SWINGING -+ if (!nope && this.gameSettings.keyBindAttack.isKeyDown() && currentScreen == null) ++ //VIVE SUPPORT HAND SWINGING ++ if (!nope && this.gameSettings.keyBindAttack.isPressed() && currentScreen == null) + { + this.clickMouse(); + lastClick = true; @@ -1755,7 +1758,7 @@ while (this.gameSettings.keyBindPickBlock.isPressed()) { -@@ -2301,18 +2970,23 @@ +@@ -2301,18 +2971,23 @@ } } @@ -1767,7 +1770,7 @@ } - this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.isKeyDown() && this.inGameHasFocus); -+ //this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.isKeyDown() && this.inGameHasFocus); ++ if(!nope) this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.isKeyDown() && this.inGameHasFocus); } private void runTickMouse() throws IOException @@ -1782,7 +1785,7 @@ int i = Mouse.getEventButton(); KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); -@@ -2327,6 +3001,13 @@ +@@ -2327,6 +3002,13 @@ KeyBinding.onTick(i - 100); } } @@ -1796,7 +1799,7 @@ long j = getSystemTime() - this.systemTime; -@@ -2381,6 +3062,15 @@ +@@ -2381,6 +3063,15 @@ */ public void launchIntegratedServer(String folderName, String worldName, @Nullable WorldSettings worldSettingsIn) { @@ -1812,7 +1815,7 @@ this.loadWorld((WorldClient)null); System.gc(); ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2423,6 +3113,16 @@ +@@ -2423,6 +3114,16 @@ while (!this.theIntegratedServer.serverIsInRunLoop()) { @@ -1829,7 +1832,7 @@ String s = this.theIntegratedServer.getUserMessage(); if (s != null) -@@ -2443,12 +3143,19 @@ +@@ -2443,12 +3144,19 @@ ; } } @@ -1851,7 +1854,7 @@ networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile())); this.myNetworkManager = networkmanager; } -@@ -2458,6 +3165,9 @@ +@@ -2458,6 +3166,9 @@ */ public void loadWorld(WorldClient worldClientIn) { @@ -1861,7 +1864,7 @@ this.loadWorld(worldClientIn, ""); } -@@ -2466,6 +3176,11 @@ +@@ -2466,6 +3177,11 @@ */ public void loadWorld(@Nullable WorldClient worldClientIn, String loadingMessage) { @@ -1873,7 +1876,7 @@ if (worldClientIn == null) { NetHandlerPlayClient nethandlerplayclient = this.getConnection(); -@@ -2477,9 +3192,25 @@ +@@ -2477,9 +3193,25 @@ if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) { @@ -1901,7 +1904,7 @@ this.theIntegratedServer = null; this.guiAchievement.clearAchievements(); this.entityRenderer.getMapItemRenderer().clearLoadedMaps(); -@@ -2501,6 +3232,11 @@ +@@ -2501,6 +3233,11 @@ this.ingameGUI.resetPlayersOverlayFooterHeader(); this.setServerData((ServerData)null); this.integratedServerIsRunning = false; @@ -1913,7 +1916,31 @@ } this.mcSoundHandler.stopSounds(); -@@ -2607,6 +3343,7 @@ +@@ -2533,12 +3270,14 @@ + + if (this.player == null) + { ++ System.out.println("player is null"); //debug spawning in the damn ground. + this.player = this.playerController.createClientPlayer(worldClientIn, new StatisticsManager()); + this.playerController.flipPlayer(this.player); + } +- ++ System.out.println("PreLoadSpawned Player At " + this.player.posX + " " + this.player.posY + " " + this.player.posZ); //debug spawning in the damn ground. + this.player.preparePlayerToSpawn(); + worldClientIn.spawnEntity(this.player); ++ System.out.println("LoadSpawned Player At " + this.player.posX + " " + this.player.posY + " " + this.player.posZ); //debug spawning in the damn ground. + this.player.movementInput = new MovementInputFromOptions(this.gameSettings); + this.playerController.setPlayerCapabilities(this.player); + this.renderViewEntity = this.player; +@@ -2576,6 +3315,7 @@ + this.player.preparePlayerToSpawn(); + this.player.setServerBrand(s); + this.world.spawnEntity(this.player); ++ System.out.println("Spawned Player At " + this.player.posX + " " + this.player.posY + " " + this.player.posZ); //debug spawning in the damn ground. + this.playerController.flipPlayer(this.player); + this.player.movementInput = new MovementInputFromOptions(this.gameSettings); + this.player.setEntityId(i); +@@ -2607,6 +3347,7 @@ return theMinecraft == null || !theMinecraft.gameSettings.hideGUI; } @@ -1921,7 +1948,7 @@ public static boolean isFancyGraphicsEnabled() { return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics; -@@ -2623,8 +3360,16 @@ +@@ -2623,8 +3364,16 @@ /** * Called when user clicked he's mouse middle button (pick block) */ @@ -1939,7 +1966,7 @@ if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS) { boolean flag = this.player.capabilities.isCreativeMode; -@@ -2788,7 +3533,8 @@ +@@ -2788,7 +3537,8 @@ } } @@ -1949,7 +1976,7 @@ { NBTTagCompound nbttagcompound = te.writeToNBT(new NBTTagCompound()); -@@ -3098,6 +3844,11 @@ +@@ -3098,6 +3848,11 @@ */ public static int getGLMaximumTextureSize() { @@ -1961,7 +1988,7 @@ for (int i = 16384; i > 0; i >>= 1) { GlStateManager.glTexImage2D(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null); -@@ -3264,7 +4015,7 @@ +@@ -3264,7 +4019,7 @@ } public void dispatchKeypresses() @@ -1970,7 +1997,7 @@ int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); if (i != 0 && !Keyboard.isRepeatEvent()) -@@ -3417,4 +4168,1209 @@ +@@ -3417,4 +4172,1209 @@ { return this.player != null && this.player.hasReducedDebug() || this.gameSettings.reducedDebugInfo; } diff --git a/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch index 98c60d1..0a071f0 100644 --- a/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -87,7 +87,7 @@ /** Ticks left before sprinting is disabled. */ public int sprintingTicksLeft; public float renderArmYaw; -@@ -162,13 +196,32 @@ +@@ -162,13 +196,42 @@ this.statWriter = statFile; this.mc = mcIn; this.dimension = 0; @@ -113,6 +113,16 @@ */ public boolean attackEntityFrom(DamageSource source, float amount) { ++ //VIVECRAFT ++ if(amount > 0){ ++ int dur = 1000; ++ if(source.isExplosion())dur = 2000; ++ if(source == DamageSource.cactus) dur = 200; ++ //Vivecraft trigger haptics ++ MCOpenVR.triggerHapticPulse(0, dur); ++ MCOpenVR.triggerHapticPulse(1, dur); ++ } ++ //END VIVECRAFT + //Forge + if(Reflector.forgeExists()) + Reflector.call(Reflector.ForgeHooks_onLivingAttack, new Object[]{this, source, amount}); @@ -120,7 +130,7 @@ return false; } -@@ -203,11 +256,30 @@ +@@ -203,11 +266,30 @@ } } @@ -152,7 +162,7 @@ /** * Called to update the entity's position/logic. -@@ -273,6 +345,7 @@ +@@ -273,6 +355,7 @@ this.serverSneakState = flag1; } @@ -160,7 +170,7 @@ if (this.isCurrentViewEntity()) { AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); -@@ -285,26 +358,39 @@ +@@ -285,26 +368,39 @@ boolean flag2 = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || this.positionUpdateTicks >= 20; boolean flag3 = d3 != 0.0D || d4 != 0.0D; @@ -220,7 +230,7 @@ } if (flag2) -@@ -323,6 +409,10 @@ +@@ -323,6 +419,10 @@ this.prevOnGround = this.onGround; this.autoJumpEnabled = this.mc.gameSettings.autoJump; @@ -231,7 +241,7 @@ } } -@@ -340,7 +430,7 @@ +@@ -340,7 +440,7 @@ } @Nullable @@ -240,7 +250,7 @@ { return null; } -@@ -506,72 +596,129 @@ +@@ -506,72 +606,129 @@ this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); } @@ -434,21 +444,20 @@ } /** -@@ -579,8 +726,11 @@ +@@ -579,7 +736,11 @@ */ private boolean isOpenBlockSpace(BlockPos pos) { - return !this.world.getBlockState(pos).isNormalCube() && !this.world.getBlockState(pos.up()).isNormalCube(); -- } + if(Reflector.forgeExists()){ + return !world.getBlockState(pos).isNormalCube(); + } else { + return !this.world.getBlockState(pos).isNormalCube() && !this.world.getBlockState(pos.up()).isNormalCube(); -+ } } ++ } + } /** - * Set sprinting switch for Entity. -@@ -640,7 +790,19 @@ +@@ -640,7 +801,19 @@ public void playSound(SoundEvent soundIn, float volume, float pitch) { @@ -469,7 +478,7 @@ } /** -@@ -977,7 +1139,7 @@ +@@ -977,7 +1150,7 @@ this.sendPlayerAbilities(); } } @@ -478,7 +487,7 @@ { if (this.flyToggleTimer == 0) { -@@ -1065,6 +1227,10 @@ +@@ -1065,6 +1238,10 @@ super.onLivingUpdate(); @@ -489,7 +498,7 @@ if (this.onGround && this.capabilities.isFlying && !this.mc.playerController.isSpectatorMode()) { this.capabilities.isFlying = false; -@@ -1083,8 +1249,11 @@ +@@ -1083,8 +1260,11 @@ if (this.getRidingEntity() instanceof EntityBoat) { EntityBoat entityboat = (EntityBoat)this.getRidingEntity(); @@ -503,7 +512,7 @@ } } -@@ -1115,10 +1284,40 @@ +@@ -1115,10 +1295,40 @@ */ public void move(double x, double y, double z) { @@ -548,7 +557,7 @@ } public boolean isAutoJumpEnabled() -@@ -1144,12 +1343,16 @@ +@@ -1144,12 +1354,16 @@ float f = this.getAIMoveSpeed(); float f1 = (float)vec3d2.lengthSquared(); @@ -567,7 +576,7 @@ vec3d2 = new Vec3d((double)(f2 * f5 - f3 * f4), vec3d2.yCoord, (double)(f3 * f5 + f2 * f4)); f1 = (float)vec3d2.lengthSquared(); -@@ -1269,4 +1472,334 @@ +@@ -1269,4 +1483,336 @@ } } } @@ -592,7 +601,7 @@ + if(!initFromServer) return; + else { //still init. + mc.vrPlayer.snapRoomOriginToPlayerEntity(this, true, false, 1); -+ ++ +// OpenVRPlayer.get().setRoomOrigin( +// posX + ox, +// this.boundingBox.minY, @@ -606,8 +615,10 @@ + super.setPositionAndRotation(x, y, z, yaw, pitch); + + OpenVRPlayer.get().snapRoomOriginToPlayerEntity(this, true, false, 1); -+ ++ + if(initFromServer == false){ ++ this.setLocationAndAngles(x, y, z, yaw, pitch); ++ mc.entityRenderer.interpolatedPlayerPos = new Vec3d(x,y,z); + initFromServer = true; + } + } @@ -617,7 +628,6 @@ + public void setPosition(double x, double y, double z) + { //this is also called when riding to move this around. + super.setPosition(x, y, z); -+ + if(this.isRiding()){ + Vec3d roomOrigin = OpenVRPlayer.get().getRoomOriginPos_World(); + Vec3d me = OpenVRPlayer.get().getHMDPos_World(); @@ -887,7 +897,8 @@ + super.onDeath(p_70645_1_); + MCOpenVR.triggerHapticPulse(0, 2000); + MCOpenVR.triggerHapticPulse(1, 2000); -+ ++ System.out.println("Player DIED At " + this.posX + " " + this.posY + " " + this.posZ); //debug spawning in the damn ground. ++ + } + + diff --git a/patches/net/minecraft/client/gui/GuiChat.java.patch b/patches/net/minecraft/client/gui/GuiChat.java.patch index 490a5f2..ca534f1 100644 --- a/patches/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/net/minecraft/client/gui/GuiChat.java.patch @@ -25,6 +25,17 @@ public class GuiChat extends GuiScreen implements ITabCompleter { private static final Logger LOGGER = LogManager.getLogger(); +@@ -55,9 +60,9 @@ + this.inputField = new GuiTextField(0, this.fontRendererObj, 4, this.height - 12, this.width - 4, 12); + this.inputField.setMaxStringLength(100); + this.inputField.setEnableBackgroundDrawing(false); ++ //this.inputField.setCanLoseFocus(false); + this.inputField.setFocused(true); + this.inputField.setText(this.defaultInputFieldText); +- this.inputField.setCanLoseFocus(false); + this.tabCompleter = new GuiChat.ChatTabCompleter(this.inputField); + } + @@ -131,7 +136,12 @@ this.sendChatMessage(s); } diff --git a/patches/net/minecraft/client/gui/GuiTextField.java.patch b/patches/net/minecraft/client/gui/GuiTextField.java.patch index bfb3f9f..665d4c2 100644 --- a/patches/net/minecraft/client/gui/GuiTextField.java.patch +++ b/patches/net/minecraft/client/gui/GuiTextField.java.patch @@ -1,15 +1,16 @@ --- a/net/minecraft/client/gui/GuiTextField.java +++ b/net/minecraft/client/gui/GuiTextField.java -@@ -2,6 +2,8 @@ +@@ -2,6 +2,9 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; +import com.mtbs3d.minecrift.provider.MCOpenVR; + ++import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; -@@ -16,9 +18,10 @@ +@@ -16,9 +19,10 @@ public int xPosition; public int yPosition; @@ -22,38 +23,44 @@ /** Has the current text being edited on the textbox. */ private String text = ""; -@@ -511,7 +514,17 @@ +@@ -511,8 +515,13 @@ if (this.canLoseFocus) { this.setFocused(flag); - } + } else { -+ -+ for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { -+ if(ste.getClassName().contains("GuiChattableCamera")) return; -+ } + -+ // VIVE START - show keyboard -+ MCOpenVR.setKeyboardOverlayShowing(true, this); -+ // VIVE END - show keyboard -+ -+ } ++ } ++ ++ if(flag && this.canLoseFocus == true) MCOpenVR.setKeyboardOverlayShowing(true, this); ++ if (this.isFocused && flag && mouseButton == 0) { -@@ -717,6 +730,15 @@ + int i = mouseX - this.xPosition; +@@ -559,6 +568,9 @@ + { + String s1 = flag ? s.substring(0, j) : s; + j1 = this.fontRendererInstance.drawStringWithShadow(s1, (float)l, (float)i1, i); ++ } else { ++ if(!Minecraft.getMinecraft().vrSettings.seated && !MCOpenVR.keyboardShowing && this.canLoseFocus) ++ this.fontRendererInstance.drawStringWithShadow("Click to open keyboard", (float)l, (float)i1, this.disabledColor); + } + + boolean flag2 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); +@@ -717,6 +729,15 @@ } this.isFocused = isFocusedIn; + -+ // VIVE START - show keyboard ++ // VIVE START - show keyboard + for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { -+ if(ste.getClassName().contains("GuiChattableCamera")) return; ++ // if(ste.getClassName().contains("GuiChattableCamera")) return; ++ // if(ste.toString().contains("journeymap.client.ui.fullscreen.Fullscreen")) return; + } -+ if(isFocusedIn) MCOpenVR.setKeyboardOverlayShowing(isFocusedIn, this); -+ // VIVE END - show keyboard -+ + ++ if(isFocusedIn && this.visible && this.canLoseFocus == false) MCOpenVR.setKeyboardOverlayShowing(isFocusedIn, this); ++ //VIVE END - show keyboard } /** diff --git a/patches/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/net/minecraft/client/network/NetHandlerPlayClient.java.patch index f2ff6a2..5637466 100644 --- a/patches/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -174,19 +174,20 @@ } } } -@@ -1116,7 +1187,10 @@ +@@ -1116,7 +1187,11 @@ { this.doneLoadingTerrain = false; Scoreboard scoreboard = this.clientWorldController.getScoreboard(); - this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.world.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler); + int dimId = packetIn.getDimensionID(); -+ if (Reflector.forgeExists()) -+ Reflector.call(Reflector.call(Reflector.NetworkDispatcher_get, getNetworkManager()), Reflector.NetworkDispatcher_getOverrideDimension, packetIn); ++ if (Reflector.forgeExists()){ ++ dimId = Reflector.callInt(Reflector.call(Reflector.NetworkDispatcher_get, getNetworkManager()), Reflector.NetworkDispatcher_getOverrideDimension, packetIn); ++ } + this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.world.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), dimId, packetIn.getDifficulty(), this.gameController.mcProfiler); this.clientWorldController.setWorldScoreboard(scoreboard); this.gameController.loadWorld(this.clientWorldController); this.gameController.player.dimension = packetIn.getDimensionID(); -@@ -1305,7 +1379,19 @@ +@@ -1305,7 +1380,19 @@ { tileentity.readFromNBT(packetIn.getNbtCompound()); } @@ -207,7 +208,7 @@ if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); -@@ -1416,15 +1502,41 @@ +@@ -1416,15 +1503,41 @@ } else if (f == 101.0F) { @@ -252,7 +253,7 @@ } } else if (i == 6) -@@ -1525,7 +1637,7 @@ +@@ -1525,7 +1638,7 @@ if (entity instanceof EntityLivingBase) { @@ -261,7 +262,7 @@ if (potion != null) { -@@ -1928,6 +2040,115 @@ +@@ -1928,6 +2041,115 @@ String s1 = packetbuffer2.readString(256); this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s)); } @@ -377,7 +378,7 @@ } /** -@@ -2198,4 +2419,12 @@ +@@ -2198,4 +2420,12 @@ { return this.profile; } diff --git a/patches/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/net/minecraft/client/renderer/EntityRenderer.java.patch index 90f4f23..bc823b7 100644 --- a/patches/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -94,7 +94,7 @@ import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MouseFilter; import net.minecraft.util.ReportedException; -@@ -80,24 +102,62 @@ +@@ -80,24 +102,63 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; @@ -138,6 +138,7 @@ +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.gson.JsonSyntaxException; ++import com.mtbs3d.minecrift.gameplay.BowTracker; +import com.mtbs3d.minecrift.provider.MCOpenVR; +import com.mtbs3d.minecrift.provider.OpenVRPlayer; +import com.mtbs3d.minecrift.render.MenuWorldRenderer; @@ -158,7 +159,7 @@ public class EntityRenderer implements IResourceManagerReloadListener { private static final Logger LOGGER = LogManager.getLogger(); -@@ -108,6 +168,45 @@ +@@ -108,6 +169,45 @@ /** Anaglyph field (0=R, 1=GB) */ public static int anaglyphField; @@ -204,7 +205,7 @@ /** A reference to the Minecraft object. */ private final Minecraft mc; private final IResourceManager resourceManager; -@@ -204,7 +303,11 @@ +@@ -204,7 +304,11 @@ private double cameraZoom = 1.0D; private double cameraYaw; private double cameraPitch; @@ -217,7 +218,7 @@ private static final ResourceLocation[] SHADERS_TEXTURES = new ResourceLocation[] {new ResourceLocation("shaders/post/notch.json"), new ResourceLocation("shaders/post/fxaa.json"), new ResourceLocation("shaders/post/art.json"), new ResourceLocation("shaders/post/bumpy.json"), new ResourceLocation("shaders/post/blobs2.json"), new ResourceLocation("shaders/post/pencil.json"), new ResourceLocation("shaders/post/color_convolve.json"), new ResourceLocation("shaders/post/deconverge.json"), new ResourceLocation("shaders/post/flip.json"), new ResourceLocation("shaders/post/invert.json"), new ResourceLocation("shaders/post/ntsc.json"), new ResourceLocation("shaders/post/outline.json"), new ResourceLocation("shaders/post/phosphor.json"), new ResourceLocation("shaders/post/scan_pincushion.json"), new ResourceLocation("shaders/post/sobel.json"), new ResourceLocation("shaders/post/bits.json"), new ResourceLocation("shaders/post/desaturate.json"), new ResourceLocation("shaders/post/green.json"), new ResourceLocation("shaders/post/blur.json"), new ResourceLocation("shaders/post/wobble.json"), new ResourceLocation("shaders/post/blobs.json"), new ResourceLocation("shaders/post/antialias.json"), new ResourceLocation("shaders/post/creeper.json"), new ResourceLocation("shaders/post/spider.json")}; public static final int SHADER_COUNT = SHADERS_TEXTURES.length; private int shaderIndex; -@@ -212,9 +315,7 @@ +@@ -212,9 +316,7 @@ public int frameCount; private boolean initialized = false; private World updatedWorld = null; @@ -227,7 +228,7 @@ private long lastServerTime = 0L; private int lastServerTicks = 0; private int serverWaitTime = 0; -@@ -223,8 +324,14 @@ +@@ -223,8 +325,14 @@ private float avgServerTickDiff = 0.0F; private long lastErrorCheckTimeMs = 0L; private ShaderGroup[] fxaaShaders = new ShaderGroup[10]; @@ -243,7 +244,7 @@ public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) { this.shaderIndex = SHADER_COUNT; -@@ -236,6 +343,7 @@ +@@ -236,6 +344,7 @@ this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture); this.lightmapColors = this.lightmapTexture.getTextureData(); this.theShaderGroup = null; @@ -251,7 +252,7 @@ for (int i = 0; i < 32; ++i) { -@@ -274,7 +382,7 @@ +@@ -274,7 +383,7 @@ /** * What shader to use when spectating this entity */ @@ -260,7 +261,7 @@ { if (OpenGlHelper.shadersSupported) { -@@ -304,7 +412,7 @@ +@@ -304,7 +413,7 @@ } } @@ -269,7 +270,7 @@ { if (OpenGlHelper.isFramebufferEnabled()) { -@@ -388,7 +496,7 @@ +@@ -388,7 +497,7 @@ Entity entity = this.mc.getRenderViewEntity(); double d2 = entity.posX; @@ -278,7 +279,7 @@ double d1 = entity.posZ; float f2 = this.mc.world.getLightBrightness(new BlockPos(d2, d0, d1)); float f3 = (float)this.mc.gameSettings.renderDistanceChunks / 16.0F; -@@ -413,6 +521,16 @@ +@@ -413,6 +522,16 @@ { this.bossColorModifier -= 0.0125F; } @@ -295,7 +296,7 @@ } public ShaderGroup getShaderGroup() -@@ -438,112 +556,112 @@ +@@ -438,112 +557,112 @@ */ public void getMouseOver(float partialTicks) { @@ -514,7 +515,7 @@ } /** -@@ -611,7 +729,6 @@ +@@ -611,7 +730,6 @@ { Config.zoomMode = true; this.mc.gameSettings.smoothCamera = true; @@ -522,7 +523,7 @@ } if (Config.zoomMode) -@@ -634,14 +751,14 @@ +@@ -634,14 +752,14 @@ f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; } @@ -540,7 +541,7 @@ } } -@@ -696,244 +813,239 @@ +@@ -696,244 +814,239 @@ */ private void orientCamera(float partialTicks) { @@ -1010,7 +1011,7 @@ /** * Render player hand -@@ -942,88 +1054,67 @@ +@@ -942,88 +1055,67 @@ { this.renderHand(partialTicks, pass, true, true, false); } @@ -1128,7 +1129,7 @@ + itemRenderer.renderItemInFirstPerson(mc.player, partialTicks, 0, EnumHand.MAIN_HAND, mc.player.getSwingProgress(partialTicks), mc.player.getHeldItemOffhand(), 0); + } + -+ if(item != null && item.getItem()instanceof ItemBow){ ++ if(BowTracker.isHoldingBow(mc.player)){ + int c = 0; + if (mc.vrSettings.vrReverseShootingEye) c = 1; + @@ -1159,7 +1160,7 @@ public void disableLightmap() { GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); -@@ -1039,12 +1130,12 @@ +@@ -1039,12 +1131,12 @@ public void enableLightmap() { GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); @@ -1174,7 +1175,7 @@ this.mc.getTextureManager().bindTexture(this.locationLightMap); GlStateManager.glTexParameteri(3553, 10241, 9729); GlStateManager.glTexParameteri(3553, 10240, 9729); -@@ -1220,708 +1311,806 @@ +@@ -1220,708 +1312,815 @@ } } @@ -2562,10 +2563,19 @@ + Shaders.endRender(); + + -+ this.mc.mcProfiler.endStartSection("renderGui"); -+ if(!mc.bowTracker.isDrawing) -+ renderGuiLayer(partialTicks); -+ ++ this.mc.mcProfiler.endStartSection("renderGui"); ++ if(!mc.bowTracker.isDrawing){ ++ renderGuiLayer(partialTicks); ++ if(mc.currentScreen !=null && !mc.vrSettings.hudOcclusion){ ++ this.enableLightmap(); ++ RenderHelper.enableStandardItemLighting(); ++ itemRenderer.setLightmap(); ++ GlStateManager.enableRescaleNormal(); ++ this.renderHand(partialTicks, 0); ++ this.renderLeftHand(partialTicks); ++ this.disableLightmap(); ++ } ++ } + + this.mc.mcProfiler.endSection(); + @@ -2624,7 +2634,7 @@ private void addRainParticles() { float f = this.mc.world.getRainStrength(1.0F); -@@ -2013,7 +2202,7 @@ +@@ -2013,7 +2212,7 @@ if (Reflector.ForgeWorldProvider_getWeatherRenderer.exists()) { WorldProvider worldprovider = this.mc.world.provider; @@ -2633,7 +2643,7 @@ if (object != null) { -@@ -2216,7 +2405,7 @@ +@@ -2216,7 +2415,7 @@ double d0 = MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) > 0.0F ? -1.0D : 1.0D; Vec3d vec3d2 = new Vec3d(d0, 0.0D, 0.0D); float f5 = (float)entity.getLook(partialTicks).dotProduct(vec3d2); @@ -2642,7 +2652,7 @@ if (f5 < 0.0F) { f5 = 0.0F; -@@ -2260,8 +2449,9 @@ +@@ -2260,8 +2459,9 @@ this.fogColorBlue *= f11; } @@ -2654,7 +2664,7 @@ if (this.cloudFog) { Vec3d vec3d3 = world.getCloudColour(partialTicks); -@@ -2269,7 +2459,7 @@ +@@ -2269,7 +2469,7 @@ this.fogColorGreen = (float)vec3d3.yCoord; this.fogColorBlue = (float)vec3d3.zCoord; } @@ -2663,7 +2673,7 @@ { float f12 = 0.0F; -@@ -2295,7 +2485,7 @@ +@@ -2295,7 +2495,7 @@ this.fogColorBlue = (float)vec3d4.zCoord; } } @@ -2672,7 +2682,7 @@ { this.fogColorRed = 0.6F; this.fogColorGreen = 0.1F; -@@ -2373,16 +2563,15 @@ +@@ -2373,16 +2573,15 @@ this.fogColorBlue = f7; } @@ -2697,7 +2707,7 @@ } /** -@@ -2396,7 +2585,13 @@ +@@ -2396,7 +2595,13 @@ GlStateManager.glFog(2918, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); GlStateManager.glNormal3f(0.0F, -1.0F, 0.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -2712,7 +2722,7 @@ float f = -1.0F; if (Reflector.ForgeHooksClient_getFogDensity.exists()) -@@ -2456,7 +2651,7 @@ +@@ -2456,7 +2661,7 @@ GlStateManager.setFogDensity(0.1F); } @@ -2721,7 +2731,7 @@ { if (Config.isShaders()) { -@@ -2488,7 +2683,7 @@ +@@ -2488,7 +2693,7 @@ GlStateManager.setFogDensity(0.02F); } } @@ -2730,7 +2740,7 @@ { if (Config.isShaders()) { -@@ -2550,12 +2745,24 @@ +@@ -2550,12 +2755,24 @@ Reflector.callVoid(Reflector.ForgeHooksClient_onFogRender, new Object[] {this, entity, iblockstate, Float.valueOf(partialTicks), Integer.valueOf(startCoords), Float.valueOf(f1)}); } } @@ -2756,7 +2766,7 @@ /** * Update and return fogColorBuffer with the RGBA values passed as arguments */ -@@ -2572,6 +2779,12 @@ +@@ -2572,6 +2789,12 @@ return this.fogColorBuffer; } @@ -2769,7 +2779,7 @@ public MapItemRenderer getMapItemRenderer() { return this.theMapItemRenderer; -@@ -2716,10 +2929,12 @@ +@@ -2716,10 +2939,12 @@ this.updatedWorld = world; } @@ -2786,7 +2796,7 @@ } private void frameFinish() -@@ -2743,39 +2958,6 @@ +@@ -2743,39 +2968,6 @@ } } @@ -2826,7 +2836,7 @@ public boolean setFxaaShader(int p_setFxaaShader_1_) { if (!OpenGlHelper.isFramebufferEnabled()) -@@ -2815,75 +2997,6 @@ +@@ -2815,75 +3007,6 @@ } } @@ -2902,7 +2912,7 @@ public static void drawNameplate(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal, boolean isSneaking) { GlStateManager.pushMatrix(); -@@ -2927,4 +3040,2304 @@ +@@ -2927,4 +3050,2304 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } @@ -3050,7 +3060,7 @@ + } else { + ItemStack i = ((EntityPlayerSP) entity).inventory.getCurrentItem(); + if(i !=null){ -+ if(i.getItem() instanceof ItemBow && mc.bowTracker.isNotched()){ ++ if(mc.bowTracker.isBow(i) && mc.bowTracker.isNotched()){ + //use bow aim + Vec3d aim = mc.bowTracker.getAimVector(); + if (aim != null && aim.lengthSquared() > 0) { @@ -3910,7 +3920,7 @@ + itemRenderer.renderItemInFirstPerson(mc.player, nano, 0, EnumHand.OFF_HAND, mc.player.getSwingProgress(nano), mc.player.getHeldItemMainhand(), 0); + } + -+ if(mc.bowTracker.isActive(mc.player)){ //render bow ++ if(BowTracker.isHoldingBow(mc.player)){ //render bow + int c = 1; + if (mc.vrSettings.vrReverseShootingEye) c = 0; + itemRenderer.renderItemInFirstPerson(mc.player, nano, 0, EnumHand.OFF_HAND, mc.player.getSwingProgress(nano), mc.player.getHeldItemMainhand(), 0); diff --git a/patches/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/net/minecraft/client/renderer/ItemRenderer.java.patch index af0c523..90e4eae 100644 --- a/patches/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -22,7 +22,7 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; -@@ -16,11 +23,25 @@ +@@ -16,11 +23,26 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.EntityLivingBase; @@ -31,6 +31,7 @@ +import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; ++import net.minecraft.item.EnumAction; import net.minecraft.item.Item; +import net.minecraft.item.ItemArrow; +import net.minecraft.item.ItemBlock; @@ -48,7 +49,7 @@ import net.minecraft.src.Config; import net.minecraft.src.DynamicLights; import net.minecraft.src.Reflector; -@@ -31,9 +52,16 @@ +@@ -31,9 +53,16 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -65,7 +66,7 @@ public class ItemRenderer { private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); -@@ -41,47 +69,60 @@ +@@ -41,47 +70,60 @@ /** A reference to the Minecraft object. */ private final Minecraft mc; @@ -144,7 +145,7 @@ GlStateManager.popMatrix(); } -@@ -107,7 +148,7 @@ +@@ -107,7 +149,7 @@ GlStateManager.popMatrix(); } @@ -153,7 +154,7 @@ { AbstractClientPlayer abstractclientplayer = this.mc.player; int i = this.mc.world.getCombinedLight(new BlockPos(abstractclientplayer.posX, abstractclientplayer.posY + (double)abstractclientplayer.getEyeHeight(), abstractclientplayer.posZ), 0); -@@ -122,6 +163,7 @@ +@@ -122,6 +164,7 @@ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1); } @@ -161,7 +162,7 @@ private void rotateArm(float p_187458_1_) { EntityPlayerSP entityplayersp = this.mc.player; -@@ -142,6 +184,7 @@ +@@ -142,6 +185,7 @@ return f; } @@ -169,7 +170,7 @@ private void renderArms() { if (!this.mc.player.isInvisible()) -@@ -156,6 +199,7 @@ +@@ -156,6 +200,7 @@ } } @@ -177,7 +178,7 @@ private void renderArm(EnumHandSide p_187455_1_) { this.mc.getTextureManager().bindTexture(this.mc.player.getLocationSkin()); -@@ -183,27 +227,29 @@ +@@ -183,27 +228,29 @@ private void renderMapFirstPersonSide(float p_187465_1_, EnumHandSide p_187465_2_, float p_187465_3_, ItemStack p_187465_4_) { float f = p_187465_2_ == EnumHandSide.RIGHT ? 1.0F : -1.0F; @@ -222,7 +223,7 @@ GlStateManager.popMatrix(); } -@@ -212,14 +258,17 @@ +@@ -212,14 +259,17 @@ float f = MathHelper.sqrt(p_187463_3_); float f1 = -0.2F * MathHelper.sin(p_187463_3_ * (float)Math.PI); float f2 = -0.4F * MathHelper.sin(f * (float)Math.PI); @@ -246,7 +247,7 @@ this.renderMapFirstPerson(this.itemStackMainHand); } -@@ -250,100 +299,132 @@ +@@ -250,100 +300,132 @@ GlStateManager.enableLighting(); } @@ -448,7 +449,7 @@ } } -@@ -352,203 +433,532 @@ +@@ -352,203 +434,555 @@ this.rotateArm(partialTicks); GlStateManager.enableRescaleNormal(); @@ -689,6 +690,29 @@ + + boolean vive = MCOpenVR.isVive; + ++ boolean sword = false, tool = false; ++ boolean bow = item.getItemUseAction(itemstack) == EnumAction.BOW; ++ ++ if(bow && item.getClass().getName().equals("FryPan")){ ++ bow = false; ++ tool = true; ++ } ++ ++ if(!bow && Reflector.forgeExists()){ //tinkers ++ String t = item.getClass().getSuperclass().getName().toLowerCase(); ++ if (t.contains("weapon") || t.contains("sword")) { ++ sword = true; ++ tool = true; ++ } else if (t.contains("tool")){ ++ tool = true; ++ } ++ } ++ ++ if(Reflector.forgeExists() && bow && item.getClass().getName().contains("FryPan")){ //y, srsly. ++ bow = false; ++ tool = true; ++ } ++ + if(item instanceof ItemBlock){ + + if (this.itemRenderer.shouldRenderItemIn3D(itemstack)){ @@ -705,7 +729,7 @@ + GlStateManager.rotate(-i*45.0F, 0.0F, 1.0F, 0.0F); + } + } -+ else if(item instanceof ItemSword ) ++ else if(item instanceof ItemSword || sword) + { + if(vive){ + GlStateManager.translate(0f, 0f, -0.2f); @@ -726,7 +750,8 @@ + item instanceof ItemFishingRod || + item instanceof ItemCarrotOnAStick || + item instanceof ItemShears|| -+ item instanceof ItemFlintAndSteel) ++ item instanceof ItemFlintAndSteel|| ++ tool) + + { + @@ -770,8 +795,7 @@ + GlStateManager.rotate(i*90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(.5,0.5,.6); + } -+ else if(item instanceof ItemBow){ -+ //shouldrenderhand = false; ++ else if(bow){ + GlStateManager.scale(1.0f, 1.0f, 1.0f); + shouldrenderhand = false; + if(mc.bowTracker.isDrawing){ //here there be dragons @@ -1129,7 +1153,7 @@ vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(-1.0D, -1.0D, -0.5D).tex((double)f7, (double)f9).endVertex(); vertexbuffer.pos(1.0D, -1.0D, -0.5D).tex((double)f6, (double)f9).endVertex(); -@@ -572,17 +982,14 @@ +@@ -572,17 +1006,14 @@ VertexBuffer vertexbuffer = tessellator.getBuffer(); float f = this.mc.player.getBrightness(partialTicks); GlStateManager.color(f, f, f, 0.5F); diff --git a/patches/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/net/minecraft/client/renderer/RenderGlobal.java.patch index 1abeffd..93881d6 100644 --- a/patches/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,16 +1,17 @@ --- a/net/minecraft/client/renderer/RenderGlobal.java +++ b/net/minecraft/client/renderer/RenderGlobal.java -@@ -4,7 +4,9 @@ +@@ -4,7 +4,10 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.gson.JsonSyntaxException; ++import com.mtbs3d.minecrift.provider.MCOpenVR; + import it.unimi.dsi.fastutil.longs.Long2ObjectMap; + import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; -@@ -19,7 +21,9 @@ +@@ -19,7 +22,9 @@ import java.util.Map; import java.util.Random; import java.util.Set; @@ -20,7 +21,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockChest; import net.minecraft.block.BlockEnderChest; -@@ -106,11 +110,13 @@ +@@ -106,11 +111,13 @@ import net.minecraft.world.border.WorldBorder; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; @@ -34,7 +35,7 @@ import shadersmod.client.Shaders; import shadersmod.client.ShadersRender; import shadersmod.client.ShadowUtils; -@@ -203,7 +209,7 @@ +@@ -203,7 +210,7 @@ public Set chunksToResortTransparency = new LinkedHashSet(); public Set chunksToUpdateForced = new LinkedHashSet(); private Deque visibilityDeque = new ArrayDeque(); @@ -43,7 +44,7 @@ private List renderInfosTileEntities = new ArrayList(1024); private List renderInfosNormal = new ArrayList(1024); private List renderInfosEntitiesNormal = new ArrayList(1024); -@@ -396,7 +402,7 @@ +@@ -396,7 +403,7 @@ } } @@ -52,7 +53,7 @@ { int i = 64; int j = 6; -@@ -459,7 +465,7 @@ +@@ -459,7 +466,7 @@ } } @@ -61,7 +62,7 @@ { Random random = new Random(10842L); worldRendererIn.begin(7, DefaultVertexFormats.POSITION); -@@ -654,7 +660,7 @@ +@@ -654,7 +661,7 @@ if (Reflector.MinecraftForgeClient_getRenderPass.exists()) { @@ -70,7 +71,7 @@ } if (this.renderEntitiesStartupCounter > 0) -@@ -754,6 +760,8 @@ +@@ -754,6 +761,8 @@ { boolean flag3 = this.mc.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping() : false; @@ -79,7 +80,7 @@ if ((entity2 != this.mc.getRenderViewEntity() || this.mc.gameSettings.thirdPersonView != 0 || flag3) && (entity2.posY < 0.0D || entity2.posY >= 256.0D || this.world.isBlockLoaded(blockpos$pooledmutableblockpos.setPos(entity2)))) { ++this.countEntitiesRendered; -@@ -930,7 +938,7 @@ +@@ -930,7 +939,7 @@ if (Reflector.callBoolean(tileentity1, Reflector.ForgeTileEntity_shouldRenderInPass, new Object[] {Integer.valueOf(i)})) { @@ -88,7 +89,7 @@ if (axisalignedbb == null || camera.isBoundingBoxInFrustum(axisalignedbb)) { -@@ -1133,10 +1141,12 @@ +@@ -1133,10 +1142,12 @@ } this.mc.mcProfiler.endStartSection("culling"); @@ -103,7 +104,7 @@ this.lastViewEntityX = viewEntity.posX; this.lastViewEntityY = viewEntity.posY; this.lastViewEntityZ = viewEntity.posZ; -@@ -1227,8 +1237,11 @@ +@@ -1227,8 +1238,11 @@ if (set1.size() == 1) { @@ -117,7 +118,7 @@ set1.remove(enumfacing); } -@@ -1471,6 +1484,7 @@ +@@ -1471,6 +1485,7 @@ } } @@ -125,7 +126,7 @@ protected Vector3f getViewVector(Entity entityIn, double partialTicks) { float f = (float)((double)entityIn.prevRotationPitch + (double)(entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks); -@@ -1486,7 +1500,7 @@ +@@ -1486,7 +1501,7 @@ float f4 = -MathHelper.cos(-f * 0.017453292F); float f5 = MathHelper.sin(-f * 0.017453292F); return new Vector3f(f3 * f4, f5, f2 * f4); @@ -134,7 +135,7 @@ public int renderBlockLayer(BlockRenderLayer blockLayerIn, double partialTicks, int pass, Entity entityIn) { -@@ -1735,7 +1749,7 @@ +@@ -1735,7 +1750,7 @@ if (Reflector.ForgeWorldProvider_getSkyRenderer.exists()) { WorldProvider worldprovider = this.mc.world.provider; @@ -143,7 +144,7 @@ if (object != null) { -@@ -1751,9 +1765,9 @@ +@@ -1751,9 +1766,9 @@ else if (this.mc.world.provider.isSurfaceWorld()) { GlStateManager.disableTexture2D(); @@ -155,7 +156,7 @@ { Shaders.disableTexture2D(); } -@@ -1761,7 +1775,7 @@ +@@ -1761,7 +1776,7 @@ Vec3d vec3d = this.world.getSkyColor(this.mc.getRenderViewEntity(), partialTicks); vec3d = CustomColors.getSkyColor(vec3d, this.mc.world, this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().posY + 1.0D, this.mc.getRenderViewEntity().posZ); @@ -164,7 +165,7 @@ { Shaders.setSkyColor(vec3d); } -@@ -1786,14 +1800,14 @@ +@@ -1786,14 +1801,14 @@ GlStateManager.depthMask(false); GlStateManager.enableFog(); @@ -181,7 +182,7 @@ { Shaders.preSkyList(); } -@@ -1817,7 +1831,7 @@ +@@ -1817,7 +1832,7 @@ GlStateManager.disableFog(); @@ -190,7 +191,7 @@ { Shaders.disableFog(); } -@@ -1832,7 +1846,7 @@ +@@ -1832,7 +1847,7 @@ { GlStateManager.disableTexture2D(); @@ -199,7 +200,7 @@ { Shaders.disableTexture2D(); } -@@ -1875,7 +1889,7 @@ +@@ -1875,7 +1890,7 @@ GlStateManager.enableTexture2D(); @@ -208,7 +209,7 @@ { Shaders.enableTexture2D(); } -@@ -1887,14 +1901,14 @@ +@@ -1887,14 +1902,14 @@ GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); CustomSky.renderSky(this.world, this.renderEngine, partialTicks); @@ -225,7 +226,7 @@ { Shaders.postCelestialRotate(); } -@@ -1934,7 +1948,7 @@ +@@ -1934,7 +1949,7 @@ GlStateManager.disableTexture2D(); @@ -234,7 +235,7 @@ { Shaders.disableTexture2D(); } -@@ -1965,7 +1979,7 @@ +@@ -1965,7 +1980,7 @@ GlStateManager.enableAlpha(); GlStateManager.enableFog(); @@ -243,7 +244,7 @@ { Shaders.enableFog(); } -@@ -1973,7 +1987,7 @@ +@@ -1973,7 +1988,7 @@ GlStateManager.popMatrix(); GlStateManager.disableTexture2D(); @@ -252,7 +253,7 @@ { Shaders.disableTexture2D(); } -@@ -2053,7 +2067,7 @@ +@@ -2053,7 +2068,7 @@ GlStateManager.popMatrix(); GlStateManager.enableTexture2D(); @@ -261,7 +262,7 @@ { Shaders.enableTexture2D(); } -@@ -2069,7 +2083,7 @@ +@@ -2069,7 +2084,7 @@ if (Reflector.ForgeWorldProvider_getCloudRenderer.exists()) { WorldProvider worldprovider = this.mc.world.provider; @@ -270,7 +271,7 @@ if (object != null) { -@@ -2614,7 +2628,7 @@ +@@ -2614,7 +2629,7 @@ if (tileentity != null) { @@ -279,3 +280,101 @@ } } +@@ -3092,6 +3107,8 @@ + { + Random random = this.world.rand; + ++ boolean playernear = mc.player !=null && !mc.player.isDead && (mc.player.getPosition().distanceSq(blockPosIn) < 25); ///hmm sure why not. ++ + switch (type) + { + case 1000: +@@ -3147,14 +3164,21 @@ + break; + + case 1011: ++ if(playernear) ++ MCOpenVR.triggerHapticPulse(0,250); //VIVECRAFT go thump. + this.world.playSound(blockPosIn, SoundEvents.BLOCK_IRON_DOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 1012: ++ if(playernear) ++ MCOpenVR.triggerHapticPulse(0,250); //VIVECRAFT go thump. + this.world.playSound(blockPosIn, SoundEvents.BLOCK_WOODEN_DOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 1013: ++ if(playernear) ++ MCOpenVR.triggerHapticPulse(0,250); //VIVECRAFT go thump. ++ + this.world.playSound(blockPosIn, SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false); + break; + +@@ -3179,14 +3203,26 @@ + break; + + case 1019: ++ if(playernear){ //this is just mean. ++ MCOpenVR.triggerHapticPulse(0,750); ++ MCOpenVR.triggerHapticPulse(1,750); ++ } + this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1020: ++ if(playernear){ //this is just mean. ++ MCOpenVR.triggerHapticPulse(0,750); ++ MCOpenVR.triggerHapticPulse(1,750); ++ } + this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1021: ++ if(playernear){ //this is just mean. ++ MCOpenVR.triggerHapticPulse(0,1250); ++ MCOpenVR.triggerHapticPulse(1,1250); ++ } + this.world.playSound(blockPosIn, SoundEvents.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, SoundCategory.HOSTILE, 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + +@@ -3215,10 +3251,17 @@ + break; + + case 1030: ++ if(playernear){ ++ MCOpenVR.triggerHapticPulse(0,500); ++ } + this.world.playSound(blockPosIn, SoundEvents.BLOCK_ANVIL_USE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 1031: ++ if(playernear){ ++ MCOpenVR.triggerHapticPulse(0,1250); ++ MCOpenVR.triggerHapticPulse(1,1250); ++ } + this.world.playSound(blockPosIn, SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, 0.3F, this.world.rand.nextFloat() * 0.1F + 0.9F, false); + break; + +@@ -3239,6 +3282,9 @@ + break; + + case 1036: ++ if(playernear) ++ MCOpenVR.triggerHapticPulse(0,250); //VIVECRAFT go thump. ++ + this.world.playSound(blockPosIn, SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE, SoundCategory.BLOCKS, 1.0F, this.world.rand.nextFloat() * 0.1F + 0.9F, false); + break; + +@@ -3278,7 +3324,10 @@ + { + soundtype = (SoundType)Reflector.call(block, Reflector.ForgeBlock_getSoundType, new Object[] {Block.getStateById(data), this.world, blockPosIn, null}); + } +- ++ ++ if(playernear) ++ MCOpenVR.triggerHapticPulse(0,250); //VIVECRAFT go thump. ++ + this.world.playSound(blockPosIn, soundtype.getBreakSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false); + } + diff --git a/patches/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java.patch b/patches/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java.patch index 10b8dac..c3c061f 100644 --- a/patches/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java.patch +++ b/patches/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java.patch @@ -1,10 +1,11 @@ --- a/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java +++ b/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java -@@ -1,13 +1,25 @@ +@@ -1,13 +1,26 @@ package net.minecraft.client.renderer.entity.layers; +import java.util.UUID; + ++import com.mtbs3d.minecrift.gameplay.BowTracker; +import com.mtbs3d.minecrift.render.PlayerModelController; +import com.mtbs3d.minecrift.render.PlayerModelController.RotInfo; + @@ -26,102 +27,117 @@ public class LayerHeldItem implements LayerRenderer { -@@ -46,6 +58,24 @@ - { - if (p_188358_2_ != null) - { -+ -+ -+ boolean vr =false;; -+ RotInfo rotinfo = null; -+ if(p_188358_1_ instanceof EntityPlayer){ -+ UUID uuid=((EntityPlayer) p_188358_1_).getGameProfile().getId(); -+ if(PlayerModelController.getInstance().isTracked(uuid)){ -+ rotinfo = PlayerModelController.getInstance().getRotationsForPlayer(uuid); -+ if(rotinfo.seated ==false){ -+ vr = true; -+ } -+ } -+ } -+ -+ if(handSide == EnumHandSide.LEFT && vr && p_188358_1_.getHeldItemMainhand() != null && p_188358_1_.getHeldItemMainhand().getItem() instanceof ItemBow ){ -+ return; -+ } -+ - GlStateManager.pushMatrix(); - ((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, handSide); - -@@ -54,13 +84,75 @@ - GlStateManager.translate(0.0F, 0.2F, 0.0F); - } +@@ -44,23 +57,100 @@ -+ this.translateToHand(handSide); -+ - GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); - boolean flag = handSide == EnumHandSide.LEFT; -+ //VIVECRAFT -+ -+ -+ if(!vr) { - GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F); -- Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag); -+ } -+ else{ -+ GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -.2125f); -+ if(p_188358_2_.getItem() == Items.BOW && !rotinfo.seated){ -+ -+ Vec3d diff = rotinfo.leftArmPos.subtract(rotinfo.rightArmPos); -+ double ltor = Math.atan2(-diff.xCoord, diff.zCoord) + Math.PI/2; -+ Vec3d rtol = rotinfo.rightArmPos.subtract(rotinfo.leftArmPos).rotateYaw((float) ltor); -+ Vec3d larm = rotinfo.leftArmPos; -+ ModelPlayerVR m = ((ModelPlayerVR)this.livingEntityRenderer.getMainModel()); -+ larm = larm.rotateYaw((float)(ltor)).add(rotinfo.leftArmRot.scale(-0.2)); -+ float scale = (float) 0.0625; -+ -+ GlStateManager.popMatrix(); -+ GlStateManager.pushMatrix(); -+ -+ GlStateManager.translate(m.bipedLeftArm.rotationPointX*scale,m.bipedLeftArm.rotationPointY*scale,m.bipedLeftArm.rotationPointZ*scale); -+ -+ if(p_188358_1_.isHandActive()){ -+ -+ float yaw1 = (float) Math.atan2(-rtol.xCoord, -rtol.zCoord); -+ float pitch1 = (float) Math.asin(rtol.yCoord/rtol.lengthVector()); -+ -+ GlStateManager.rotate((float) Math.toDegrees(-Math.PI+yaw1), 0,1,0); -+ GlStateManager.rotate((float) Math.toDegrees(+pitch1), 1,0,0); -+ -+ } else{ -+ GlStateManager.rotate((float) Math.toDegrees(m.bipedLeftArm.rotateAngleY), 0,1,0); -+ GlStateManager.rotate( 90 + (float) Math.toDegrees(m.bipedLeftArm.rotateAngleX), 1,0,0); + private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide) + { +- if (p_188358_2_ != null) +- { +- GlStateManager.pushMatrix(); +- ((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, handSide); +- +- if (p_188358_1_.isSneaking()) +- { +- GlStateManager.translate(0.0F, 0.2F, 0.0F); +- } ++ if (p_188358_2_ != null) ++ { ++ boolean vr =false;; ++ RotInfo rotinfo = null; ++ if(p_188358_1_ instanceof EntityPlayer){ ++ UUID uuid=((EntityPlayer) p_188358_1_).getGameProfile().getId(); ++ if(PlayerModelController.getInstance().isTracked(uuid)){ ++ rotinfo = PlayerModelController.getInstance().getRotationsForPlayer(uuid); ++ if(rotinfo.seated ==false){ ++ vr = true; + } -+ -+ GlStateManager.translate(0, 0.155F, -0.215F); -+ Minecraft.getMinecraft().getItemRenderer().renderItemSide(0,p_188358_1_, p_188358_2_, p_188358_3_, flag); -+ GlStateManager.popMatrix(); -+ ++ } ++ } + -+ -+ GlStateManager.pushMatrix(); -+ this.translateToHand(handSide); -+ GlStateManager.popMatrix(); -+ return; -+ } else { -+ GlStateManager.rotate(-80.0F, 1.0F, 0.0F, 0.0F); -+ } -+ -+ -+ GlStateManager.translate(0, 0.155F, -0.215F); -+ -+ } ++ if(handSide == EnumHandSide.LEFT && vr && BowTracker.isHoldingBow(p_188358_1_)){ ++ return; ++ } + -+ // -+ Minecraft.getMinecraft().getItemRenderer().renderItemSide(0, p_188358_1_, p_188358_2_, p_188358_3_, flag); - GlStateManager.popMatrix(); - } -+ } ++ GlStateManager.pushMatrix(); + ++ if (p_188358_1_.isSneaking()) ++ { ++ GlStateManager.translate(0.0F, 0.2F, 0.0F); ++ } ++ ++ this.translateToHand(handSide); ++ ++ GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); ++ GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); ++ boolean flag = handSide == EnumHandSide.LEFT; ++ //VIVECRAFT ++ ++ ++ if(!vr) { ++ GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F); ++ } ++ else{ ++ GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -.2125f); ++ if(BowTracker.isBow(p_188358_2_) && !rotinfo.seated){ ++ ++ Vec3d diff = rotinfo.leftArmPos.subtract(rotinfo.rightArmPos); ++ double ltor = Math.atan2(-diff.xCoord, diff.zCoord) + Math.PI/2; ++ Vec3d rtol = rotinfo.rightArmPos.subtract(rotinfo.leftArmPos).rotateYaw((float) ltor); ++ Vec3d larm = rotinfo.leftArmPos; ++ ModelPlayerVR m = ((ModelPlayerVR)this.livingEntityRenderer.getMainModel()); ++ larm = larm.rotateYaw((float)(ltor)).add(rotinfo.leftArmRot.scale(-0.2)); ++ float scale = (float) 0.0625; ++ ++ GlStateManager.popMatrix(); ++ GlStateManager.pushMatrix(); ++ ++ GlStateManager.translate(m.bipedLeftArm.rotationPointX*scale,m.bipedLeftArm.rotationPointY*scale,m.bipedLeftArm.rotationPointZ*scale); ++ ++ if(p_188358_1_.isHandActive()){ ++ ++ float yaw1 = (float) Math.atan2(-rtol.xCoord, -rtol.zCoord); ++ float pitch1 = (float) Math.asin(rtol.yCoord/rtol.lengthVector()); ++ ++ GlStateManager.rotate((float) Math.toDegrees(-Math.PI+yaw1), 0,1,0); ++ GlStateManager.rotate((float) Math.toDegrees(+pitch1), 1,0,0); ++ ++ } else{ ++ GlStateManager.rotate((float) Math.toDegrees(m.bipedLeftArm.rotateAngleY), 0,1,0); ++ GlStateManager.rotate( 90 + (float) Math.toDegrees(m.bipedLeftArm.rotateAngleX), 1,0,0); ++ } ++ ++ GlStateManager.translate(0, 0.155F, -0.215F); ++ Minecraft.getMinecraft().getItemRenderer().renderItemSide(0,p_188358_1_, p_188358_2_, p_188358_3_, flag); ++ GlStateManager.popMatrix(); ++ ++ ++ ++ GlStateManager.pushMatrix(); ++ this.translateToHand(handSide); ++ GlStateManager.popMatrix(); ++ return; ++ } else { ++ GlStateManager.rotate(-80.0F, 1.0F, 0.0F, 0.0F); ++ } ++ ++ ++ GlStateManager.translate(0, 0.155F, -0.215F); ++ ++ } ++ ++ // ++ Minecraft.getMinecraft().getItemRenderer().renderItemSide(0, p_188358_1_, p_188358_2_, p_188358_3_, flag); ++ GlStateManager.popMatrix(); ++ } ++ } + +- GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); +- GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); +- boolean flag = handSide == EnumHandSide.LEFT; +- GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F); +- Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag); +- GlStateManager.popMatrix(); +- } + protected void translateToHand(EnumHandSide p_191361_1_) + { + ((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, p_191361_1_); diff --git a/patches/net/minecraft/world/ChunkCache.java.patch b/patches/net/minecraft/world/ChunkCache.java.patch new file mode 100644 index 0000000..29a8d96 --- /dev/null +++ b/patches/net/minecraft/world/ChunkCache.java.patch @@ -0,0 +1,88 @@ +--- a/net/minecraft/world/ChunkCache.java ++++ b/net/minecraft/world/ChunkCache.java +@@ -1,9 +1,11 @@ + package net.minecraft.world; + + import javax.annotation.Nullable; ++ + import net.minecraft.block.material.Material; + import net.minecraft.block.state.IBlockState; + import net.minecraft.init.Blocks; ++import net.minecraft.src.Reflector; + import net.minecraft.tileentity.TileEntity; + import net.minecraft.util.EnumFacing; + import net.minecraft.util.math.BlockPos; +@@ -65,7 +67,7 @@ + @Nullable + public TileEntity getTileEntity(BlockPos pos) + { +- return this.getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); ++ return this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); // Forge: don't modify world from other threads + } + + @Nullable +@@ -73,6 +75,7 @@ + { + int i = (p_190300_1_.getX() >> 4) - this.chunkX; + int j = (p_190300_1_.getZ() >> 4) - this.chunkZ; ++ if (!withinBounds(i, j)) return null; + return this.chunkArray[i][j].getTileEntity(p_190300_1_, p_190300_2_); + } + +@@ -114,6 +117,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (!withinBounds(i, j)) return net.minecraft.init.Biomes.PLAINS; + return this.chunkArray[i][j].getBiome(pos, this.world.getBiomeProvider()); + } + +@@ -150,6 +154,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (!withinBounds(i, j)) return type.defaultLightValue; + return this.chunkArray[i][j].getLightFor(type, pos); + } + } +@@ -165,7 +170,8 @@ + */ + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getMaterial() == Material.AIR; ++ IBlockState state = this.getBlockState(pos); ++ return Reflector.forgeExists() ? Reflector.callBoolean(state.getBlock(), Reflector.ForgeBlock_isAir, state, this, pos) : state.getMaterial() == Material.AIR; + } + + public int getLightFor(EnumSkyBlock p_175628_1_, BlockPos pos) +@@ -174,6 +180,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (!withinBounds(i, j)) return p_175628_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); + } + else +@@ -191,4 +198,22 @@ + { + return this.world.getWorldType(); + } ++ ++ // This is a Forge method, so we don't care about what it does in vanilla ++ //@Override ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) ++ { ++ int x = (pos.getX() >> 4) - this.chunkX; ++ int z = (pos.getZ() >> 4) - this.chunkZ; ++ if (pos.getY() < 0 || pos.getY() >= 256) return _default; ++ if (!withinBounds(x, z)) return _default; ++ ++ IBlockState state = getBlockState(pos); ++ return Reflector.callBoolean(state.getBlock(), Reflector.ForgeBlock_isSideSolid, state, this, pos, side); ++ } ++ ++ private boolean withinBounds(int x, int z) ++ { ++ return x >= 0 && x < chunkArray.length && z >= 0 && z < chunkArray[x].length && chunkArray[x][z] != null; ++ } + } diff --git a/src/com/mtbs3d/minecrift/gameplay/BackpackTracker.java b/src/com/mtbs3d/minecrift/gameplay/BackpackTracker.java index fde436f..f9a6fa0 100644 --- a/src/com/mtbs3d/minecrift/gameplay/BackpackTracker.java +++ b/src/com/mtbs3d/minecrift/gameplay/BackpackTracker.java @@ -40,7 +40,7 @@ public void doProcess(Minecraft minecraft, EntityPlayerSP player){ for(int c=0; c<2; c++) { //just main for 1710, no dual wielding Vec3d controllerPos = provider.getControllerPos_Room(c);//.add(provider.getCustomControllerVector(c, new Vec3(0, 0, -0.1))); Vec3d controllerDir = minecraft.roomScale.getControllerDir_World(c); - Vec3d hmddir = provider.getHMDDir_World(); + Vec3d hmddir = minecraft.vrPlayer.getHMDDir_Room(); Vec3d hmdpos = provider.getHMDPos_Room(); Vec3d delta = hmdPos.subtract(controllerPos); double dot = controllerDir.dotProduct(down); diff --git a/src/com/mtbs3d/minecrift/gameplay/BowTracker.java b/src/com/mtbs3d/minecrift/gameplay/BowTracker.java index 61237d8..5aa64b1 100644 --- a/src/com/mtbs3d/minecrift/gameplay/BowTracker.java +++ b/src/com/mtbs3d/minecrift/gameplay/BowTracker.java @@ -14,6 +14,7 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Enchantments; import net.minecraft.init.Items; @@ -65,12 +66,20 @@ public boolean isNotched(){ return canDraw || isDrawing; } + public static boolean isBow(ItemStack itemStack) { + return itemStack != null && itemStack.getItem().getItemUseAction(itemStack) == EnumAction.BOW; + } + + public static boolean isHoldingBow(EntityLivingBase e) { + return isBow(e.getHeldItemMainhand()); + } + public boolean isActive(EntityPlayerSP p){ if(p == null) return false; if(p.isDead) return false; if(p.isPlayerSleeping()) return false; if(p.getHeldItemMainhand() == null) return false; - return p.getHeldItemMainhand().getItemUseAction() == EnumAction.BOW; + return isHoldingBow(p); } float tsNotch = 0; diff --git a/src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java b/src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java index 8110b03..2736737 100644 --- a/src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java +++ b/src/com/mtbs3d/minecrift/gameplay/ClimbTracker.java @@ -5,6 +5,7 @@ import java.util.Random; import javax.swing.LayoutStyle; +import javax.swing.text.html.BlockView; import com.mtbs3d.minecrift.api.IRoomscaleAdapter; import com.mtbs3d.minecrift.api.NetworkHelper; @@ -15,6 +16,8 @@ import com.mtbs3d.minecrift.utils.BlockWithData; import net.minecraft.block.Block; +import net.minecraft.block.BlockLadder; +import net.minecraft.block.BlockVine; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -142,7 +145,7 @@ public void doProcess(EntityPlayerSP player){ if(!mc.climbTracker.isClimbeyClimb()){ ladder = true; - if(b == Blocks.LADDER || b ==Blocks.VINE){ + if(b instanceof BlockLadder|| b instanceof BlockVine){ int meta = b.getMetaFromState(bs); Vec3d cpos = controllerPos.subtract(bp.getX(), bp.getY(), bp.getZ()); diff --git a/src/com/mtbs3d/minecrift/main/VivecraftMain.java b/src/com/mtbs3d/minecrift/main/VivecraftMain.java index 2a12aaa..4f151c8 100644 --- a/src/com/mtbs3d/minecrift/main/VivecraftMain.java +++ b/src/com/mtbs3d/minecrift/main/VivecraftMain.java @@ -20,10 +20,9 @@ public class VivecraftMain { private static final String[] encapsulatedTransformers = new String[]{ - // woo }; private static final String[] removedTransformers = new String[]{ - // yeah + "guichaguri.betterfps.transformers.PatcherTransformer" }; public static void main(String[] p_main_0_) @@ -50,7 +49,7 @@ public static void main(String[] p_main_0_) passedDeobf = true; } for (String dt : encapsulatedTransformers) { - if (t.getClass().getName().equals(dt)) { + if (t.getClass().getName().equals(dt) || t.getClass().getName().equals("$wrapper." + dt)) { if (passedDeobf) { encapsulateDeobf.add(t); } else { @@ -61,7 +60,7 @@ public static void main(String[] p_main_0_) } } for (String dt : removedTransformers) { - if (t.getClass().getName().equals(dt)) { + if (t.getClass().getName().equals(dt) || t.getClass().getName().equals("$wrapper." + dt)) { it.remove(); break; } @@ -73,8 +72,8 @@ public static void main(String[] p_main_0_) int forgeObfIndex = 0; for (int i = 0; i < transformers.size(); i++) { IClassTransformer t = transformers.get(i); - if (t.getClass().getName().equals("$wrapper.net.minecraftforge.fml.common.asm.transformers.BlamingTransformer")) { - forgeObfIndex = i; + if (t.getClass().getName().equals("$wrapper.net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer")) { + forgeObfIndex = i + 1; break; } } diff --git a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java index 397d33e..2fb1c90 100644 --- a/src/com/mtbs3d/minecrift/provider/MCOpenVR.java +++ b/src/com/mtbs3d/minecrift/provider/MCOpenVR.java @@ -62,6 +62,7 @@ import java.awt.AWTException; import java.awt.Window; +import java.awt.PageAttributes.OriginType; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.io.File; @@ -696,12 +697,32 @@ public static boolean setKeyboardOverlayShowing(boolean showingState, GuiTextFie Pointer empty = new Memory(1); empty.setString(0, ""); - ret = vrOverlay.ShowKeyboard.apply(0, 0, pointer, 256, empty, (byte)1, 0) ; +// HmdMatrix34_t keyboardpos = new HmdMatrix34_t(); +// //keyboardpos.m[0] = guiRotationPose.M[0][0]; +// //keyboardpos.m[1] = guiRotationPose.M[0][1]; +// //keyboardpos.m[2] = guiRotationPose.M[0][2]; +// keyboardpos.m[3] = guiPos_Room.x; +// +// //keyboardpos.m[4] = guiRotationPose.M[1][0]; +// //keyboardpos.m[5] = guiRotationPose.M[1][1]; +// //keyboardpos.m[6] = guiRotationPose.M[1][2]; +// keyboardpos.m[7] = guiPos_Room.y; +// +// //keyboardpos.m[8] = guiRotationPose.M[2][0]; +// //keyboardpos.m[9] = guiRotationPose.M[2][1]; +// //keyboardpos.m[10] = guiRotationPose.M[2][2]; +// keyboardpos.m[11] = guiPos_Room.z; + + ret = vrOverlay.ShowKeyboard.apply(0, 0, pointer, 256, empty, (byte)1, 0); + //vrOverlay.SetKeyboardTransformAbsolute.apply(JOpenVRLibrary.ETrackingUniverseOrigin.ETrackingUniverseOrigin_TrackingUniverseStanding,keyboardpos); + keyboardShowing = 0 == ret; //0 = no error, > 0 see EVROverlayError if (ret != 0) { - System.out.println("VR Overlay Error: " + vrOverlay.GetOverlayErrorNameFromEnum.apply(ret).getString(0)); + String err = vrOverlay.GetOverlayErrorNameFromEnum.apply(ret).getString(0); + System.out.println("VR Overlay Error: " + err); + if(err.equalsIgnoreCase("VROverlayError_KeyboardAlreadyInUse")) keyboardShowing = true; } } else { @@ -786,7 +807,7 @@ private static void processGui() { Vector3f controllerPos = new Vector3f(); //OpenVRUtil.convertMatrix4ftoTranslationVector(controllerPose[0]); - Vec3d con = mc.vrPlayer.getControllerPos_World(0); + Vec3d con = mc.entityRenderer.getControllerRenderPos(0); controllerPos.x = (float) con.xCoord; controllerPos.y = (float) con.yCoord; controllerPos.z = (float) con.zCoord; @@ -798,7 +819,7 @@ private static void processGui() { Vector3f guiNormal = guiRotationPose.transform(forward); Vector3f guiRight = guiRotationPose.transform(new Vector3f(1,0,0)); Vector3f guiUp = guiRotationPose.transform(new Vector3f(0,1,0)); - + float guiWidth = 1.0f; float guiHalfWidth = guiWidth * 0.5f; float guiHeight = 1.0f; @@ -930,17 +951,20 @@ else if (controllerMouseX == -1.0f) // mouse on screen int mouseX = Math.min(Math.max((int) controllerMouseX, 0), mc.displayWidth); int mouseY = Math.min(Math.max((int) controllerMouseY, 0), mc.displayHeight); - + if (controllerDeviceIndex[RIGHT_CONTROLLER] != -1) { - Mouse.setCursorPosition(mouseX, mouseY); + Mouse.setCursorPosition(mouseX, mouseY); + //KeyboardSimulator.robot.mouseMove(Display.getX() + mouseX, Display.getY() + mouseY); controllerMouseValid = true; //LMB if (mc.currentScreen != null && pressedleftclick && !lastpressedleftclick) { //press left mouse button - if (Display.isActive()) + if (Display.isActive()) { + //System.out.println("LMB DOWN"); KeyboardSimulator.robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + } else mc.currentScreen.mouseDown(mouseX, mouseY, 0); } @@ -950,7 +974,10 @@ else if (controllerMouseX == -1.0f) if (mc.currentScreen != null && !pressedleftclick && lastpressedleftclick) { //release left mouse button - if (Display.isActive()) KeyboardSimulator.robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + if (Display.isActive()){ + //System.out.println("LMB UP"); + KeyboardSimulator.robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } else mc.currentScreen.mouseUp(mouseX, mouseY, 0); } //end LMB @@ -1326,12 +1353,27 @@ private static void processControllerButtons(boolean sleeping, boolean gui) mc.getConnection().sendPacket(new CPacketClientStatus(State.PERFORM_RESPAWN)); mc.displayGuiScreen((GuiScreen)null); }else { - mc.player.closeScreen(); + + if(Display.isActive()){ + KeyboardSimulator.robot.keyPress(KeyEvent.VK_ESCAPE); //window focus... yadda yadda + KeyboardSimulator.robot.keyRelease(KeyEvent.VK_ESCAPE); //window focus... yadda yadda + } + else + mc.player.closeScreen(); + setKeyboardOverlayShowing(false, null); } - }else - - if(!Main.kiosk)mc.displayInGameMenu(); + }else{ + if(!Main.kiosk){ + if(Display.isActive()){ + KeyboardSimulator.robot.keyPress(KeyEvent.VK_ESCAPE); //window focus... yadda yadda + KeyboardSimulator.robot.keyRelease(KeyEvent.VK_ESCAPE); //window focus... yadda yadda + } + else + mc.displayInGameMenu(); + } + setKeyboardOverlayShowing(false, null); + } } } @@ -1683,12 +1725,23 @@ private static void processControllerButtonsOculus(boolean sleeping, boolean gui mc.getConnection().sendPacket(new CPacketClientStatus(State.PERFORM_RESPAWN)); mc.displayGuiScreen((GuiScreen)null); }else { - mc.player.closeScreen(); + + if(Display.isActive()) + KeyboardSimulator.robot.keyPress(KeyEvent.VK_ESCAPE); //window focus... yadda yadda + else + mc.player.closeScreen(); + setKeyboardOverlayShowing(false, null); } - }else - - if(!Main.kiosk)mc.displayInGameMenu(); + }else{ + if(!Main.kiosk){ + if(Display.isActive()) + KeyboardSimulator.robot.keyPress(KeyEvent.VK_ESCAPE); //window focus... yadda yadda + else + mc.displayInGameMenu(); + } + setKeyboardOverlayShowing(false, null); + } } } @@ -1848,7 +1901,7 @@ private static void processVRFunctions(boolean sleeping, boolean gui) { private static void changeHotbar(int dir){ if (Reflector.forgeExists() && mc.currentScreen == null) - KeyboardSimulator.robot.mouseWheel(dir * 120); + KeyboardSimulator.robot.mouseWheel(-dir * 120); else mc.player.inventory.changeCurrentItem(dir); } diff --git a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java index dbded9c..74329a5 100644 --- a/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java +++ b/src/com/mtbs3d/minecrift/provider/OpenVRPlayer.java @@ -13,6 +13,8 @@ import io.netty.util.concurrent.GenericFutureListener; import jopenvr.OpenVRUtil; import net.minecraft.block.Block; +import net.minecraft.block.BlockLadder; +import net.minecraft.block.BlockVine; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; @@ -39,6 +41,7 @@ import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.network.play.client.CPacketCustomPayload; +import net.minecraft.src.Reflector; import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -114,10 +117,10 @@ public void setRoomOrigin(double x, double y, double z, boolean reset, boolean o roomOrigin = new Vec3d(x, y, z); lastRoomUpdateTime = Minecraft.getMinecraft().stereoProvider.getCurrentTimeSecs(); Minecraft.getMinecraft().entityRenderer.irpUpdatedThisFrame = onframe; - // System.out.println(x + " " + y + " " + z); + //System.out.println("room origin " + x + " " + y + " " + z); } - private int roomScaleMovementDelay = 0; + private int roomScaleMovementDelay = 10; //set room public void snapRoomOriginToPlayerEntity(EntityPlayerSP player, boolean reset, boolean onFrame, float nano) @@ -125,6 +128,8 @@ public void snapRoomOriginToPlayerEntity(EntityPlayerSP player, boolean reset, b if (Thread.currentThread().getName().equals("Server thread")) return; + if(!Minecraft.getMinecraft().player.initFromServer) return; + if(player.posX == 0 && player.posY == 0 &&player.posZ == 0) return; Minecraft mc = Minecraft.getMinecraft(); @@ -166,6 +171,7 @@ public void snapRoomOriginToPlayerEntity(EntityPlayerSP player, boolean reset, b public void checkandUpdateRotateScale(boolean onFrame, float nano){ Minecraft mc = Minecraft.getMinecraft(); + if(mc.player.initFromServer == false) return; if(!onFrame && mc.currentScreen!=null) return; if(!onFrame) { @@ -1025,7 +1031,7 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, Entity player, Vec3 float ex = 0; if(mc.vrSettings.seated)ex = 0.5f; if(emptySpotReq){ - movementTeleportDestination = new Vec3d(bb.minX + 0.5f,bb.minY+ex, bb.minZ+ 0.5f); + movementTeleportDestination = new Vec3d((bb.maxX + bb.minX) /2,bb.minY+ex, (bb.maxZ + bb.minZ) /2); movementTeleportDestinationSideHit = collision.sideHit; return true; @@ -1035,7 +1041,7 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, Entity player, Vec3 { //sides //jrbudda require arc hitting top of block. unless ladder or vine or creative or limits off. - if (testClimb.getBlock() == Blocks.LADDER || testClimb.getBlock() == Blocks.VINE) { + if(testClimb instanceof BlockLadder|| testClimb instanceof BlockVine){ Vec3d dest = new Vec3d(bp.getX()+0.5, bp.getY() + 0.5, bp.getZ()+0.5); Block playerblock = mc.world.getBlockState(bp.down()).getBlock(); @@ -1074,7 +1080,7 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, Entity player, Vec3 } if(emptySpotReq){ - Vec3d dest = new Vec3d(bb.minX + 0.5f, hitBlock.getY() + testClimb.getBoundingBox(mc.world, hitBlock).maxY, bb.minZ + 0.5f); + Vec3d dest = new Vec3d((bb.maxX + bb.minX) /2, hitBlock.getY() + testClimb.getBoundingBox(mc.world, hitBlock).maxY, (bb.maxZ + bb.minZ) /2); float maxTeleportDist = 16.0f; if (start.distanceTo(dest) > maxTeleportDist) return false; @@ -1183,25 +1189,44 @@ public void updateSwingAttack() if(is!=null )item = is.getItem(); - boolean tool = false; + boolean tool = false; + boolean sword = false; - if (item instanceof ItemSword){ - entityReachAdd = 2.5f; - weaponLength = 0.4f; - tool = true; - } else if (item instanceof ItemTool || - item instanceof ItemHoe - ){ - entityReachAdd = 1.8f; - weaponLength = 0.4f; + if(item instanceof ItemSword){ + sword = true; + tool = true; + } + else if (item instanceof ItemTool || + item instanceof ItemHoe + ){ + tool = true; + } + else if(item !=null && Reflector.forgeExists()){ //tinkers hack + String t = item.getClass().getSuperclass().getName().toLowerCase(); + //System.out.println(c); + if (t.contains("weapon") || t.contains("sword")) { + sword = true; + tool = true; + } else if (t.contains("tool")){ + tool = true; + } + } + + if (sword){ + entityReachAdd = 2.5f; + weaponLength = 0.3f; + tool = true; + } else if (tool){ + entityReachAdd = 1.8f; + weaponLength = 0.3f; tool = true; - } else if (item !=null){ - weaponLength = 0.1f; - entityReachAdd = 0.3f; - } else { - weaponLength = 0.0f; - entityReachAdd = 0.3f; - } + } else if (item !=null){ + weaponLength = 0.1f; + entityReachAdd = 0.3f; + } else { + weaponLength = 0.0f; + entityReachAdd = 0.3f; + } weaponLength *= this.worldScale; @@ -1305,7 +1330,7 @@ public void updateSwingAttack() } } } else { - if(canact && (!mc.vrSettings.realisticClimbEnabled || block.getBlock() != Blocks.LADDER)) { + if(canact && (!mc.vrSettings.realisticClimbEnabled || !(block.getBlock() instanceof BlockLadder))) { int p = 3; if(item instanceof ItemHoe){ Minecraft.getMinecraft().playerController. @@ -1616,6 +1641,12 @@ public Vec3d getCustomHandVector(int controller, Vec3d axis) { Vec3d out = new Vec3d(v3.x, v3.y, v3.z).rotateYaw(worldRotationRadians); return out; } + + public Vec3d getHMDDir_Room() { + Vector3f v3 = MCOpenVR.headDirection; + Vec3d out = new Vec3d(v3.x, v3.y, v3.z); + return out; + } }