Fix translucent blocks not rendering properly when moved by pistons on fabulous (#7441)

This commit is contained in:
Cyborgmas 2020-11-21 14:57:33 -05:00 committed by GitHub
parent 949984268d
commit a73e003dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View file

@ -1,16 +1,14 @@
--- a/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java
+++ b/net/minecraft/client/renderer/tileentity/PistonTileEntityRenderer.java
@@ -61,8 +61,12 @@
@@ -61,8 +61,11 @@
}
private void func_228876_a_(BlockPos p_228876_1_, BlockState p_228876_2_, MatrixStack p_228876_3_, IRenderTypeBuffer p_228876_4_, World p_228876_5_, boolean p_228876_6_, int p_228876_7_) {
- RenderType rendertype = RenderTypeLookup.func_239221_b_(p_228876_2_);
+ net.minecraft.client.renderer.RenderType.func_228661_n_().stream().filter(t -> RenderTypeLookup.canRenderInLayer(p_228876_2_, t)).forEach(rendertype -> {
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(rendertype);
+ net.minecraftforge.client.ForgeHooksClient.renderPistonMovedBlocks(p_228876_1_, p_228876_2_, p_228876_3_, p_228876_4_, p_228876_5_, p_228876_6_, p_228876_7_, field_178462_c == null ? field_178462_c = Minecraft.func_71410_x().func_175602_ab() : field_178462_c);
+ if(false) {
RenderType rendertype = RenderTypeLookup.func_239221_b_(p_228876_2_);
IVertexBuilder ivertexbuilder = p_228876_4_.getBuffer(rendertype);
+ if (field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab();
this.field_178462_c.func_175019_b().func_228802_a_(p_228876_5_, this.field_178462_c.func_184389_a(p_228876_2_), p_228876_2_, p_228876_1_, p_228876_3_, ivertexbuilder, p_228876_6_, new Random(), p_228876_2_.func_209533_a(p_228876_1_), p_228876_7_);
+ });
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null);
+ }
}
}

View file

@ -22,6 +22,7 @@ package net.minecraftforge.client;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.MouseHelper;
@ -76,6 +77,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.GameType;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.World;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.client.model.ModelLoader;
@ -106,6 +108,7 @@ import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.stream.Stream;
@ -769,4 +772,17 @@ public class ForgeHooksClient
}
return !(squareDistance > 4096.0f);
}
public static void renderPistonMovedBlocks(BlockPos pos, BlockState state, MatrixStack stack, IRenderTypeBuffer buffer, World world, boolean checkSides, int combinedOverlay, BlockRendererDispatcher blockRenderer) {
RenderType.getBlockRenderTypes().stream()
.filter(t -> RenderTypeLookup.canRenderInLayer(state, t))
.forEach(rendertype ->
{
rendertype = rendertype == RenderType.getTranslucent() ? RenderType.getTranslucentMovingBlock() : rendertype;
setRenderLayer(rendertype);
IVertexBuilder ivertexbuilder = buffer.getBuffer(rendertype);
blockRenderer.getBlockModelRenderer().renderModel(world, blockRenderer.getModelForState(state), state, pos, stack, ivertexbuilder, checkSides, new Random(), state.getPositionRandom(pos), combinedOverlay);
});
setRenderLayer(null);
}
}