From eca7dd5e3beb31cf0be6b35a1aa7f17f7004b125 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 28 Feb 2017 08:45:04 +1100 Subject: [PATCH] 0.01% less hardcoding --- ClassicalSharp/Commands/SinglePlayerCommands.cs | 2 +- ClassicalSharp/Network/NetworkProcessor.Helpers.cs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ClassicalSharp/Commands/SinglePlayerCommands.cs b/ClassicalSharp/Commands/SinglePlayerCommands.cs index 76638e7f9..87daf27c8 100644 --- a/ClassicalSharp/Commands/SinglePlayerCommands.cs +++ b/ClassicalSharp/Commands/SinglePlayerCommands.cs @@ -58,7 +58,7 @@ namespace ClassicalSharp.Commands { public override void Execute(string[] args) { game.UserEvents.BlockChanged -= BlockChanged; - block = 0xFF; + block = Block.Invalid; mark1 = new Vector3I(int.MaxValue); mark2 = new Vector3I(int.MaxValue); persist = false; diff --git a/ClassicalSharp/Network/NetworkProcessor.Helpers.cs b/ClassicalSharp/Network/NetworkProcessor.Helpers.cs index 20772fad0..7455d1545 100644 --- a/ClassicalSharp/Network/NetworkProcessor.Helpers.cs +++ b/ClassicalSharp/Network/NetworkProcessor.Helpers.cs @@ -30,7 +30,7 @@ namespace ClassicalSharp.Network { skinName = Utils.StripColours(skinName); // Server is only allowed to change our own name colours. - if (id != 0xFF) return; + if (id != EntityList.SelfID) return; if (Utils.StripColours(displayName) != game.Username) displayName = game.Username; if (skinName == "") @@ -38,7 +38,7 @@ namespace ClassicalSharp.Network { } internal void AddEntity(byte id, string displayName, string skinName, bool readPosition) { - if (id != 0xFF) { + if (id != EntityList.SelfID) { Entity oldEntity = game.Entities[id]; if (oldEntity != null) { game.EntityEvents.RaiseRemoved(id); @@ -52,10 +52,11 @@ namespace ClassicalSharp.Network { game.LocalPlayer.fetchedSkin = false; game.LocalPlayer.UpdateName(); } - if (!readPosition) return; + if (!readPosition) return; classic.ReadAbsoluteLocation(id, false); - if (id != 0xFF) return; + if (id != EntityList.SelfID) return; + LocalPlayer p = game.LocalPlayer; p.Spawn = p.Position; p.SpawnRotY = p.HeadY; @@ -66,7 +67,7 @@ namespace ClassicalSharp.Network { Entity entity = game.Entities[id]; if (entity == null) return; - if (id != 0xFF) { + if (id != EntityList.SelfID) { game.EntityEvents.RaiseRemoved(id); entity.Despawn(); game.Entities[id] = null;