public PlayerMob(string name, Level level) : base(EntityType.Player, level) { ClientUuid = new UUID(Guid.NewGuid().ToByteArray()); Width = 0.6; Length = 0.6; Height = 1.80; IsSpawned = false; NameTag = name; var resourcePatch = new SkinResourcePatch() { Geometry = new GeometryIdentifier() { Default = "geometry.humanoid.customSlim" } }; Skin = new Skin { SkinId = $"{Guid.NewGuid().ToString()}.CustomSlim", SkinResourcePatch = resourcePatch, Slim = true, Height = 32, Width = 64, Data = Encoding.Default.GetBytes(new string('Z', 8192)), }; ItemInHand = new ItemAir(); HideNameTag = false; IsAlwaysShowName = true; IsInWater = true; NoAi = true; HealthManager.IsOnFire = false; Velocity = Vector3.Zero; PositionOffset = 1.62f; }
public static byte[] EncodeSkinJwt(AsymmetricCipherKeyPair newKey, string username) { var resourcePatch = new SkinResourcePatch() { Geometry = new GeometryIdentifier() { Default = "geometry.humanoid.customSlim" } }; var skin = new Skin { SkinId = $"{Guid.NewGuid().ToString()}.CustomSlim", SkinResourcePatch = resourcePatch, Slim = true, Height = 32, Width = 64, Data = Encoding.Default.GetBytes(new string('Z', 8192)), }; string resourcePatchData = Convert.ToBase64String(Encoding.Default.GetBytes(Skin.ToJson(resourcePatch))); string skin64 = Convert.ToBase64String(skin.Data); string skinData = $@" {{ ""AnimatedImageData"": [], ""CapeData"": """", ""CapeId"": """", ""CapeImageHeight"": 0, ""CapeImageWidth"": 0, ""CapeOnClassicSkin"": false, ""ClientRandomId"": {new Random().Next()}, ""CurrentInputMode"": 1, ""DefaultInputMode"": 1, ""DeviceId"": ""{Guid.NewGuid().ToString()}"", ""DeviceModel"": ""MiNET CLIENT"", ""DeviceOS"": 7, ""GameVersion"": ""{McpeProtocolInfo.GameVersion}"", ""GuiScale"": -1, ""LanguageCode"": ""en_US"", ""PersonaSkin"": false, ""PlatformOfflineId"": """", ""PlatformOnlineId"": """", ""PremiumSkin"": true, ""SelfSignedId"": ""{Guid.NewGuid().ToString()}"", ""ServerAddress"": ""yodamine.com:19132"", ""SkinAnimationData"": """", ""SkinData"": ""{skin64}"", ""SkinGeometryData"": """", ""SkinId"": ""{skin.SkinId}"", ""SkinImageHeight"": {skin.Height}, ""SkinImageWidth"": {skin.Width}, ""SkinResourcePatch"": ""{resourcePatchData}"", ""ThirdPartyName"": ""{username}"", ""ThirdPartyNameOnly"": false, ""UIProfile"": 0 }} "; ECDsa signKey = ConvertToSingKeyFormat(newKey); string b64Key = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(newKey.Public).GetEncoded().EncodeBase64(); string val = JWT.Encode(skinData, signKey, JwsAlgorithm.ES384, new Dictionary <string, object> { { "x5u", b64Key } }); return(Encoding.UTF8.GetBytes(val)); }