mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
Move death and block walkthrough handling to player movement handling, fixes #385
This commit is contained in:
parent
3f33038e55
commit
91f3632a92
@ -301,7 +301,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
void HandleMovement(byte[] packet) {
|
||||
if (!loggedIn || trainGrab || following != "") return;
|
||||
if (!loggedIn || trainGrab || following != "") { CheckBlocks(Pos); return; }
|
||||
if (HasCpeExt(CpeExt.HeldBlock)) {
|
||||
RawHeldBlock = ExtBlock.FromRaw(packet[1]);
|
||||
}
|
||||
@ -320,6 +320,7 @@ namespace MCGalaxy {
|
||||
int offset = 8 + (hasExtPositions ? 6 : 0);
|
||||
byte yaw = packet[offset + 0], pitch = packet[offset + 1];
|
||||
Position next = new Position(x, y, z);
|
||||
CheckBlocks(next);
|
||||
|
||||
if (Server.Countdown.HandlesMovement(this, next, yaw, pitch))
|
||||
return;
|
||||
@ -340,6 +341,14 @@ namespace MCGalaxy {
|
||||
if (IsAfk) CmdAfk.ToggleAfk(this, "");
|
||||
}
|
||||
|
||||
void CheckBlocks(Position pos) {
|
||||
Vec3U16 P = (Vec3U16)pos.BlockCoords;
|
||||
if (level.Death) CheckSurvival(P.X, P.Y, P.Z);
|
||||
|
||||
CheckBlock();
|
||||
oldIndex = level.PosToInt(P.X, P.Y, P.Z);
|
||||
}
|
||||
|
||||
bool Moved() { return lastRot.RotY != Rot.RotY || lastRot.HeadX != Rot.HeadX; }
|
||||
|
||||
internal void CheckSurvival(ushort x, ushort y, ushort z) {
|
||||
|
@ -60,12 +60,6 @@ namespace MCGalaxy.Tasks {
|
||||
p.possess = "";
|
||||
}
|
||||
|
||||
Vec3U16 P = (Vec3U16)p.Pos.BlockCoords;
|
||||
if (p.level.Death)
|
||||
p.CheckSurvival(P.X, P.Y, P.Z);
|
||||
p.CheckBlock();
|
||||
p.oldIndex = p.level.PosToInt(P.X, P.Y, P.Z);
|
||||
|
||||
SchedulerTask[] tasks = p.CriticalTasks.Items;
|
||||
for (int i = 0; i < tasks.Length; i++) {
|
||||
SchedulerTask task = tasks[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user