0.01% less hardcoding

This commit is contained in:
UnknownShadow200 2017-02-28 08:45:04 +11:00
parent d24d6e4ecd
commit eca7dd5e3b
2 changed files with 7 additions and 6 deletions

View File

@ -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;

View File

@ -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;