Skip to content

Commit

Permalink
Restructure flow
Browse files Browse the repository at this point in the history
  • Loading branch information
magicus committed Nov 14, 2021
1 parent d415421 commit 3de0816
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/main/java/ru/bulldog/justmap/map/data/fast/MapChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,35 +194,36 @@ private static int getTintedBlockColor(World world, BlockPos pos, BlockState blo
if (BlockStateUtil.isAir(blockState)) {
return -1;
}
Material material = overState.getMaterial();
Material overStateMaterial = overState.getMaterial();
if (!ClientSettings.hideWater && ClientSettings.hidePlants && isSeaweed(overState)) {
// We are showing water but not plants, and we have seaweed above us
if (ClientSettings.waterTint) {
int color = ColorUtil.getBlockColorInner(world, blockState, pos);
return ColorUtil.applyTint(color, BiomeColors.getWaterColor(world, pos));
} else {
return ColorUtil.getBlockColorInner(world, Blocks.WATER.getDefaultState(), pos);
}
return ColorUtil.getBlockColorInner(world, Blocks.WATER.getDefaultState(), pos);
} else if (BlockStateUtil.isAir(overState) || (!!(ClientSettings.hideWater || ClientSettings.waterTint) && material.isLiquid() && material != Material.LAVA) || (!!ClientSettings.hidePlants && (material == Material.PLANT || material == Material.REPLACEABLE_PLANT ||
} else if (BlockStateUtil.isAir(overState)
|| ((ClientSettings.hideWater || ClientSettings.waterTint) && overStateMaterial.isLiquid() && overStateMaterial != Material.LAVA)
|| (ClientSettings.hidePlants && (overStateMaterial == Material.PLANT || overStateMaterial == Material.REPLACEABLE_PLANT ||
isSeaweed(overState)))) {
int color = ColorUtil.getBlockColorInner(world, blockState, pos);
if (ClientSettings.hideWater) return color;
boolean isWaterLogged;
if (blockState.contains(Properties.WATERLOGGED)) {
isWaterLogged = blockState.get(Properties.WATERLOGGED);
if (ClientSettings.hideWater) {
return color;
} else {
isWaterLogged = isSeaweed(blockState);
if (ClientSettings.waterTint &&
(!isSeaweed(overState) && overState.getFluidState().isIn(FluidTags.WATER) ||
(blockState.contains(Properties.WATERLOGGED) && blockState.get(Properties.WATERLOGGED)) || isSeaweed(blockState))) {
return ColorUtil.applyTint(color, BiomeColors.getWaterColor(world, pos));
} else {
return color;
}
}

if (ClientSettings.waterTint && (!isSeaweed(overState) && overState.getFluidState().isIn(FluidTags.WATER) || isWaterLogged)) {
return ColorUtil.applyTint(color, BiomeColors.getWaterColor(world, pos));
}
return color;
} else {
return -1;
}

return -1;
}


public static boolean isSeaweed(BlockState state) {
Material material = state.getMaterial();
return material == Material.UNDERWATER_PLANT || material == Material.REPLACEABLE_UNDERWATER_PLANT;
Expand Down

0 comments on commit 3de0816

Please sign in to comment.