1212import net .minecraft .client .renderer .texture .TextureMap ;
1313import net .minecraft .util .EnumFacing ;
1414import net .minecraft .util .ResourceLocation ;
15+ import net .minecraft .world .World ;
1516import net .minecraftforge .fml .common .FMLCommonHandler ;
1617import net .minecraftforge .fml .relauncher .Side ;
1718import net .minecraftforge .fml .relauncher .SideOnly ;
@@ -74,7 +75,8 @@ public static void renderBoard(CCRenderState renderState, Matrix4 translation, I
7475 translation .translate (0.5 , 0.5 , 0.5 );
7576 translation .rotate (Math .toRadians (90.0 * rotations .indexOf (rotation )), Rotation .axes [1 ]);
7677 translation .translate (-0.5 , -0.5 , -0.5 );
77-
78+ World world = clipboard .getWorld ();
79+ if (world != null ) renderState .setBrightness (world , clipboard .getPos ());
7880 // Render Clipboard
7981 for (EnumFacing renderSide : EnumFacing .VALUES ) {
8082 boxTextureMap .forEach ((box , sprite ) -> Textures .renderFace (renderState , translation , pipeline , renderSide ,
@@ -89,7 +91,17 @@ public static void renderGUI(double x, double y, double z, EnumFacing rotation,
8991 GlStateManager .pushMatrix ();
9092 float lastBrightnessX = OpenGlHelper .lastBrightnessX ;
9193 float lastBrightnessY = OpenGlHelper .lastBrightnessY ;
92- OpenGlHelper .setLightmapTextureCoords (OpenGlHelper .lightmapTexUnit , 240.0F , 240.0F );
94+
95+ float lx = 240 , ly = 240 ;
96+ World world = clipboard .getWorld ();
97+ if (world != null ) {
98+ int light = world .getCombinedLight (clipboard .getPos (), 0 );
99+
100+ lx = (float ) light % 0x10000 ;
101+ ly = (float ) light / 0x10000 ;
102+ }
103+
104+ OpenGlHelper .setLightmapTextureCoords (OpenGlHelper .lightmapTexUnit , lx , ly );
93105 RenderHelper .disableStandardItemLighting ();
94106
95107 // All of these are done in reverse order, by the way, if you're reviewing this :P
0 commit comments