99import com .mojang .blaze3d .vertex .PoseStack ;
1010import com .mojang .math .Axis ;
1111import net .minecraft .client .renderer .LevelRenderer ;
12+ import net .minecraft .client .renderer .LightTexture ;
1213import net .minecraft .client .renderer .MultiBufferSource ;
14+ import net .minecraft .core .Direction ;
1315import net .minecraft .core .Vec3i ;
1416import net .minecraft .world .level .block .state .BlockState ;
1517import net .minecraft .world .level .block .state .properties .AttachFace ;
@@ -52,7 +54,7 @@ public static void renderPatternForScroll(HexPattern pattern, EntityWallScroll s
5254 ps .pushPose ();
5355 ps .translate (-blockSize / 2f , -blockSize / 2f , 1f / 32f );
5456 // there's almost certainly a better way to do this, but we're just flipping the y and z axes to fix normals
55- ps . last (). normal (). mul ( new Matrix3f ( 1 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ));
57+ // no need for this anymore :D
5658 renderPattern (pattern , showStrokeOrder ? READABLE_SCROLL_SETTINGS : SCROLL_SETTINGS ,
5759 showStrokeOrder ? PatternColors .READABLE_SCROLL_COLORS : PatternColors .DEFAULT_PATTERN_COLOR ,
5860 scroll .getPos ().hashCode (), ps , bufSource , null , null , light , blockSize );
@@ -61,7 +63,7 @@ public static void renderPatternForScroll(HexPattern pattern, EntityWallScroll s
6163
6264 private static final int [] WALL_ROTATIONS = {180 , 270 , 0 , 90 };
6365 private static final Vec3i [] SLATE_FACINGS = {new Vec3i (0 , -1 , 0 ), new Vec3i (-1 , -1 , 0 ), new Vec3i (-1 , -1 , 1 ), new Vec3i (0 , -1 , 1 )};
64- private static final Vec3 [] WALL_NORMALS = {new Vec3 (0 , 0 , - 1 ), new Vec3 (-1 , 0 , 0 ), new Vec3 (0 , 0 , -1 ), new Vec3 (- 1 , 0 , 0 )};
66+ private static final Vec3 [] WALL_NORMALS = {new Vec3 (0 , 0 , 1 ), new Vec3 (-1 , 0 , 0 ), new Vec3 (0 , 0 , -1 ), new Vec3 (1 , 0 , 0 )};
6567 private static final Vec3i [] SLATE_FLOORCEIL_FACINGS = {new Vec3i (0 ,0 ,0 ), new Vec3i (1 ,0 ,0 ), new Vec3i (1 ,0 ,1 ), new Vec3i (0 ,0 ,1 )};
6668
6769 public static void renderPatternForSlate (BlockEntitySlate tile , HexPattern pattern , PoseStack ps , MultiBufferSource buffer , int light , BlockState bs )
@@ -89,12 +91,17 @@ public static void renderPatternForSlate(BlockEntitySlate tile, HexPattern patte
8991 ps .mulPose (Axis .YP .rotationDegrees (facing *-90 ));
9092 ps .mulPose (Axis .XP .rotationDegrees (90 * (isOnCeiling ? -1 : 1 )));
9193 if (isOnCeiling ) ps .translate (0 ,-1 ,1 );
94+
95+ // Set the normal for floor/ceiling slates so lighting is correct
96+ // Floor faces up, ceiling faces down
97+ normal = isOnCeiling ? new Vec3 (0 , -1 , 0 ) : new Vec3 (0 , 1 , 0 );
9298 }
9399
100+ int actualLight = LevelRenderer .getLightColor (tile .getLevel (), tile .getBlockPos ().relative (Direction .getNearest (normal )));
94101 renderPattern (pattern ,
95- wombly ? WORLDLY_SETTINGS_WOBBLY : WORLDLY_SETTINGS ,
96- wombly ? PatternColors .SLATE_WOBBLY_PURPLE_COLOR : PatternColors .DEFAULT_PATTERN_COLOR ,
97- tile .getBlockPos ().hashCode (), ps , buffer , normal , null , light , 1 );
102+ wombly ? WORLDLY_SETTINGS_WOBBLY : WORLDLY_SETTINGS ,
103+ wombly ? PatternColors .SLATE_WOBBLY_PURPLE_COLOR : PatternColors .DEFAULT_PATTERN_COLOR ,
104+ tile .getBlockPos ().hashCode (), ps , buffer , normal , null , actualLight , 1 );
98105 ps .popPose ();
99106 }
100107
0 commit comments