diff --git a/build.gradle b/build.gradle index df41bd2182..cc1dfac7a4 100644 --- a/build.gradle +++ b/build.gradle @@ -19,9 +19,7 @@ loom { "oculus-batched-entity-rendering.mixins.json", "mixins.oculus.compat.sodium.json", "mixins.oculus.compat.indigo.json", - "mixins.oculus.compat.dh.json", - "mixins.oculus.compat.indium.json", - "mixins.oculus.compat.pixelmon.json" + "mixins.oculus.compat.indium.json" ] } mixin.defaultRefmapName = "oculus-mixins-refmap.json" @@ -106,7 +104,7 @@ dependencies { forge "net.neoforged:forge:${minecraft_version}-${forge_version}" modImplementation "org.embeddedt:embeddium-${minecraft_version}:${embeddium_version}" - compileOnly "maven.modrinth:distanthorizons:2.0.1-a-1.20.1" + modCompileOnly(files("DHApi.jar")) forgeRuntimeLibrary(implementation(shadow(project(path: ":glsl-relocated", configuration: "bundledJar")))) { transitive = false diff --git a/glsl-relocated/build.gradle b/glsl-relocated/build.gradle index 4da4be0e7d..5ffd536953 100644 --- a/glsl-relocated/build.gradle +++ b/glsl-relocated/build.gradle @@ -8,7 +8,7 @@ repositories { } dependencies { - implementation(shadow("io.github.douira:glsl-transformer:2.0.0")) { + implementation(shadow("io.github.douira:glsl-transformer:2.0.0-pre13")) { exclude module: "antlr4" // we only want to shadow the runtime module } implementation shadow("org.antlr:antlr4-runtime:4.11.1") diff --git a/gradle.properties b/gradle.properties index 683c5d6b27..d3886d84db 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,12 +6,12 @@ loom.platform = forge # Fabric Properties # check these on https://fabricmc.net/develop minecraft_version=1.20.1 - forge_version=47.1.84 + forge_version=47.1.105 # Mod Properties - mod_version = 1.6.15a + mod_version = 1.7.0 maven_group = net.coderbot archives_base_name = oculus # Dependencies - embeddium_version=0.3.1-git.458247a+mc1.20.1 + embeddium_version=0.3.14-git.8af1729+mc1.20.1 diff --git a/src/main/java/net/irisshaders/iris/compat/dh/DHCompat.java b/src/main/java/net/irisshaders/iris/compat/dh/DHCompat.java index 042a2e3d63..b062136cfb 100644 --- a/src/main/java/net/irisshaders/iris/compat/dh/DHCompat.java +++ b/src/main/java/net/irisshaders/iris/compat/dh/DHCompat.java @@ -1,11 +1,11 @@ package net.irisshaders.iris.compat.dh; -import net.fabricmc.loader.api.FabricLoader; import net.irisshaders.iris.Iris; import net.irisshaders.iris.gl.shader.ShaderCompileException; import net.irisshaders.iris.pipeline.IrisRenderingPipeline; import net.irisshaders.iris.uniforms.CapturedRenderingState; import net.minecraft.client.Minecraft; +import net.minecraftforge.fml.loading.LoadingModList; import org.joml.Matrix4f; import java.lang.invoke.MethodHandle; @@ -57,7 +57,7 @@ public static Matrix4f getProjection() { public static void run() { try { - if (FabricLoader.getInstance().isModLoaded("distanthorizons")) { + if (LoadingModList.get().getModFileById("distanthorizons") != null) { deletePipeline = MethodHandles.lookup().findVirtual(Class.forName("net.irisshaders.iris.compat.dh.DHCompatInternal"), "clear", MethodType.methodType(void.class)); setupEventHandlers = MethodHandles.lookup().findStatic(Class.forName("net.irisshaders.iris.compat.dh.LodRendererEvents"), "setupEventHandlers", MethodType.methodType(void.class)); getDepthTex = MethodHandles.lookup().findVirtual(Class.forName("net.irisshaders.iris.compat.dh.DHCompatInternal"), "getStoredDepthTex", MethodType.methodType(int.class)); @@ -75,7 +75,7 @@ public static void run() { } catch (Throwable e) { dhPresent = false; - if (FabricLoader.getInstance().isModLoaded("distanthorizons")) { + if (LoadingModList.get().getModFileById("distanthorizons") != null) { if (e instanceof ExceptionInInitializerError eiie) { throw new RuntimeException("Failure loading DH compat.", eiie.getCause()); } else { diff --git a/src/main/java/net/irisshaders/iris/gl/shader/StandardMacros.java b/src/main/java/net/irisshaders/iris/gl/shader/StandardMacros.java index c1e164a907..f6f9d918be 100644 --- a/src/main/java/net/irisshaders/iris/gl/shader/StandardMacros.java +++ b/src/main/java/net/irisshaders/iris/gl/shader/StandardMacros.java @@ -3,7 +3,6 @@ import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlUtil; -import net.fabricmc.loader.api.FabricLoader; import net.irisshaders.iris.Iris; import net.irisshaders.iris.compat.dh.DHCompat; import net.irisshaders.iris.helpers.StringPair; @@ -12,6 +11,7 @@ import net.irisshaders.iris.texture.format.TextureFormat; import net.irisshaders.iris.texture.format.TextureFormatLoader; import net.minecraft.Util; +import net.minecraftforge.fml.loading.LoadingModList; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL20C; import org.lwjgl.opengl.GL30C; @@ -51,7 +51,7 @@ public static ImmutableList createStandardEnvironmentDefines() { define(standardDefines, "IS_IRIS"); - if (FabricLoader.getInstance().isModLoaded("distanthorizons") && DHCompat.hasRenderingEnabled()) { + if (LoadingModList.get().getModFileById("distanthorizons") != null && DHCompat.hasRenderingEnabled()) { define(standardDefines, "DISTANT_HORIZONS"); } diff --git a/src/main/java/net/irisshaders/iris/mixin/vertices/block_rendering/MixinClientLevel.java b/src/main/java/net/irisshaders/iris/mixin/vertices/block_rendering/MixinClientLevel.java index e69409f7b4..64e72e5ef6 100644 --- a/src/main/java/net/irisshaders/iris/mixin/vertices/block_rendering/MixinClientLevel.java +++ b/src/main/java/net/irisshaders/iris/mixin/vertices/block_rendering/MixinClientLevel.java @@ -23,7 +23,7 @@ public class MixinClientLevel { @ModifyVariable(method = "getShade(FFFZ)F", at = @At("HEAD"), argsOnly = true, remap = false) private boolean iris$maybeDisableDirectionalShadingForge(boolean shaded) { - if (BlockRenderingSettings.INSTANCE.shouldDisableDirectionalShading()) { + if (WorldRenderingSettings.INSTANCE.shouldDisableDirectionalShading()) { return false; } else { return shaded; diff --git a/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderCreator.java b/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderCreator.java index f61a5394a1..9553757092 100644 --- a/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderCreator.java +++ b/src/main/java/net/irisshaders/iris/pipeline/programs/ShaderCreator.java @@ -4,7 +4,6 @@ import com.google.common.primitives.Ints; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.VertexFormat; -import net.fabricmc.loader.api.FabricLoader; import net.irisshaders.iris.gl.blending.AlphaTest; import net.irisshaders.iris.gl.blending.BlendModeOverride; import net.irisshaders.iris.gl.blending.BufferBlendOverride; @@ -28,6 +27,7 @@ import net.minecraft.server.packs.PathPackResources; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceProvider; +import net.minecraftforge.fml.loading.FMLPaths; import org.apache.commons.io.IOUtils; import java.io.ByteArrayInputStream; @@ -217,7 +217,7 @@ private static class StringResource extends Resource { private final String content; private StringResource(ResourceLocation id, String content) { - super(new PathPackResources("", FabricLoader.getInstance().getConfigDir(), true), () -> new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))); + super(new PathPackResources("", FMLPaths.CONFIGDIR.get(), true), () -> new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))); this.content = content; } diff --git a/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java b/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java index f410a00f54..bc62cee8b7 100644 --- a/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java +++ b/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java @@ -8,7 +8,6 @@ import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import net.fabricmc.loader.api.FabricLoader; import net.irisshaders.iris.Iris; import net.irisshaders.iris.helpers.StringPair; import net.irisshaders.iris.pipeline.transform.ShaderPrinter; @@ -19,6 +18,7 @@ import net.irisshaders.iris.shaderpack.option.OrderBackedProperties; import net.irisshaders.iris.shaderpack.option.ShaderPackOptions; import net.irisshaders.iris.shaderpack.preprocessor.PropertiesPreprocessor; +import net.minecraftforge.fml.loading.FMLPaths; import java.io.IOException; import java.io.OutputStream; @@ -115,7 +115,7 @@ private static Optional loadProperties(Path shaderPath, String name, if (Iris.getIrisConfig().areDebugOptionsEnabled()) { ShaderPrinter.deleteIfClearing(); - try (OutputStream os = Files.newOutputStream(FabricLoader.getInstance().getGameDir().resolve("patched_shaders").resolve(name))) { + try (OutputStream os = Files.newOutputStream(FMLPaths.GAMEDIR.get().resolve("patched_shaders").resolve(name))) { properties.store(new OutputStreamWriter(os, StandardCharsets.UTF_8), "Patched version of properties"); } catch (IOException e) { throw new RuntimeException(e); diff --git a/src/main/java/net/irisshaders/iris/texture/pbr/loader/AtlasPBRLoader.java b/src/main/java/net/irisshaders/iris/texture/pbr/loader/AtlasPBRLoader.java index c0e895cf2d..d450bdbe2e 100644 --- a/src/main/java/net/irisshaders/iris/texture/pbr/loader/AtlasPBRLoader.java +++ b/src/main/java/net/irisshaders/iris/texture/pbr/loader/AtlasPBRLoader.java @@ -22,6 +22,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.Resource; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.ResourceMetadata; import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; @@ -31,10 +32,10 @@ public class AtlasPBRLoader implements PBRTextureLoader { public static final ChannelMipmapGenerator LINEAR_MIPMAP_GENERATOR = new ChannelMipmapGenerator( - LinearBlendFunction.INSTANCE, - LinearBlendFunction.INSTANCE, - LinearBlendFunction.INSTANCE, - LinearBlendFunction.INSTANCE + LinearBlendFunction.INSTANCE, + LinearBlendFunction.INSTANCE, + LinearBlendFunction.INSTANCE, + LinearBlendFunction.INSTANCE ); @Override @@ -90,9 +91,9 @@ protected PBRTextureAtlasSprite createPBRSprite(TextureAtlasSprite sprite, Resou } Resource resource = optionalResource.get(); - AnimationMetadataSection animationMetadata; + ResourceMetadata animationMetadata; try { - animationMetadata = resource.metadata().getSection(AnimationMetadataSection.SERIALIZER).orElse(AnimationMetadataSection.EMPTY); + animationMetadata = resource.metadata(); } catch (Exception e) { Iris.logger.error("Unable to parse metadata from {}", pbrImageLocation, e); return null; @@ -108,7 +109,8 @@ protected PBRTextureAtlasSprite createPBRSprite(TextureAtlasSprite sprite, Resou int imageWidth = nativeImage.getWidth(); int imageHeight = nativeImage.getHeight(); - FrameSize frameSize = animationMetadata.calculateFrameSize(imageWidth, imageHeight); + AnimationMetadataSection metadataSection = animationMetadata.getSection(AnimationMetadataSection.SERIALIZER).orElse(AnimationMetadataSection.EMPTY); + FrameSize frameSize = metadataSection.calculateFrameSize(imageWidth, imageHeight); int frameWidth = frameSize.width(); int frameHeight = frameSize.height(); if (!Mth.isMultipleOf(imageWidth, frameWidth) || !Mth.isMultipleOf(imageHeight, frameHeight)) { @@ -120,33 +122,38 @@ protected PBRTextureAtlasSprite createPBRSprite(TextureAtlasSprite sprite, Resou int targetFrameWidth = sprite.contents().width(); int targetFrameHeight = sprite.contents().height(); if (frameWidth != targetFrameWidth || frameHeight != targetFrameHeight) { - // We can assume the following is always true: - // imageWidth % frameWidth == 0 && imageHeight % frameHeight == 0 - int targetImageWidth = imageWidth / frameWidth * targetFrameWidth; - int targetImageHeight = imageHeight / frameHeight * targetFrameHeight; - - NativeImage scaledImage; - if (targetImageWidth % imageWidth == 0 && targetImageHeight % imageHeight == 0) { - scaledImage = ImageManipulationUtil.scaleNearestNeighbor(nativeImage, targetImageWidth, targetImageHeight); - } else { - scaledImage = ImageManipulationUtil.scaleBilinear(nativeImage, targetImageWidth, targetImageHeight); - } - nativeImage.close(); - nativeImage = scaledImage; - - frameWidth = targetFrameWidth; - frameHeight = targetFrameHeight; - - if (animationMetadata != AnimationMetadataSection.EMPTY) { - AnimationMetadataSectionAccessor animationAccessor = (AnimationMetadataSectionAccessor) animationMetadata; - int internalFrameWidth = animationAccessor.getFrameWidth(); - int internalFrameHeight = animationAccessor.getFrameHeight(); - if (internalFrameWidth != -1) { - animationAccessor.setFrameWidth(frameWidth); + try { + // We can assume the following is always true: + // imageWidth % frameWidth == 0 && imageHeight % frameHeight == 0 + int targetImageWidth = imageWidth / frameWidth * targetFrameWidth; + int targetImageHeight = imageHeight / frameHeight * targetFrameHeight; + + NativeImage scaledImage; + if (targetImageWidth % imageWidth == 0 && targetImageHeight % imageHeight == 0) { + scaledImage = ImageManipulationUtil.scaleNearestNeighbor(nativeImage, targetImageWidth, targetImageHeight); + } else { + scaledImage = ImageManipulationUtil.scaleBilinear(nativeImage, targetImageWidth, targetImageHeight); } - if (internalFrameHeight != -1) { - animationAccessor.setFrameHeight(frameHeight); + nativeImage.close(); + nativeImage = scaledImage; + + frameWidth = targetFrameWidth; + frameHeight = targetFrameHeight; + + if (metadataSection != AnimationMetadataSection.EMPTY) { + AnimationMetadataSectionAccessor animationAccessor = (AnimationMetadataSectionAccessor) metadataSection; + int internalFrameWidth = animationAccessor.getFrameWidth(); + int internalFrameHeight = animationAccessor.getFrameHeight(); + if (internalFrameWidth != -1) { + animationAccessor.setFrameWidth(frameWidth); + } + if (internalFrameHeight != -1) { + animationAccessor.setFrameHeight(frameHeight); + } } + } catch (Exception e) { + Iris.logger.error("Something bad happened trying to load PBR texture " + spriteName.getPath() + pbrType.getSuffix() + "!", e); + throw e; } } diff --git a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/copyEntity/CuboidMixin.java b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/copyEntity/CuboidMixin.java index f26634680a..ebd96a3551 100644 --- a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/copyEntity/CuboidMixin.java +++ b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/copyEntity/CuboidMixin.java @@ -5,10 +5,10 @@ import net.minecraft.client.model.geom.ModelPart; import net.minecraft.core.Direction; import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Set; @@ -18,10 +18,17 @@ public class CuboidMixin implements ModelCuboidAccessor { @Unique private ModelCuboid sodium$cuboid; + @Mutable + @Shadow + @Final + private float minX; + // Inject at the start of the function, so we don't capture modified locals - @Inject(method = "", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/model/geom/ModelPart$Cube;polygons:[Lnet/minecraft/client/model/geom/ModelPart$Polygon;", ordinal = 0)) - private void onInit(int u, int v, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float extraX, float extraY, float extraZ, boolean mirror, float textureWidth, float textureHeight, Set renderDirections, CallbackInfo ci) { + @Redirect(method = "", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/model/geom/ModelPart$Cube;minX:F", ordinal = 0)) + private void onInit(ModelPart.Cube instance, float value, int u, int v, float x, float y, float z, float sizeX, float sizeY, float sizeZ, float extraX, float extraY, float extraZ, boolean mirror, float textureWidth, float textureHeight, Set renderDirections) { this.sodium$cuboid = new ModelCuboid(u, v, x, y, z, sizeX, sizeY, sizeZ, extraX, extraY, extraZ, mirror, textureWidth, textureHeight, renderDirections); + + this.minX = value; } @Override diff --git a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java index d2a95bc673..983fa1dd8f 100644 --- a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java +++ b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java @@ -21,7 +21,7 @@ public class MixinRenderSectionManager { @Unique private @NotNull SortedRenderLists shadowRenderLists = SortedRenderLists.empty(); - @Redirect(method = "createTerrainRenderList", at = @At(value = "FIELD", target = "Lme/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager;renderLists:Lme/jellysquid/mods/sodium/client/render/chunk/lists/SortedRenderLists;")) + @Redirect(method = "createTerrainRenderList", remap = false, at = @At(value = "FIELD", target = "Lme/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager;renderLists:Lme/jellysquid/mods/sodium/client/render/chunk/lists/SortedRenderLists;")) private void useShadowRenderList(RenderSectionManager instance, SortedRenderLists value) { if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) { shadowRenderLists = value; @@ -30,7 +30,7 @@ private void useShadowRenderList(RenderSectionManager instance, SortedRenderList } } - @Inject(method = "update", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager;createTerrainRenderList(Lnet/minecraft/client/Camera;Lme/jellysquid/mods/sodium/client/render/viewport/Viewport;IZ)V", shift = At.Shift.AFTER), cancellable = true) + @Inject(method = "update", remap = false, at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager;createTerrainRenderList(Lnet/minecraft/client/Camera;Lme/jellysquid/mods/sodium/client/render/viewport/Viewport;IZ)V", shift = At.Shift.AFTER), cancellable = true) private void cancelIfShadow(Camera camera, Viewport viewport, int frame, boolean spectator, CallbackInfo ci) { if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) ci.cancel(); } diff --git a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinSodiumWorldRenderer.java b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinSodiumWorldRenderer.java index 946fb95051..539c6986ef 100644 --- a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinSodiumWorldRenderer.java +++ b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinSodiumWorldRenderer.java @@ -55,12 +55,12 @@ private static void renderBlockEntity(PoseStack matrices, RenderBuffers bufferBu throw new IllegalStateException("maybe get Mixin?"); } - @Inject(method = "renderBlockEntities(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;)V", at = @At("HEAD")) + @Inject(remap = false, method = "renderBlockEntities(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;)V", at = @At("HEAD")) private void resetEntityList(PoseStack matrices, RenderBuffers bufferBuilders, Long2ObjectMap> blockBreakingProgressions, float tickDelta, MultiBufferSource.BufferSource immediate, double x, double y, double z, BlockEntityRenderDispatcher blockEntityRenderer, CallbackInfo ci) { beList = 0; } - @Redirect(method = "renderBlockEntities(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;)V", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/SodiumWorldRenderer;renderBlockEntity(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;Lnet/minecraft/world/level/block/entity/BlockEntity;)V")) + @Redirect(remap = false, method = "renderBlockEntities(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;)V", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/SodiumWorldRenderer;renderBlockEntity(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;Lnet/minecraft/world/level/block/entity/BlockEntity;)V")) private void addToList(PoseStack bufferBuilder, RenderBuffers entry, Long2ObjectMap> transformer, float stage, MultiBufferSource.BufferSource matrices, double bufferBuilders, double blockBreakingProgressions, double tickDelta, BlockEntityRenderDispatcher immediate, BlockEntity x) { if (!renderLightsOnly || x.getBlockState().getLightEmission() > 0) { renderBlockEntity(bufferBuilder, entry, transformer, stage, matrices, bufferBuilders, blockBreakingProgressions, tickDelta, immediate, x); @@ -68,7 +68,7 @@ private void addToList(PoseStack bufferBuilder, RenderBuffers entry, Long2Object } } - @Redirect(method = "renderGlobalBlockEntities", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/SodiumWorldRenderer;renderBlockEntity(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;Lnet/minecraft/world/level/block/entity/BlockEntity;)V")) + @Redirect(remap = false, method = "renderGlobalBlockEntities", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/SodiumWorldRenderer;renderBlockEntity(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderBuffers;Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;FLnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDDLnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;Lnet/minecraft/world/level/block/entity/BlockEntity;)V")) private void addToList2(PoseStack bufferBuilder, RenderBuffers entry, Long2ObjectMap> transformer, float stage, MultiBufferSource.BufferSource matrices, double bufferBuilders, double blockBreakingProgressions, double tickDelta, BlockEntityRenderDispatcher immediate, BlockEntity x) { if (!renderLightsOnly || x.getBlockState().getLightEmission() > 0) { renderBlockEntity(bufferBuilder, entry, transformer, stage, matrices, bufferBuilders, blockBreakingProgressions, tickDelta, immediate, x); @@ -76,7 +76,7 @@ private void addToList2(PoseStack bufferBuilder, RenderBuffers entry, Long2Objec } } - @Inject(method = "isEntityVisible", at = @At("HEAD"), cancellable = true) + @Inject(remap = false, method = "isEntityVisible", at = @At("HEAD"), cancellable = true) private void iris$overrideEntityCulling(Entity entity, CallbackInfoReturnable cir) { if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) cir.setReturnValue(true); } diff --git a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinRegionChunkRenderer.java b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinRegionChunkRenderer.java index c00e22683d..648d2c6970 100644 --- a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinRegionChunkRenderer.java +++ b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinRegionChunkRenderer.java @@ -22,33 +22,30 @@ public MixinRegionChunkRenderer(RenderDevice device, ChunkVertexType vertexType) } @Redirect(remap = false, method = "createRegionTessellation", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/gl/tessellation/TessellationBinding;forVertexBuffer(Lme/jellysquid/mods/sodium/client/gl/buffer/GlBuffer;[Lme/jellysquid/mods/sodium/client/gl/attribute/GlVertexAttributeBinding;)Lme/jellysquid/mods/sodium/client/gl/tessellation/TessellationBinding;")) - @SuppressWarnings({"rawtypes", "unchecked"}) private TessellationBinding iris$onInit(GlBuffer buffer, GlVertexAttributeBinding[] attributes) { if (!WorldRenderingSettings.INSTANCE.shouldUseExtendedVertexFormat()) { return TessellationBinding.forVertexBuffer(buffer, attributes); } - GlVertexFormat vertexFormat = this.vertexFormat; - attributes = new GlVertexAttributeBinding[]{ - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_POSITION_ID, - vertexFormat.getAttribute(ChunkMeshAttribute.POSITION_MATERIAL_MESH)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_COLOR, - vertexFormat.getAttribute(ChunkMeshAttribute.COLOR_SHADE)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_BLOCK_TEXTURE, - vertexFormat.getAttribute(ChunkMeshAttribute.BLOCK_TEXTURE)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_LIGHT_TEXTURE, - vertexFormat.getAttribute(ChunkMeshAttribute.LIGHT_TEXTURE)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.MID_BLOCK, - vertexFormat.getAttribute(IrisChunkMeshAttributes.MID_BLOCK)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.BLOCK_ID, - vertexFormat.getAttribute(IrisChunkMeshAttributes.BLOCK_ID)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.MID_TEX_COORD, - vertexFormat.getAttribute(IrisChunkMeshAttributes.MID_TEX_COORD)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.TANGENT, - vertexFormat.getAttribute(IrisChunkMeshAttributes.TANGENT)), - new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.NORMAL, - vertexFormat.getAttribute(IrisChunkMeshAttributes.NORMAL)) + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_POSITION_ID, + vertexFormat.getAttribute(ChunkMeshAttribute.POSITION_MATERIAL_MESH)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_COLOR, + vertexFormat.getAttribute(ChunkMeshAttribute.COLOR_SHADE)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_BLOCK_TEXTURE, + vertexFormat.getAttribute(ChunkMeshAttribute.BLOCK_TEXTURE)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.ATTRIBUTE_LIGHT_TEXTURE, + vertexFormat.getAttribute(ChunkMeshAttribute.LIGHT_TEXTURE)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.MID_BLOCK, + vertexFormat.getAttribute(IrisChunkMeshAttributes.MID_BLOCK)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.BLOCK_ID, + vertexFormat.getAttribute(IrisChunkMeshAttributes.BLOCK_ID)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.MID_TEX_COORD, + vertexFormat.getAttribute(IrisChunkMeshAttributes.MID_TEX_COORD)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.TANGENT, + vertexFormat.getAttribute(IrisChunkMeshAttributes.TANGENT)), + new GlVertexAttributeBinding(IrisChunkShaderBindingPoints.NORMAL, + vertexFormat.getAttribute(IrisChunkMeshAttributes.NORMAL)) }; return TessellationBinding.forVertexBuffer(buffer, attributes); diff --git a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinVertexFormatDescriptionImpl.java b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinVertexFormatDescriptionImpl.java index 38ec05c089..e8b8c20d77 100644 --- a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinVertexFormatDescriptionImpl.java +++ b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/MixinVertexFormatDescriptionImpl.java @@ -11,7 +11,7 @@ @Mixin(VertexFormatDescriptionImpl.class) public class MixinVertexFormatDescriptionImpl { // A better fix would be to treat IrisVertexFormats.PADDING_SHORT as padding, but this works too. - @Inject(method = "checkSimple", at = @At("HEAD"), cancellable = true) + @Inject(remap = false, method = "checkSimple", at = @At("HEAD"), cancellable = true) private static void iris$forceSimple(VertexFormat format, CallbackInfoReturnable cir) { if (format == IrisVertexFormats.TERRAIN || format == IrisVertexFormats.ENTITY || format == IrisVertexFormats.GLYPH) { cir.setReturnValue(true); diff --git a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/entity/MixinModelVertex.java b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/entity/MixinModelVertex.java index 54229d4780..93d7e3f046 100644 --- a/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/entity/MixinModelVertex.java +++ b/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/vertex_format/entity/MixinModelVertex.java @@ -17,13 +17,15 @@ import org.lwjgl.system.MemoryStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(BakedModelEncoder.class) public class MixinModelVertex { - @Shadow private static int mergeNormalAndMult(int packed, int calc, Matrix3f matNormal) { + @Shadow + private static int mergeNormalAndMult(int packed, int calc, Matrix3f matNormal) { throw new AssertionError(); }