public List<PathCoordinate> CreatePathToCoordinate(EntityBase entityFrom, AbsWorldCoords coordinate, double maxDistance = 24.0, double untilDistanceToTarget = 1.0) { PathCoordinate start = GetCoordinateFromCacheOrAdd(entityFrom.BlockPosition); PathCoordinate end = GetCoordinateFromCacheOrAdd(UniversalCoords.FromAbsWorld(coordinate.X - (entityFrom.Width * 0.5), coordinate.Y, coordinate.Z - (entityFrom.Width * 0.5))); Size size = new Size((int)Math.Floor(entityFrom.Width + 1.0), (int)Math.Floor(entityFrom.Height + 1.0)); return GeneratePath(start, end, size, maxDistance, untilDistanceToTarget); }
protected BaseFallingPhysics(WorldManager world, AbsWorldCoords pos) { World = world; Position = pos; EntityId = world.Server.AllocateEntity(); CreateEntityPacket entity = new CreateEntityPacket { EntityId = EntityId }; World.Server.SendPacketToNearbyPlayers(World, UniversalCoords.FromAbsWorld(Position), entity); }
public override void Simulate() { int x = (int)Math.Floor(Position.X); int y = (int)Math.Floor(Position.Y); int z = (int)Math.Floor(Position.Z); byte? blockId = World.GetBlockId(x, y, z); if (blockId == null || blockId != (byte)BlockData.Blocks.Air) { Stop(); return; } if (Position.Y <= 1) { Stop(true); return; } Position = new AbsWorldCoords(Position.ToVector() + Velocity); }
public static UniversalCoords FromAbsWorld(AbsWorldCoords absWorldCoords) { return FromAbsWorld(absWorldCoords.X, absWorldCoords.Y, absWorldCoords.Z); }
public FallingSand(WorldManager world, AbsWorldCoords pos) : base(world, pos) { Type = Net.Packets.AddObjectVehiclePacket.ObjectType.FallingObjects; BlockId = (byte) BlockData.Blocks.Sand; Velocity = new Vector3(0, -0.4D, 0); }
public BoundingBox(AbsWorldCoords minimum, AbsWorldCoords maximum) : this(minimum.ToVector(), maximum.ToVector()) { }
public static UniversalCoords FromAbsWorld(AbsWorldCoords absWorldCoords) { return(FromAbsWorld(absWorldCoords.X, absWorldCoords.Y, absWorldCoords.Z)); }
public EntityMoveEventArgs(IEntityBase entity, AbsWorldCoords newPosition, AbsWorldCoords oldPosition) : base(entity) { NewPosition = newPosition; OldPosition = oldPosition; }
public EntitySpawnEventArgs(IEntityBase entity, AbsWorldCoords Location) : base(entity) { this.Location = Location; }
public FallingGravel(WorldManager world, AbsWorldCoords pos) : base(world, pos) { Type = Net.Packets.AddObjectVehiclePacket.ObjectType.FallingObjects; BlockId = (byte) BlockData.Blocks.Gravel; }