Allow blocks to provide a dynamic MaterialColor for display on maps (#8812)

This commit is contained in:
Dennis C authored and GitHub committed 2022-07-09 12:10:02 -04:00
1 parent 4a0c8be742
commit 7e06a2105f
2 files changed
+17 -1

No files matched your search

@@ -23,7 +23,9 @@ import net.minecraft.world.entity.projectile.WitherSkull;
import net.minecraft.world.item.*;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.tags.BlockTags;
import net.minecraft.core.Direction;
@@ -879,4 +881,17 @@ public interface IForgeBlock
{
return fluid.canHydrate(getter, fluidPos, state, pos);
}
/**
* Returns the {@link MaterialColor} shown on the map.
*
* @param state The state of this block
* @param level The level this block is in
* @param pos The blocks position in the level
* @param defaultColor The {@code MaterialColor} configured for the given {@code BlockState} in the {@link BlockBehaviour.Properties}
*/
default MaterialColor getMapColor(BlockState state, BlockGetter level, BlockPos pos, MaterialColor defaultColor)
{
return defaultColor;
}
}