fix block colors
This commit is contained in:
parent
2f010b35c9
commit
1e79613f2b
3 changed files with 26 additions and 26 deletions
|
@ -2600,7 +2600,7 @@ public class Renderer {
|
|||
GL46.glEnableVertexAttribArray(1);
|
||||
GL46.glVertexAttribPointer(2, 2, GL46.GL_FLOAT, false, 28, 16L);
|
||||
GL46.glEnableVertexAttribArray(2);
|
||||
GL46.glVertexAttribPointer(3, 2, GL46.GL_UNSIGNED_SHORT, true, 28, 24L);
|
||||
GL46.glVertexAttribPointer(3, 4, GL46.GL_UNSIGNED_BYTE, true, 28, 24L);
|
||||
GL46.glEnableVertexAttribArray(3);
|
||||
|
||||
vertexbuffer.drawArrays(GL46.GL_QUADS);
|
||||
|
@ -3338,34 +3338,35 @@ public class Renderer {
|
|||
}
|
||||
List<BakedQuad> list = model.getQuads();
|
||||
if(list.size() > 0) {
|
||||
this.renderModelStandardQuads(world, block, pos, null, -1, true, rb, list, bounds);
|
||||
this.renderModelStandardQuads(world, block, pos, null, 0xffffffff, true, rb, list, bounds);
|
||||
rendered = true;
|
||||
}
|
||||
return rendered;
|
||||
}
|
||||
|
||||
private int getLightColor(int light) {
|
||||
return light << 24 | (int)(this.blockColorBlue * (float)light) << 16 | (int)(this.blockColorGreen * (float)light) << 8 | (int)(this.blockColorRed * (float)light);
|
||||
}
|
||||
|
||||
private static final int getLightmapValue(IWorldAccess world, BlockPos pos) {
|
||||
private int getLightmapValue(IWorldAccess world, BlockPos pos) {
|
||||
Block block = world.getState(pos).getBlock();
|
||||
int light = world.getCombinedLight(pos, block.getLight());
|
||||
int light = world.getCombinedLight(pos, block.getLight()) & 0xff;
|
||||
if(light == 0 && block instanceof BlockSlab) {
|
||||
pos = pos.down();
|
||||
block = world.getState(pos).getBlock();
|
||||
return world.getCombinedLight(pos, block.getLight());
|
||||
light = world.getCombinedLight(pos, block.getLight()) & 0xff;
|
||||
}
|
||||
return light;
|
||||
return this.getLightColor(light);
|
||||
}
|
||||
|
||||
private static final int getLightmapValueLiquid(IWorldAccess world, BlockPos pos) {
|
||||
int i = world.getCombinedLight(pos, 0);
|
||||
int j = world.getCombinedLight(pos.up(), 0);
|
||||
int k = i & 255;
|
||||
int l = j & 255;
|
||||
int i1 = i >> 16 & 255;
|
||||
int j1 = j >> 16 & 255;
|
||||
return (k > l ? k : l) | (i1 > j1 ? i1 : j1) << 16;
|
||||
private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos) {
|
||||
int light = world.getCombinedLight(pos, 0) & 0xff;
|
||||
int up = world.getCombinedLight(pos.up(), 0) & 0xff;
|
||||
light = light > up ? light : up;
|
||||
return this.getLightColor(light);
|
||||
}
|
||||
|
||||
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int brightnessIn, boolean ownBrightness, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
|
||||
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
|
||||
{
|
||||
double d0 = (double)blockPosIn.getX();
|
||||
double d1 = (double)blockPosIn.getY();
|
||||
|
@ -3373,14 +3374,14 @@ public class Renderer {
|
|||
|
||||
for (BakedQuad bakedquad : listQuadsIn)
|
||||
{
|
||||
if (ownBrightness)
|
||||
if (ownLight)
|
||||
{
|
||||
this.fillQuadBounds(blockIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, boundsFlags);
|
||||
brightnessIn = boundsFlags.get(0) ? getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : getLightmapValue(blockAccessIn, blockPosIn);
|
||||
light = boundsFlags.get(0) ? getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : getLightmapValue(blockAccessIn, blockPosIn);
|
||||
}
|
||||
|
||||
worldRendererIn.addVertexData(bakedquad.getVertexData());
|
||||
worldRendererIn.putBrightness4(brightnessIn, brightnessIn, brightnessIn, brightnessIn);
|
||||
worldRendererIn.putBrightness4(light, light, light, light);
|
||||
worldRendererIn.putPosition(d0, d1, d2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue