示例#1
0
        public ItemStack(SLOT data,EntityLocation pl)
        {
            world    = pl.world;
            physics  = new Physics(pl,this,PhysicsType.Item);
            ItemData = data;

            Entities.Add(this);
        }
示例#2
0
        internal EntityLocation OffsetBy(EntityLocation pl)
        {
            _x      += pl.X;
            _y      += pl.Y;
            _stance += pl.Stance;
            _z      += pl.Z;

            return(this);
        }
示例#3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            EntityLocation PL = (EntityLocation)obj;

            return(GetDistance(PL) < .75);              //return true if the players are less than .75 blocks apart
        }
示例#4
0
 internal EntityLocation(EntityLocation pl)
 {
     _onGround = true;
     _x        = pl.X;
     _y        = pl.Y;
     _stance   = pl.Stance;
     _z        = pl.Z;
     _pitch    = pl.Pitch;
     _yaw      = pl.Yaw;
     _world    = pl.world;
 }
示例#5
0
        void CalculateAdditionalData()
        {
            int cx = (int)Math.Floor((double)_x / 16);             //Get the x/z in chunk coordinates, converting via math.floor to make sure were getting lower bounds
            int cz = (int)Math.Floor((double)_z / 16);

            //if (_x < 0) cx--; //If BL_X or BL_Z are negative then we need to go DOWN one more chunk (because 0 0 is a positive only chunk)
            //if (_z < 0) cz--;

            _chunkLocation  = _chunkLocation.MoveTo(cx, cz, world);            //Get the chunk based on the cx and cz variables defined above
            _playerLocation = _playerLocation.MoveTo(X, Y, Y, Z, true);
        }
示例#6
0
        internal EntityLocation MoveTo(EntityLocation pl)
        {
            _x      = pl.X;
            _y      = pl.Y;
            _stance = pl.Stance;
            _z      = pl.Z;
            _pitch  = pl.Pitch;
            _yaw    = pl.Yaw;
            _world  = pl.world;

            return(this);
        }
示例#7
0
        internal BlockLocation(int x, byte y, int z, World w)
        {
            _x     = x;
            _y     = y;
            _z     = z;
            _world = w;
            //_chunk = null;
            //_chunkSection = null;
            _chunkLocation  = new ChunkLocation(w);
            _playerLocation = new EntityLocation(w);

            CalculateAdditionalData();
        }
示例#8
0
        internal BlockLocation(World w)
        {
            _x     = 0;
            _y     = 0;
            _z     = 0;
            _world = w;
            //_chunk = null;
            //_chunkSection = null;
            _chunkLocation  = new ChunkLocation(w);
            _playerLocation = new EntityLocation(w);

            CalculateAdditionalData();
        }
示例#9
0
 internal float GetDistance(EntityLocation pl) //TODO Verify this is correct, should it be sqrt or cubed-rt?
 {
     pl = GetOffset(pl);                       //Delta
     return((float)Math.Sqrt(pl.X * pl.X + pl.Y * pl.Y + pl.Z * pl.Z));
 }
示例#10
0
 internal EntityLocation GetOffset(EntityLocation pl)
 {
     return(new EntityLocation(pl.X - X, pl.Y - Y, pl.Z - Z, world));
 }