Have grass fade to dirt for walls

This commit is contained in:
James Seibel
2024-04-06 12:37:44 -05:00
parent 09c788e495
commit dbc9cbb418
3 changed files with 30 additions and 2 deletions
@@ -69,6 +69,8 @@ public class BlockStateWrapper implements IBlockStateWrapper
public static final String AIR_STRING = "AIR";
public static final BlockStateWrapper AIR = new BlockStateWrapper(null, null);
public static final String DIRT_RESOURCE_LOCATION_STRING = "minecraft:dirt";
// TODO: Make this changeable through the config
public static final String[] RENDERER_IGNORED_BLOCKS_RESOURCE_LOCATIONS = { AIR_STRING, "minecraft:barrier", "minecraft:structure_void", "minecraft:light", "minecraft:tripwire" };
public static HashSet<IBlockStateWrapper> rendererIgnoredBlocks = null;
@@ -521,9 +523,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
{
return IrisBlockMaterial.METAL;
}
else if (serialString.contains("grass_block"))
{
return IrisBlockMaterial.GRASS;
}
else if (
serialString.contains("dirt")
|| serialString.contains("grass_block")
|| serialString.contains("gravel")
|| serialString.contains("mud")
|| serialString.contains("podzol")
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
public class ClientLevelWrapper implements IClientLevelWrapper
@@ -41,6 +42,8 @@ public class ClientLevelWrapper implements IClientLevelWrapper
private final ClientLevel level;
private final ClientBlockDetailMap blockMap = new ClientBlockDetailMap(this);
private BlockStateWrapper dirtBlockWrapper;
//=============//
@@ -116,6 +119,26 @@ public class ClientLevelWrapper implements IClientLevelWrapper
return this.blockMap.getColor(((BlockStateWrapper) blockState).blockState, (BiomeWrapper) biome, pos);
}
@Override
public int getDirtBlockColor()
{
if (this.dirtBlockWrapper == null)
{
try
{
this.dirtBlockWrapper = (BlockStateWrapper) BlockStateWrapper.deserialize(BlockStateWrapper.DIRT_RESOURCE_LOCATION_STRING, this);
}
catch (IOException e)
{
// shouldn't happen, but just in case
LOGGER.warn("Unable to get dirt color with resource location ["+BlockStateWrapper.DIRT_RESOURCE_LOCATION_STRING+"] with level ["+this+"].", e);
return -1;
}
}
return this.blockMap.getColor(this.dirtBlockWrapper.blockState, BiomeWrapper.EMPTY_WRAPPER, DhBlockPos.ZERO);
}
@Override
public IDimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); }