Пример #1
0
        public static Vector3i GetBlockPlayerLookingAtPos(EntityPlayer player)
        {
            for (int distance = 0; distance <= 1000; distance++)
            {
                Vector3    lookPoint = player.GetLookRay().GetPoint(distance);
                Vector3i   lookVec   = new Vector3i(lookPoint.x, lookPoint.y, lookPoint.z);
                BlockValue bv        = BlockUtils.GetBlock(lookVec.x, lookVec.y, lookVec.z);
                if (bv.type != BlockValue.Air.type)
                {
                    Log.Out(distance.ToString());
                    return(lookVec);
                }
            }

            return(Vector3i.zero);
        }
Пример #2
0
        public static BlockValue GetBlockPlayerLookingAt(EntityPlayer player)
        {
            for (int distance = 0; distance <= 100; distance++)
            {
                Vector3    lookPoint = player.GetLookRay().GetPoint(distance);
                Vector3i   lookVec   = new Vector3i(lookPoint.x, lookPoint.y, lookPoint.z);
                BlockValue bv        = BlockUtils.GetBlock(lookVec.x, lookVec.y, lookVec.z);

                if (bv.type != BlockValue.Air.type)
                {
                    return(bv);
                }
            }

            return(BlockValue.Air);
        }