vivecraft fixes
This commit is contained in:
@@ -8,6 +8,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import static org.vivecraft.api.client.data.RenderPass.VANILLA;
|
||||||
|
|
||||||
public class ViewportSelector <T extends Viewport<?>> {
|
public class ViewportSelector <T extends Viewport<?>> {
|
||||||
public static final boolean VIVECRAFT_INSTALLED = FabricLoader.getInstance().isModLoaded("vivecraft");
|
public static final boolean VIVECRAFT_INSTALLED = FabricLoader.getInstance().isModLoaded("vivecraft");
|
||||||
|
|
||||||
@@ -25,27 +27,28 @@ public class ViewportSelector <T extends Viewport<?>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private T getVivecraftViewport() {
|
private T getVivecraftViewport() {
|
||||||
var rApi = VRRenderingAPI.instance();
|
var pass = VRRenderingAPI.instance().getCurrentRenderPass();
|
||||||
if (rApi == null) {
|
if (pass == null || pass == VANILLA) {
|
||||||
return this.defaultViewport;
|
return null;
|
||||||
}
|
|
||||||
var pass = rApi.getCurrentRenderPass();
|
|
||||||
if (pass == null) {
|
|
||||||
return this.defaultViewport;
|
|
||||||
}
|
}
|
||||||
return this.getOrCreate(pass);
|
return this.getOrCreate(pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Object IRIS_SHADOW_OBJECT = new Object();
|
private static final Object IRIS_SHADOW_OBJECT = new Object();
|
||||||
public T getViewport() {
|
public T getViewport() {
|
||||||
if (VIVECRAFT_INSTALLED) {
|
T viewport = null;
|
||||||
return getVivecraftViewport();
|
if (viewport == null && VIVECRAFT_INSTALLED) {
|
||||||
|
viewport = getVivecraftViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IrisUtil.irisShadowActive()) {
|
if (viewport == null && IrisUtil.irisShadowActive()) {
|
||||||
return this.getOrCreate(IRIS_SHADOW_OBJECT);
|
viewport = this.getOrCreate(IRIS_SHADOW_OBJECT);
|
||||||
}
|
}
|
||||||
return this.defaultViewport;
|
|
||||||
|
if (viewport == null) {
|
||||||
|
viewport = this.defaultViewport;
|
||||||
|
}
|
||||||
|
return viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void free() {
|
public void free() {
|
||||||
|
|||||||
Reference in New Issue
Block a user