using MinecraftClient.Mapping;
using MinecraftClient.Pathing.Core;
namespace MinecraftClient.Pathing.Moves
{
///
/// Block passability checks for path planning.
/// Uses Material-level checks initially; designed to allow future BlockShapes upgrade.
///
public static class MoveHelper
{
///
/// Can a player's body/head occupy this block position? (air, open door, tall grass, etc.)
///
public static bool CanWalkThrough(CalculationContext ctx, int x, int y, int z)
{
Material mat = ctx.GetMaterial(x, y, z);
if (mat == Material.Air || mat == Material.CaveAir || mat == Material.VoidAir)
return true;
if (mat.IsLiquid())
return false;
if (mat.IsSolid())
return false;
if (mat.CanHarmPlayers())
return false;
return true;
}
///
/// Can a player stand on top of this block? (solid upper surface)
///
public static bool CanWalkOn(CalculationContext ctx, int x, int y, int z)
{
Material mat = ctx.GetMaterial(x, y, z);
if (mat == Material.Air || mat == Material.CaveAir || mat == Material.VoidAir)
return false;
if (mat.IsLiquid())
return false;
if (mat.CanHarmPlayers())
return false;
return mat.IsSolid();
}
///
/// Is this block completely passable with no slowdown or interaction?
/// Stricter than CanWalkThrough -- excludes water, cobwebs, etc.
///
public static bool IsFullyPassable(CalculationContext ctx, int x, int y, int z)
{
Material mat = ctx.GetMaterial(x, y, z);
return mat == Material.Air || mat == Material.CaveAir || mat == Material.VoidAir;
}
public static bool IsClimbable(Material mat)
{
return mat.CanBeClimbedOn();
}
public static bool IsHazardous(Material mat)
{
return mat.CanHarmPlayers();
}
public static bool IsWater(Material mat)
{
return mat == Material.Water;
}
}
}