public ItemStack(SLOT data,EntityLocation pl) { world = pl.world; physics = new Physics(pl,this,PhysicsType.Item); ItemData = data; Entities.Add(this); }
internal EntityLocation OffsetBy(EntityLocation pl) { _x += pl.X; _y += pl.Y; _stance += pl.Stance; _z += pl.Z; return(this); }
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 }
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; }
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); }
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); }
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(); }
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(); }
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)); }
internal EntityLocation GetOffset(EntityLocation pl) { return(new EntityLocation(pl.X - X, pl.Y - Y, pl.Z - Z, world)); }