Skip to content

Commit

Permalink
Fixed VR issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeryn99 committed May 22, 2024
1 parent 4ee728b commit 852c771
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<b> Version 1.20-46.0.2 </b></br>
<b>Changes:</b><br>
- Fixed issue where too many angels spawned</br>
- Fixed VR Issues</br>
- Fixed issue where Plinth caused a Xray</br>
- Fixed issue where Angels sometimes had missing textures</br>
- Removed Kontron Ore</br>

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package mc.craig.software.angels.compat.vivecraft;

import net.blf02.vrapi.api.IVRAPI;

public class VRInstance {

public static IVRAPI ivrapi;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@

public class WAVRPluginHandler extends VivecraftReflector {


public static IVRAPI ivrapi;

@Override
public boolean init(IVRAPI ivrapi) {

WeepingAngels.LOGGER.info("Checking for Vivecraft Compatibility...");

if(WAVRPluginStatus.hasPlugin){
WeepingAngels.LOGGER.info("Vivecraft Compatibility enabled");
WAVRPluginHandler.ivrapi = ivrapi;
VRInstance.ivrapi = ivrapi;
} else {
WeepingAngels.LOGGER.info("Vivecraft Compatibility disabled as it was not detected");
}

return WAVRPluginStatus.hasPlugin;
Expand All @@ -32,7 +31,10 @@ public boolean init(IVRAPI ivrapi) {
*/
@Override
public boolean isVRPlayer(Player player) {
return ivrapi.playerInVR(player);
if(WAVRPluginStatus.hasPlugin) {
return VRInstance.ivrapi.playerInVR(player);
}
return false;
}

/**
Expand All @@ -44,7 +46,7 @@ public boolean isVRPlayer(Player player) {
@Override
public Vec3 getHMDPos(Player player) {
if (isVRPlayer(player)) {
IVRPlayer vrPlayer = ivrapi.getVRPlayer(player);
IVRPlayer vrPlayer = VRInstance.ivrapi.getVRPlayer(player);
return vrPlayer.getHMD().position();
}
return player.position().add(0, 1.62, 0);
Expand All @@ -61,7 +63,7 @@ public Vec3 getHMDPos(Player player) {
public Vec3 getHMDRot(Player player) {

if (isVRPlayer(player)) {
IVRPlayer vrPlayer = ivrapi.getVRPlayer(player);
IVRPlayer vrPlayer = VRInstance.ivrapi.getVRPlayer(player);
return vrPlayer.getHMD().getLookAngle();
}

Expand Down

0 comments on commit 852c771

Please sign in to comment.