fix sodium compat

This commit is contained in:
QuImUfu 2024-10-11 20:57:23 +02:00
parent 7aefd13755
commit a9ce715750
2 changed files with 11 additions and 10 deletions

View File

@ -66,7 +66,7 @@ dependencies {
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}" modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
include "maven.modrinth:midnightlib:${project.midnightlib_version}" include "maven.modrinth:midnightlib:${project.midnightlib_version}"
modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") modImplementation("maven.modrinth:sodium:${project.sodium_version}")
} }
loom { loom {

View File

@ -31,6 +31,7 @@ public class SodiumPortalFluidRenderHandler implements VertexEater {
private int i; private int i;
private ChunkModelBuilder chunkModelBuilder; private ChunkModelBuilder chunkModelBuilder;
private Material material; private Material material;
private Vector3f rotBuffer = new Vector3f();
public SodiumPortalFluidRenderHandler() { public SodiumPortalFluidRenderHandler() {
} }
@ -62,17 +63,18 @@ public class SodiumPortalFluidRenderHandler implements VertexEater {
@Override @Override
public void drawQuad(Vector3f offset, Quaternionf rot, Direction direction) { public void drawQuad(Vector3f offset, Quaternionf rot, Direction direction) {
writeQuad(chunkModelBuilder, material, offset, quad, ModelQuadFacing.fromDirection(direction), false); writeQuad(chunkModelBuilder, material, offset, quad, rot, ModelQuadFacing.fromDirection(direction), false);
} }
private void writeQuad(ChunkModelBuilder builder, Material material, Vector3f offset, ModelQuadView quad, ModelQuadFacing facing, boolean flip) { private void writeQuad(ChunkModelBuilder builder, Material material, Vector3f offset, ModelQuadView quad, Quaternionf rot, ModelQuadFacing facing, boolean flip) {
var vertices = this.vertices; var vertices = this.vertices;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
var out = vertices[flip ? 3 - i : i]; var out = vertices[flip ? 3 - i : i];
out.x = offset.x + quad.getX(i); rot.transform(quad.getX(i), quad.getY(i), quad.getZ(i), rotBuffer);
out.y = offset.y + quad.getY(i); out.x = offset.x + rotBuffer.x;
out.z = offset.z + quad.getZ(i); out.y = offset.y + rotBuffer.y;
out.z = offset.z + rotBuffer.z;
out.color = 0xFFFFFFFF; out.color = 0xFFFFFFFF;
out.u = quad.getTexU(i); out.u = quad.getTexU(i);
out.v = quad.getTexV(i); out.v = quad.getTexV(i);
@ -90,5 +92,4 @@ public class SodiumPortalFluidRenderHandler implements VertexEater {
} }
} }