@James check if it doesn't explote; This should help with rendering, and fix the issue with stacking water with 2block resolution
This commit is contained in:
+23
-7
@@ -170,6 +170,8 @@ public class FullDataToRenderDataTransformer
|
||||
|
||||
boolean isVoid = true;
|
||||
int colorToApplyToNextBlock = -1;
|
||||
int lastColor = 0;
|
||||
int lastBottom = -10000;
|
||||
byte skylightToApplyToNextBlock = -1;
|
||||
byte blocklightToApplyToNextBlock = -1;
|
||||
int columnOffset = 0;
|
||||
@@ -237,6 +239,7 @@ public class FullDataToRenderDataTransformer
|
||||
{
|
||||
if (colorBelowWithAvoidedBlocks)
|
||||
{
|
||||
//mare sure to not trnasfer alpha if for some reason grass is transparent
|
||||
colorToApplyToNextBlock = ColorUtil.setAlpha(level.computeBaseColor(new DhBlockPos(blockX, bottomY + level.getMinY(), blockZ), biome, block),255);
|
||||
skylightToApplyToNextBlock = skyLight;
|
||||
blocklightToApplyToNextBlock = blockLight;
|
||||
@@ -261,13 +264,26 @@ public class FullDataToRenderDataTransformer
|
||||
skyLight = skylightToApplyToNextBlock;
|
||||
blockLight = blocklightToApplyToNextBlock;
|
||||
}
|
||||
|
||||
|
||||
// add the block
|
||||
isVoid = false;
|
||||
long columnData = RenderDataPointUtil.createDataPoint(bottomY + blockHeight, bottomY, color, skyLight, blockLight, block.getIrisBlockMaterialId());
|
||||
renderColumnData.set(columnOffset, columnData);
|
||||
columnOffset++;
|
||||
|
||||
//check if they share a top-bottom face and if they have same collor
|
||||
if (color == lastColor && bottomY + blockHeight == lastBottom && columnOffset > 0)
|
||||
{
|
||||
//replace the previus block with new bottom
|
||||
long columnData = renderColumnData.get(columnOffset - 1);
|
||||
columnData = RenderDataPointUtil.setYMin(columnData, bottom);
|
||||
renderColumnData.set(columnOffset - 1, columnData);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add the block
|
||||
isVoid = false;
|
||||
long columnData = RenderDataPointUtil.createDataPoint(bottomY + blockHeight, bottomY, color, skyLight, blockLight, block.getIrisBlockMaterialId());
|
||||
renderColumnData.set(columnOffset, columnData);
|
||||
columnOffset++;
|
||||
}
|
||||
lastBottom = bottomY;
|
||||
lastColor = color;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ public class RenderDataPointUtil
|
||||
public static short getYMax(long dataPoint) { return (short) ((dataPoint >>> HEIGHT_SHIFT) & HEIGHT_MASK); }
|
||||
/** AKA the starting/bottom/lowest Y value above {@link AbstractDhLevel#getMinY()} */
|
||||
public static short getYMin(long dataPoint) { return (short) ((dataPoint >>> DEPTH_SHIFT) & DEPTH_MASK); }
|
||||
public static long setYMin(long dataPoint, int depth) { return (long) ((dataPoint & ~(DEPTH_MASK << DEPTH_SHIFT)) | (depth & DEPTH_MASK) << DEPTH_SHIFT)}
|
||||
|
||||
public static short getAlpha(long dataPoint) { return (short) ((((dataPoint >>> ALPHA_SHIFT) & ALPHA_MASK) << ALPHA_DOWNSIZE_SHIFT) | 0b1111); }
|
||||
public static short getRed(long dataPoint) { return (short) ((dataPoint >>> RED_SHIFT) & RED_MASK); }
|
||||
|
||||
Reference in New Issue
Block a user