Skip to content

Commit

Permalink
Fix missing mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
thejudge156 committed Sep 3, 2023
1 parent c476f46 commit 93cc582
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package org.vivecraft.mixin.client_vr;

import org.lwjgl.openvr.OpenVR;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

import javax.annotation.Nullable;
import java.util.function.LongFunction;

import static org.lwjgl.openvr.VR.*;

@Mixin(value = OpenVR.class, remap = false)
public abstract class OpenVRMixin {

@Shadow @Nullable public static OpenVR.IVRSystem VRSystem;
@Shadow @Nullable public static OpenVR.IVRChaperone VRChaperone;
@Shadow @Nullable public static OpenVR.IVRChaperoneSetup VRChaperoneSetup;
@Shadow @Nullable public static OpenVR.IVRCompositor VRCompositor;
@Shadow @Nullable public static OpenVR.IVROverlay VROverlay;
@Shadow @Nullable public static OpenVR.IVRResources VRResources;
@Shadow @Nullable public static OpenVR.IVRRenderModels VRRenderModels;
@Shadow @Nullable public static OpenVR.IVRExtendedDisplay VRExtendedDisplay;
@Shadow @Nullable public static OpenVR.IVRSettings VRSettings;
@Shadow @Nullable public static OpenVR.IVRApplications VRApplications;
@Shadow @Nullable public static OpenVR.IVRTrackedCamera VRTrackedCamera;
@Shadow @Nullable public static OpenVR.IVRScreenshots VRScreenshots;
@Shadow @Nullable public static OpenVR.IVRDriverManager VRDriverManager;
@Shadow @Nullable public static OpenVR.IVRInput VRInput;
@Shadow @Nullable public static OpenVR.IVRIOBuffer VRIOBuffer;
@Shadow @Nullable public static OpenVR.IVRSpatialAnchors VRSpatialAnchors;
@Shadow @Nullable public static OpenVR.IVRDebug VRDebug;
@Shadow @Nullable public static OpenVR.IVRNotifications VRNotifications;
@Shadow private static int token;

@Shadow
@Nullable
private static <T> T getGenericInterface(String interfaceNameVersion, LongFunction<T> supplier) {
return null;
}

/**
* @author
* @reason
*/
@Overwrite
public static void create(int tok) {
token = tok;

VRSystem = getGenericInterface(IVRSystem_Version, OpenVR.IVRSystem::new);
VRChaperone = getGenericInterface(IVRChaperone_Version, OpenVR.IVRChaperone::new);
VRChaperoneSetup = getGenericInterface(IVRChaperoneSetup_Version, OpenVR.IVRChaperoneSetup::new);
VRCompositor = getGenericInterface(IVRCompositor_Version, OpenVR.IVRCompositor::new);
VROverlay = getGenericInterface(IVROverlay_Version, OpenVR.IVROverlay::new);
// VRResources = getGenericInterface(IVRResources_Version, OpenVR.IVRResources::new);
VRRenderModels = getGenericInterface(IVRRenderModels_Version, OpenVR.IVRRenderModels::new);
VRExtendedDisplay = getGenericInterface(IVRExtendedDisplay_Version, OpenVR.IVRExtendedDisplay::new);
VRSettings = getGenericInterface(IVRSettings_Version, OpenVR.IVRSettings::new);
VRApplications = getGenericInterface(IVRApplications_Version, OpenVR.IVRApplications::new);
// VRTrackedCamera = getGenericInterface(IVRTrackedCamera_Version, OpenVR.IVRTrackedCamera::new);
VRScreenshots = getGenericInterface(IVRScreenshots_Version, OpenVR.IVRScreenshots::new);
// VRDriverManager = getGenericInterface(IVRDriverManager_Version, OpenVR.IVRDriverManager::new);
VRInput = getGenericInterface(IVRInput_Version, OpenVR.IVRInput::new);
// VRIOBuffer = getGenericInterface(IVRIOBuffer_Version, OpenVR.IVRIOBuffer::new);
// VRSpatialAnchors = getGenericInterface(IVRSpatialAnchors_Version, OpenVR.IVRSpatialAnchors::new);
// VRDebug = getGenericInterface(IVRDebug_Version, OpenVR.IVRDebug::new);
// VRNotifications = getGenericInterface(IVRNotifications_Version, OpenVR.IVRNotifications::new);
}
}
3 changes: 2 additions & 1 deletion common/src/main/resources/vivecraft.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"client_vr.world.PotionItemVRMixin",
"client_vr.world.entity.projectile.FireworkRocketEntityVRMixin",
"client_vr.world.entity.player.PlayerVRMixin",
"client_vr.world.level.biome.BiomeAccessor"
"client_vr.world.level.biome.BiomeAccessor",
"client_vr.OpenVRMixin"
],
"minVersion": "0.8.4",
"mixins": [
Expand Down

0 comments on commit 93cc582

Please sign in to comment.