public virtual void SpawnToPlayers(Player[] players) { var addEntity = McpeAddEntity.CreateObject(); addEntity.entityType = (byte)EntityTypeId; addEntity.entityIdSelf = EntityId; addEntity.runtimeEntityId = EntityId; addEntity.x = KnownPosition.X; addEntity.y = KnownPosition.Y; addEntity.z = KnownPosition.Z; addEntity.yaw = KnownPosition.Yaw; addEntity.pitch = KnownPosition.Pitch; addEntity.metadata = GetMetadata(); addEntity.speedX = (float)Velocity.X; addEntity.speedY = (float)Velocity.Y; addEntity.speedZ = (float)Velocity.Z; Level.RelayBroadcast(players, addEntity); var msg = addEntity; Log.DebugFormat("McpeAddEntity Entity ID: {0}", msg.entityIdSelf); Log.DebugFormat("McpeAddEntity Runtime Entity ID: {0}", msg.runtimeEntityId); Log.DebugFormat("Entity Type: {0}", msg.entityType); Log.DebugFormat("X: {0}", msg.x); Log.DebugFormat("Y: {0}", msg.y); Log.DebugFormat("Z: {0}", msg.z); Log.DebugFormat("Yaw: {0}", msg.yaw); Log.DebugFormat("Pitch: {0}", msg.pitch); Log.DebugFormat("Velocity X: {0}", msg.speedX); Log.DebugFormat("Velocity Y: {0}", msg.speedY); Log.DebugFormat("Velocity Z: {0}", msg.speedZ); Log.DebugFormat("Metadata: {0}", MetadataDictionary.MetadataToCode(msg.metadata)); }
public override MetadataDictionary GetMetadata() { IsInWater = true; IsUsingItem = false; var metadata = base.GetMetadata(); if (Shooter != null) { metadata[5] = new MetadataLong(Shooter.EntityId); } Log.Debug($"Projectile metadata: \n{MetadataDictionary.MetadataToCode(metadata)}"); return(metadata); }