diff --git a/build.gradle b/build.gradle index 566ce598f6..45e9d5bfbf 100644 --- a/build.gradle +++ b/build.gradle @@ -59,6 +59,7 @@ dependencies { //modCompileOnly "maven.modrinth:rubidium:0.2.12" modCompileOnly "me.jellysquid.mods:Rubidium:0.2.13" modCompileOnly "curse.maven:epic-fight-mod-405076:4029362" + modCompileOnly "curse.maven:pixelmon-389487:4718641" implementation fileTree(include: ['*.jar'], dir: 'libs') toJar fileTree(include: ['antlr4-runtime-4.10.1.jar', 'glsl-transformer-1.0.0-pre21.2.jar'], dir: 'libs') diff --git a/src/main/java/net/coderbot/iris/mixin/compat/pixelmon/MixinNormalizedFace.java b/src/main/java/net/coderbot/iris/mixin/compat/pixelmon/MixinNormalizedFace.java new file mode 100644 index 0000000000..f6df24344d --- /dev/null +++ b/src/main/java/net/coderbot/iris/mixin/compat/pixelmon/MixinNormalizedFace.java @@ -0,0 +1,51 @@ +package net.coderbot.iris.mixin.compat.pixelmon; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Matrix3f; +import com.mojang.math.Matrix4f; +import com.pixelmonmod.pixelmon.client.models.smd.DeformVertex; +import com.pixelmonmod.pixelmon.client.models.smd.NormalizedFace; +import com.pixelmonmod.pixelmon.client.models.smd.TextureCoordinate; +import com.pixelmonmod.pixelmon.client.models.smd.Vertex; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(NormalizedFace.class) +public class MixinNormalizedFace { + + @Shadow + public DeformVertex[] vertices; + + @Shadow + public TextureCoordinate[] textureCoordinates; + + @Shadow + public Vertex faceNormal; + + @Shadow + public Vertex calculateFaceNormal() { + return null; + } + + @Overwrite + public void addFaceForRender(PoseStack matrixStack, VertexConsumer bufferBuilder, int packedLight, int packedOverlay, boolean smoothShading, float partialTick, float r, float g, float b, float a) { + if (!smoothShading && + this.faceNormal == null) + this.faceNormal = calculateFaceNormal(); + for (int i = 0; i < 3; i++) { + Matrix4f pose = matrixStack.last().pose(); + Matrix3f normal = matrixStack.last().normal(); + bufferBuilder.vertex(pose.m00 * this.vertices[i] + .getX(partialTick) + pose.m01 * this.vertices[i].getY(partialTick) + pose.m02 * this.vertices[i].getZ(partialTick) + pose.m03, pose.m10 * this.vertices[i] + .getX(partialTick) + pose.m11 * this.vertices[i].getY(partialTick) + pose.m12 * this.vertices[i].getZ(partialTick) + pose.m13, pose.m20 * this.vertices[i] + .getX(partialTick) + pose.m21 * this.vertices[i].getY(partialTick) + pose.m22 * this.vertices[i].getZ(partialTick) + pose.m23, r, g, b, a, (this.textureCoordinates[i]).u, (this.textureCoordinates[i]).v, packedOverlay, packedLight, normal.m00 * this.vertices[i] + + .getXN(partialTick) + normal.m01 * this.vertices[i].getYN(partialTick) + normal.m02 * this.vertices[i].getZN(partialTick), normal.m10 * this.vertices[i] + .getXN(partialTick) + normal.m11 * this.vertices[i].getYN(partialTick) + normal.m12 * this.vertices[i].getZN(partialTick), normal.m20 * this.vertices[i] + .getXN(partialTick) + normal.m21 * this.vertices[i].getYN(partialTick) + normal.m22 * this.vertices[i].getZN(partialTick)); + } + } + +} diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 261158abfe..8fcf9759ea 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -7,4 +7,27 @@ public com.mojang.blaze3d.platform.GlStateManager$DepthState public net.minecraft.client.renderer.texture.Stitcher$Holder public net.minecraft.client.renderer.WorldRenderer$LocalRenderInformationContainer public net.minecraft.client.renderer.WorldRenderer field_228415_m_ # renderBuffers -public-f net.minecraft.client.renderer.texture.TextureAtlasSprite$Info \ No newline at end of file +public-f net.minecraft.client.renderer.texture.TextureAtlasSprite$Info + +public net.minecraft.util.math.vector.Matrix4f field_226575_a_ # m00 +public net.minecraft.util.math.vector.Matrix4f field_226576_b_ # m01 +public net.minecraft.util.math.vector.Matrix4f field_226577_c_ # m02 +public net.minecraft.util.math.vector.Matrix4f field_226578_d_ # m03 +public net.minecraft.util.math.vector.Matrix4f field_226579_e_ # m10 +public net.minecraft.util.math.vector.Matrix4f field_226580_f_ # m11 +public net.minecraft.util.math.vector.Matrix4f field_226581_g_ # m12 +public net.minecraft.util.math.vector.Matrix4f field_226582_h_ # m13 +public net.minecraft.util.math.vector.Matrix4f field_226583_i_ # m20 +public net.minecraft.util.math.vector.Matrix4f field_226584_j_ # m21 +public net.minecraft.util.math.vector.Matrix4f field_226585_k_ # m22 +public net.minecraft.util.math.vector.Matrix4f field_226586_l_ # m23 + +public net.minecraft.util.math.vector.Matrix3f field_226097_a_ # m00 +public net.minecraft.util.math.vector.Matrix3f field_226098_b_ # m01 +public net.minecraft.util.math.vector.Matrix3f field_226099_c_ # m02 +public net.minecraft.util.math.vector.Matrix3f field_226100_d_ # m10 +public net.minecraft.util.math.vector.Matrix3f field_226101_e_ # m11 +public net.minecraft.util.math.vector.Matrix3f field_226102_f_ # m12 +public net.minecraft.util.math.vector.Matrix3f field_226103_g_ # m20 +public net.minecraft.util.math.vector.Matrix3f field_226104_h_ # m21 +public net.minecraft.util.math.vector.Matrix3f field_226105_i_ # m22 \ No newline at end of file diff --git a/src/main/resources/mixins.oculus.compat.json b/src/main/resources/mixins.oculus.compat.json index cf7beb827f..ded45ebf41 100644 --- a/src/main/resources/mixins.oculus.compat.json +++ b/src/main/resources/mixins.oculus.compat.json @@ -6,7 +6,8 @@ "refmap": "oculus-refmap.json", "compatibilityLevel": "JAVA_8", "client": [ - "epicfight.MixinEpicFightRenderTypes" + "epicfight.MixinEpicFightRenderTypes", + "pixelmon.MixinNormalizedFace" ], "injectors": { "defaultRequire": 1