mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-24 05:10:42 -04:00
0.01% less hardcoding
This commit is contained in:
parent
d24d6e4ecd
commit
eca7dd5e3b
@ -58,7 +58,7 @@ namespace ClassicalSharp.Commands {
|
|||||||
|
|
||||||
public override void Execute(string[] args) {
|
public override void Execute(string[] args) {
|
||||||
game.UserEvents.BlockChanged -= BlockChanged;
|
game.UserEvents.BlockChanged -= BlockChanged;
|
||||||
block = 0xFF;
|
block = Block.Invalid;
|
||||||
mark1 = new Vector3I(int.MaxValue);
|
mark1 = new Vector3I(int.MaxValue);
|
||||||
mark2 = new Vector3I(int.MaxValue);
|
mark2 = new Vector3I(int.MaxValue);
|
||||||
persist = false;
|
persist = false;
|
||||||
|
@ -30,7 +30,7 @@ namespace ClassicalSharp.Network {
|
|||||||
skinName = Utils.StripColours(skinName);
|
skinName = Utils.StripColours(skinName);
|
||||||
|
|
||||||
// Server is only allowed to change our own name colours.
|
// 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)
|
if (Utils.StripColours(displayName) != game.Username)
|
||||||
displayName = game.Username;
|
displayName = game.Username;
|
||||||
if (skinName == "")
|
if (skinName == "")
|
||||||
@ -38,7 +38,7 @@ namespace ClassicalSharp.Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal void AddEntity(byte id, string displayName, string skinName, bool readPosition) {
|
internal void AddEntity(byte id, string displayName, string skinName, bool readPosition) {
|
||||||
if (id != 0xFF) {
|
if (id != EntityList.SelfID) {
|
||||||
Entity oldEntity = game.Entities[id];
|
Entity oldEntity = game.Entities[id];
|
||||||
if (oldEntity != null) {
|
if (oldEntity != null) {
|
||||||
game.EntityEvents.RaiseRemoved(id);
|
game.EntityEvents.RaiseRemoved(id);
|
||||||
@ -52,10 +52,11 @@ namespace ClassicalSharp.Network {
|
|||||||
game.LocalPlayer.fetchedSkin = false;
|
game.LocalPlayer.fetchedSkin = false;
|
||||||
game.LocalPlayer.UpdateName();
|
game.LocalPlayer.UpdateName();
|
||||||
}
|
}
|
||||||
if (!readPosition) return;
|
|
||||||
|
|
||||||
|
if (!readPosition) return;
|
||||||
classic.ReadAbsoluteLocation(id, false);
|
classic.ReadAbsoluteLocation(id, false);
|
||||||
if (id != 0xFF) return;
|
if (id != EntityList.SelfID) return;
|
||||||
|
|
||||||
LocalPlayer p = game.LocalPlayer;
|
LocalPlayer p = game.LocalPlayer;
|
||||||
p.Spawn = p.Position;
|
p.Spawn = p.Position;
|
||||||
p.SpawnRotY = p.HeadY;
|
p.SpawnRotY = p.HeadY;
|
||||||
@ -66,7 +67,7 @@ namespace ClassicalSharp.Network {
|
|||||||
Entity entity = game.Entities[id];
|
Entity entity = game.Entities[id];
|
||||||
if (entity == null) return;
|
if (entity == null) return;
|
||||||
|
|
||||||
if (id != 0xFF) {
|
if (id != EntityList.SelfID) {
|
||||||
game.EntityEvents.RaiseRemoved(id);
|
game.EntityEvents.RaiseRemoved(id);
|
||||||
entity.Despawn();
|
entity.Despawn();
|
||||||
game.Entities[id] = null;
|
game.Entities[id] = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user