bool CheckIsFree(PickedPos selected, byte block)
        {
            Vector3     pos  = (Vector3)selected.TranslatedPos;
            BlockInfo   info = game.BlockInfo;
            LocalPlayer p    = game.LocalPlayer;

            if (info.Collide[block] != CollideType.Solid)
            {
                return(true);
            }
            if (IntersectsOtherPlayers(pos, block))
            {
                return(false);
            }

            AABB blockBB = new AABB(pos + info.MinBB[block], pos + info.MaxBB[block]);
            // NOTE: We need to also test against nextPos here, because otherwise
            // we can fall through the block as collision is performed against nextPos
            AABB localBB = AABB.Make(p.Position, p.Size);

            localBB.Min.Y = Math.Min(p.nextPos.Y, localBB.Min.Y);

            if (p.Hacks.Noclip || !localBB.Intersects(blockBB))
            {
                return(true);
            }
            if (p.Hacks.CanPushbackBlocks && p.Hacks.PushbackPlacing && p.Hacks.Enabled)
            {
                return(PushbackPlace(selected, blockBB));
            }

            localBB.Min.Y += 0.25f + Entity.Adjustment;
            if (localBB.Intersects(blockBB))
            {
                return(false);
            }

            // Push player up if they are jumping and trying to place a block underneath them.
            Vector3 next = game.LocalPlayer.nextPos;

            next.Y = pos.Y + game.BlockInfo.MaxBB[block].Y + Entity.Adjustment;
            LocationUpdate update = LocationUpdate.MakePos(next, false);

            game.LocalPlayer.SetLocation(update, false);
            return(true);
        }
        public static Vector3 FindSpawnPosition(Game game, float x, float z, Vector3 modelSize)
        {
            Vector3 spawn = new Vector3(x, 0, z);

            spawn.Y = game.World.Height + Entity.Adjustment;
            AABB bb = AABB.Make(spawn, modelSize);

            spawn.Y = 0;

            for (int y = game.World.Height; y >= 0; y--)
            {
                float highestY = HighestFreeY(game, ref bb);
                if (highestY != float.NegativeInfinity)
                {
                    spawn.Y = highestY; break;
                }
                bb.Min.Y -= 1; bb.Max.Y -= 1;
            }
            return(spawn);
        }