Skip to content

Commit

Permalink
Fabric Good to Go!
Browse files Browse the repository at this point in the history
  • Loading branch information
hammy275 committed Sep 7, 2022
1 parent b61b25c commit 3772899
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions common/src/main/java/net/blf02/vrapi/client/VRDataGrabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,24 @@ public static void init() {

Matrix4f_toFloatBuffer = getMethod(ReflectionConstants.Matrix4f, "toFloatBuffer");

Minecraft_vr = getField(Minecraft.class, "vr");
Minecraft_vr_Instance = Minecraft_vr.get(Minecraft.getInstance());
Object vrHolder;

try {
Minecraft_vr = getField(Minecraft.class, "vr");
vrHolder = Minecraft.getInstance();
} catch (RuntimeException e) {
Class<?> ClientDataHolder = Class.forName(ReflectionConstants.VIVECRAFT_PACKAGE + ".ClientDataHolder");
Method getCDHInstance = getMethod(ClientDataHolder, "getInstance");
Object cdhInstance = getCDHInstance.invoke(null);
Minecraft_vr = getField(ClientDataHolder, "vr");
vrHolder = cdhInstance;
}

Minecraft_vr_Instance = Minecraft_vr.get(vrHolder);

MCVR_triggerHapticPulse = getMethod(ReflectionConstants.MCVR, "triggerHapticPulse",
ReflectionConstants.ControllerType, float.class, float.class, float.class, float.class);
} catch (IllegalAccessException e) {
} catch (IllegalAccessException | ClassNotFoundException | InvocationTargetException e) {
VRAPIMod.LOGGER.log(Level.SEVERE, "Error: " + e.getMessage());
throw new RuntimeException("Fatal error! Could not get! Please report this, along with the error message above!");
}
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/net/blf02/vrapi/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class Constants {
public static final int[] version = new int[]{2, 0, 0};

// Debugging
public static final boolean doDebugging = true;
public static final boolean doDebugging = false;

public static String getVersion() {
return version[0] + "." + version[1] + "." + version[2];
Expand Down

0 comments on commit 3772899

Please sign in to comment.