Skip to content

Commit

Permalink
1.19.2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fayer3 committed Jan 26, 2025
1 parent f2d7fdd commit 8fac17b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static Vec3 toMcVec3(Vector3f v) {
/**
* @return {@code m} as a Minecraft Matrix4f
*/
public static com.mojang.math.Matrix4f toMcMat4(Matrix4f m) {
public static com.mojang.math.Matrix4f toMcMat4(Matrix4fc m) {
com.mojang.math.Matrix4f mcMat = new com.mojang.math.Matrix4f();
mcMat.m00 = m.m00();
mcMat.m01 = m.m10();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.vivecraft.common.utils.MathUtils;
import org.vivecraft.mod_compat_vr.shaders.ShadersHelper;

import java.util.function.Supplier;
Expand All @@ -25,9 +26,12 @@ public class IrisCommonUniformsMixin {
for (Triple<String, ShadersHelper.UniformType, Supplier<?>> uniform : ShadersHelper.getUniforms()) {
switch (uniform.getMiddle()) {
case MATRIX4F -> uniforms.uniformMatrix(UniformUpdateFrequency.PER_FRAME, uniform.getLeft(),
() -> (Matrix4fc) uniform.getRight().get());
() -> MathUtils.toMcMat4((Matrix4fc) uniform.getRight().get()));
case VECTOR3F -> uniforms.uniform3f(UniformUpdateFrequency.PER_FRAME, uniform.getLeft(),
() -> (Vector3f) uniform.getRight().get());
() -> {
Vector3f v = (Vector3f) uniform.getRight().get();
return new net.coderbot.iris.vendored.joml.Vector3f(v.x, v.y, v.z);
});
case INTEGER -> uniforms.uniform1i(UniformUpdateFrequency.PER_FRAME, uniform.getLeft(),
() -> (int) uniform.getRight().get());
case BOOLEAN -> uniforms.uniform1b(UniformUpdateFrequency.PER_FRAME, uniform.getLeft(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
import net.fabricmc.fabric.api.entity.FakePlayer;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.ClientBrandRetriever;
Expand Down Expand Up @@ -153,6 +152,6 @@ public static int getKeyModifierKey(KeyMapping keyMapping) {
}

public static boolean isFakePlayer(ServerPlayer player) {
return isModLoaded("fabric-events-interaction-v0") && player instanceof FakePlayer;
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.coderbot.iris.gl.uniform;

import org.joml.Matrix4fc;
import org.joml.Vector3f;
import com.mojang.math.Matrix4f;
import net.coderbot.iris.vendored.joml.Vector3f;

import java.util.function.BooleanSupplier;
import java.util.function.IntSupplier;
Expand All @@ -15,5 +15,5 @@ public interface UniformHolder {

UniformHolder uniform3f(UniformUpdateFrequency updateFrequency, String name, Supplier<Vector3f> value);

UniformHolder uniformMatrix(UniformUpdateFrequency updateFrequency, String name, Supplier<Matrix4fc> value);
UniformHolder uniformMatrix(UniformUpdateFrequency updateFrequency, String name, Supplier<Matrix4f> value);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package net.coderbot.iris.vendored.joml;

public class Vector3f {
public Vector3f(float x, float y, float z) {}
}

0 comments on commit 8fac17b

Please sign in to comment.