Search in sources :

Example 1 with SlabBlock

use of net.minecraft.world.level.block.SlabBlock in project SpongeCommon by SpongePowered.

the class DefaultTeleportHelperFilter method isSafeBodyMaterial.

@Override
public boolean isSafeBodyMaterial(BlockState blockState) {
    net.minecraft.world.level.block.state.BlockState state = (net.minecraft.world.level.block.state.BlockState) blockState;
    Material material = state.getMaterial();
    // Deny blocks that suffocate
    if (state.isSuffocating(EmptyBlockGetter.INSTANCE, BlockPos.ZERO)) {
        return false;
    }
    // Deny dangerous lava
    if (material == Material.LAVA) {
        return false;
    }
    // Deny non-passable non "full" blocks
    return !(state.getBlock() instanceof SlabBlock || state.getBlock() instanceof CauldronBlock || state.getBlock() instanceof AnvilBlock || state.getBlock() instanceof FenceBlock || state.getBlock() instanceof ChorusPlantBlock || state.getBlock() instanceof SnowLayerBlock || material == Material.GLASS || material == Material.LEAVES);
}
Also used : AnvilBlock(net.minecraft.world.level.block.AnvilBlock) SlabBlock(net.minecraft.world.level.block.SlabBlock) Material(net.minecraft.world.level.material.Material) CauldronBlock(net.minecraft.world.level.block.CauldronBlock) FenceBlock(net.minecraft.world.level.block.FenceBlock) ChorusPlantBlock(net.minecraft.world.level.block.ChorusPlantBlock) BlockState(org.spongepowered.api.block.BlockState) SnowLayerBlock(net.minecraft.world.level.block.SnowLayerBlock)

Aggregations

AnvilBlock (net.minecraft.world.level.block.AnvilBlock)1 CauldronBlock (net.minecraft.world.level.block.CauldronBlock)1 ChorusPlantBlock (net.minecraft.world.level.block.ChorusPlantBlock)1 FenceBlock (net.minecraft.world.level.block.FenceBlock)1 SlabBlock (net.minecraft.world.level.block.SlabBlock)1 SnowLayerBlock (net.minecraft.world.level.block.SnowLayerBlock)1 Material (net.minecraft.world.level.material.Material)1 BlockState (org.spongepowered.api.block.BlockState)1