fCraft.Physics.BlockThrough C# (CSharp) Method

BlockThrough() public static method

public static BlockThrough ( Block block ) : bool
block Block
return bool
        public static bool BlockThrough( Block block )
        {
            switch ( block ) {
                case Block.Air:
                case Block.Water:
                case Block.Lava:
                case Block.StillWater:
                case Block.StillLava:
                    return true;
                default:
                    return false;
            }
        }

Usage Example

Example #1
0
 protected override int PerformInternal()
 {
     lock (_world.SyncRoot)
     {
         if (_world.sandPhysics)
         {
             Block nblock = _world.Map.GetBlock(_pos.X, _pos.Y, _nextPos);
             if (_firstMove)
             {
                 if (_world.Map.GetBlock(_pos) != _type)
                 {
                     return(0);
                 }
                 if (_world.Map.GetBlock(_pos.X, _pos.Y, _nextPos) == Block.Air)
                 {
                     _world.Map.QueueUpdate(new BlockUpdate(null, _pos, Block.Air));
                     _world.Map.QueueUpdate(new BlockUpdate(null, (short)_pos.X, (short)_pos.Y,
                                                            (short)_nextPos, _type));
                     _nextPos--;
                     _firstMove = false;
                     return(Delay);
                 }
             }
             if (_world.Map.GetBlock(_pos.X, _pos.Y, _nextPos) != Block.Air)
             {
                 return(0);
             }
             if (Physics.BlockThrough(nblock))
             {
                 _world.Map.QueueUpdate(new BlockUpdate(null, (short)_pos.X, (short)_pos.Y,
                                                        (short)(_nextPos + 1), Block.Air));
                 _world.Map.QueueUpdate(new BlockUpdate(null, (short)_pos.X, (short)_pos.Y, (short)_nextPos,
                                                        _type));
                 _nextPos--;
             }
         }
         return(Delay);
     }
 }