From d86ae7cfe5873e4716b264f769b8b81edf06c241 Mon Sep 17 00:00:00 2001 From: yatsukiko Date: Sat, 13 Feb 2021 19:56:48 +0000 Subject: [PATCH] fix multipart not rendering - patch from HalogenMods/Chlorine --- .../shader/texture/ChunkProgramMultiTexture.java | 4 ++-- .../texture/ChunkProgramSingleTexture.java | 4 ++-- .../chunk/tasks/ChunkRenderRebuildTask.java | 2 +- .../features/block/MixinBlockModelRenderer.java | 16 ++++++++-------- .../features/model/MixinMultipartBakedModel.java | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramMultiTexture.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramMultiTexture.java index 2c6d183da4..5dae412f2b 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramMultiTexture.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramMultiTexture.java @@ -3,7 +3,7 @@ import me.jellysquid.mods.sodium.client.gl.sampler.GlSampler; import me.jellysquid.mods.sodium.client.render.chunk.shader.ChunkProgram; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.inventory.container.PlayerContainer; import net.minecraft.client.renderer.texture.Texture; import net.minecraft.client.renderer.texture.TextureManager; import org.lwjgl.opengl.GL11; @@ -43,7 +43,7 @@ public void bind() { LightmapTextureManagerAccessor lightmapTextureManager = ((LightmapTextureManagerAccessor) client.gameRenderer.getLightTexture()); - Texture blockAtlasTex = textureManager.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); + Texture blockAtlasTex = textureManager.getTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE); Texture lightTex = lightmapTextureManager.getTexture(); this.bindTexture(blockAtlasTex, ChunkProgramTextureUnit.BLOCK_ATLAS); diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramSingleTexture.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramSingleTexture.java index 637a29a89e..70a4ea4076 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramSingleTexture.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/shader/texture/ChunkProgramSingleTexture.java @@ -2,7 +2,7 @@ import me.jellysquid.mods.sodium.client.render.chunk.shader.ChunkProgram; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.AtlasTexture; +import net.minecraft.inventory.container.PlayerContainer; import org.lwjgl.opengl.GL20; public class ChunkProgramSingleTexture extends ChunkProgramTextureComponent { @@ -33,7 +33,7 @@ public void delete() { @Override public void setMipmapping(boolean mipped) { Minecraft.getInstance().getTextureManager() - .getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE) + .getTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE) .setBlurMipmapDirect(false, mipped); } } diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java index ab56e40315..b353d003f3 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/tasks/ChunkRenderRebuildTask.java @@ -111,7 +111,7 @@ public ChunkBuildResult performBuild(ChunkRenderContext pipeline, ChunkBuildB } } - if (block.isTileEntityProvider()) { + if (blockState.hasTileEntity()) { TileEntity entity = this.slice.getBlockEntity(pos, Chunk.CreateEntityType.CHECK); if (entity != null) { diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/block/MixinBlockModelRenderer.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/block/MixinBlockModelRenderer.java index f9a211a1df..901dcaaf33 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/block/MixinBlockModelRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/block/MixinBlockModelRenderer.java @@ -20,6 +20,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockDisplayReader; +import net.minecraftforge.client.model.data.IModelData; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.injection.At; @@ -33,8 +34,8 @@ public class MixinBlockModelRenderer { private final XoRoShiRoRandom random = new XoRoShiRoRandom(); - @Inject(method = "renderModel(Lnet/minecraft/world/IBlockDisplayReader;Lnet/minecraft/client/renderer/model/IBakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lcom/mojang/blaze3d/matrix/MatrixStack;Lcom/mojang/blaze3d/vertex/IVertexBuilder;ZLjava/util/Random;JI)Z", at = @At("HEAD"), cancellable = true) - private void preRenderBlockInWorld(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder consumer, boolean cull, Random rand, long seed, int int_1, CallbackInfoReturnable cir) { + @Inject(method = "renderModel(Lnet/minecraft/world/IBlockDisplayReader;Lnet/minecraft/client/renderer/model/IBakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lcom/mojang/blaze3d/matrix/MatrixStack;Lcom/mojang/blaze3d/vertex/IVertexBuilder;ZLjava/util/Random;JILnet/minecraftforge/client/model/data/IModelData;)Z", at = @At("HEAD"), cancellable = true, remap = false) + private void preRenderBlockInWorld(IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrixStack, IVertexBuilder consumer, boolean cull, Random rand, long seed, int int_1, IModelData modelData, CallbackInfoReturnable cir) { GlobalRenderContext renderer = GlobalRenderContext.getInstance(world); BlockRenderer blockRenderer = renderer.getBlockRenderer(); @@ -47,9 +48,8 @@ private void preRenderBlockInWorld(IBlockDisplayReader world, IBakedModel model, * @reason Use optimized vertex writer intrinsics, avoid allocations * @author JellySquid */ - @Deprecated - @Overwrite - public void renderModelBrightnessColor(MatrixStack.Entry entry, IVertexBuilder vertexConsumer, BlockState blockState, IBakedModel bakedModel, float red, float green, float blue, int light, int overlay) { + @Overwrite(remap = false) + public void renderModel(MatrixStack.Entry entry, IVertexBuilder vertexConsumer, BlockState blockState, IBakedModel bakedModel, float red, float green, float blue, int light, int overlay, IModelData modelData) { XoRoShiRoRandom random = this.random; QuadVertexConsumer quadConsumer = (QuadVertexConsumer) vertexConsumer; @@ -61,14 +61,14 @@ public void renderModelBrightnessColor(MatrixStack.Entry entry, IVertexBuilder v int defaultColor = ColorABGR.pack(red, green, blue, 1.0F); for (Direction direction : DirectionUtil.ALL_DIRECTIONS) { - List quads = bakedModel.getQuads(blockState, direction, random.setSeedAndReturn(42L)); + List quads = bakedModel.getQuads(blockState, direction, random.setSeedAndReturn(42L), modelData); if (!quads.isEmpty()) { renderQuad(entry, quadConsumer, defaultColor, quads, light, overlay); } } - List quads = bakedModel.getQuads(blockState, null, random.setSeedAndReturn(42L)); + List quads = bakedModel.getQuads(blockState, null, random.setSeedAndReturn(42L), modelData); if (!quads.isEmpty()) { renderQuad(entry, quadConsumer, defaultColor, quads, light, overlay); @@ -93,4 +93,4 @@ private static void renderQuad(MatrixStack.Entry entry, QuadVertexConsumer verti SpriteUtil.markSpriteActive(quad.getSprite()); } } -} +} \ No newline at end of file diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/model/MixinMultipartBakedModel.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/model/MixinMultipartBakedModel.java index 95c700cfe8..a4c6e50a8a 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/model/MixinMultipartBakedModel.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/model/MixinMultipartBakedModel.java @@ -62,7 +62,7 @@ public List getQuads(BlockState state, Direction face, Random random, for (IBakedModel model : models) { random.setSeed(seed); - list.addAll(model.getQuads(state, face, random)); + list.addAll(model.getQuads(state, face, random, modelData)); } return list;