Skip to content

Commit 9443d88

Browse files
committed
Update packages + fixed a bunch of warnings
1 parent 735f451 commit 9443d88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+204
-189
lines changed

src/MiNET/MiNET.Console/log4net.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
</filter>
6060

6161
<filter type="log4net.Filter.LevelRangeFilter">
62-
<levelMin value="WARN" />
62+
<levelMin value="TRACE" />
6363
<levelMax value="FATAL" />
6464
</filter>
6565

src/MiNET/MiNET/Blocks/Block.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ public virtual Item GetItem()
147147
if (remove) stateFromPick.States.Remove(state);
148148
}
149149

150-
Item pickedItem = null;
151-
152150
foreach (BlockStateContainer blockStateContainer in statesWithMeta)
153151
{
154152
bool match = true;

src/MiNET/MiNET/Blocks/Chalkboard.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ public Chalkboard() : base(230)
5151

5252
public override void SetState(List<IBlockState> states)
5353
{
54-
foreach (var state in states)
55-
{
56-
switch(state)
57-
{
58-
} // switch
59-
} // foreach
54+
6055
} // method
6156

6257
public override BlockStateContainer GetState()

src/MiNET/MiNET/CertificateData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public class NewtonsoftMapper : IJsonMapper
114114
{
115115
static NewtonsoftMapper()
116116
{
117-
JWT.JsonMapper = new NewtonsoftMapper();
117+
JWT.DefaultSettings.JsonMapper = new NewtonsoftMapper();
118118
}
119119

120120
public string Serialize(object obj)

src/MiNET/MiNET/EduTokenManager.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using System.Collections.Generic;
2828
using System.Net.Http;
2929
using System.Net.Http.Headers;
30+
using System.Runtime.InteropServices;
3031
using System.Security.Cryptography;
3132
using System.Text;
3233
using log4net;
@@ -47,6 +48,9 @@ public class EduTokenManager
4748

4849
public EduTokenManager()
4950
{
51+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
52+
throw new NotSupportedException("Minecraft Education Edition requires a Windows host.");
53+
5054
_username = Config.GetProperty("AAD.username", "");
5155
_password = Config.GetProperty("AAD.password", "");
5256

@@ -113,9 +117,9 @@ public string FetchNewSignedToken(string tenantId, string username, string passw
113117
return payload.signedToken;
114118
}
115119

116-
string resourceUri = "https://meeservices.minecraft.net";
117-
string clientId = "b36b1432-1a1c-4c82-9b76-24de1cab42f2";
118-
string redirectUri = "https://login.live.com/oauth20_desktop.srf"; // Standard void redirect AAD stuff
120+
private readonly string _resourceUri = "https://meeservices.minecraft.net";
121+
private readonly string _clientId = "b36b1432-1a1c-4c82-9b76-24de1cab42f2";
122+
//private readonly string _redirectUri = "https://login.live.com/oauth20_desktop.srf"; // Standard void redirect AAD stuff
119123

120124
public (string IdToken, string AccessToken) GetTokens(string tenantId, string username, string password)
121125
{
@@ -132,10 +136,10 @@ public string FetchNewSignedToken(string tenantId, string username, string passw
132136

133137
string content = $@"
134138
grant_type = password
135-
&resource ={resourceUri}
139+
&resource ={_resourceUri}
136140
&username ={username}
137141
&password ={password}
138-
&client_id ={clientId}";
142+
&client_id ={_clientId}";
139143

140144
message.Content = new StringContent(content, Encoding.UTF8, "application/x-www-form-urlencoded");
141145

src/MiNET/MiNET/Entities/Behaviors/LookAtPlayerBehavior.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public override void OnTick(Entity[] entities)
8080
var dy = (_entity.KnownPosition.Y + _entity.Height) - (_player.KnownPosition.Y + 1.62);
8181
double pitch = RadianToDegree(Math.Atan(dy / (bDiff)));
8282

83-
_entity.Direction = (float) yaw;
83+
_entity.EntityDirection = (float) yaw;
8484
_entity.KnownPosition.Yaw = (float) yaw;
8585
_entity.KnownPosition.HeadYaw = (float) yaw;
8686
_entity.KnownPosition.Pitch = (float) pitch;

src/MiNET/MiNET/Entities/Behaviors/MobController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void RotateTowards(Vector3 targetPosition)
9292
}
9393
var yaw = /*ClampDegrees*/ (thetaOffset + tanOutput);
9494

95-
_entity.Direction = (float) yaw;
95+
_entity.EntityDirection = (float) yaw;
9696
}
9797

9898

src/MiNET/MiNET/Entities/Behaviors/RandomLookaroundBehavior.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override bool CanContinue()
5656

5757
public override void OnTick(Entity[] entities)
5858
{
59-
_entity.Direction += (float) Math.Sign(_rotation) * 10;
59+
_entity.EntityDirection += (float) Math.Sign(_rotation) * 10;
6060
_entity.KnownPosition.HeadYaw += (float) Math.Sign(_rotation) * 10;
6161
_entity.KnownPosition.Yaw += (float) Math.Sign(_rotation) * 10;
6262
_entity.BroadcastMove();
@@ -66,9 +66,9 @@ public override void OnTick(Entity[] entities)
6666

6767
public override void OnEnd()
6868
{
69-
_entity.Direction = Mob.ClampDegrees(_entity.Direction);
70-
_entity.KnownPosition.HeadYaw = (float) _entity.Direction;
71-
_entity.KnownPosition.Yaw = (float) _entity.Direction;
69+
_entity.EntityDirection = Mob.ClampDegrees(_entity.EntityDirection);
70+
_entity.KnownPosition.HeadYaw = (float) _entity.EntityDirection;
71+
_entity.KnownPosition.Yaw = (float) _entity.EntityDirection;
7272
_entity.BroadcastMove(true);
7373
}
7474
}

src/MiNET/MiNET/Entities/Behaviors/StrollBehavior.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ public override void OnTick(Entity[] entities)
137137
{
138138
//Log.Debug($"Block ahead: {block}, turning");
139139
int rot = level.Random.Next(2) == 0 ? level.Random.Next(45, 180) : level.Random.Next(-180, -45);
140-
_entity.Direction += rot;
141-
_entity.Direction = Mob.ClampDegrees(_entity.Direction);
142-
_entity.KnownPosition.HeadYaw = (float) _entity.Direction;
143-
_entity.KnownPosition.Yaw = (float) _entity.Direction;
140+
_entity.EntityDirection += rot;
141+
_entity.EntityDirection = Mob.ClampDegrees(_entity.EntityDirection);
142+
_entity.KnownPosition.HeadYaw = (float) _entity.EntityDirection;
143+
_entity.KnownPosition.Yaw = (float) _entity.EntityDirection;
144144
_entity.Velocity *= new Vector3(0, 1, 0);
145145
}
146146
}

src/MiNET/MiNET/Entities/Behaviors/TemptedBehavior.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ public override void OnTick(Entity[] entities)
9595
_entity.Controller.LookAt(_temptingPlayer);
9696

9797
_entity.Controller.RotateTowards(_temptingPlayer.KnownPosition);
98-
_entity.Direction = Mob.ClampDegrees(_entity.Direction);
99-
_entity.KnownPosition.HeadYaw = (float) _entity.Direction;
100-
_entity.KnownPosition.Yaw = (float) _entity.Direction;
98+
_entity.EntityDirection = Mob.ClampDegrees(_entity.EntityDirection);
99+
_entity.KnownPosition.HeadYaw = (float) _entity.EntityDirection;
100+
_entity.KnownPosition.Yaw = (float) _entity.EntityDirection;
101101
_currentPath = null;
102102

103103
return;
@@ -122,9 +122,9 @@ public override void OnTick(Entity[] entities)
122122
}
123123

124124
_entity.Controller.RotateTowards(new Vector3((float) next.X + 0.5f, _entity.KnownPosition.Y, (float) next.Y + 0.5f));
125-
_entity.Direction = Mob.ClampDegrees(_entity.Direction);
126-
_entity.KnownPosition.HeadYaw = (float) _entity.Direction;
127-
_entity.KnownPosition.Yaw = (float) _entity.Direction;
125+
_entity.EntityDirection = Mob.ClampDegrees(_entity.EntityDirection);
126+
_entity.KnownPosition.HeadYaw = (float) _entity.EntityDirection;
127+
_entity.KnownPosition.Yaw = (float) _entity.EntityDirection;
128128

129129
if (distanceToPlayer < 1.75)
130130
{

0 commit comments

Comments
 (0)