mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-08-03 19:36:14 -04:00
Try to fix EntityList deadlocks again (Thanks UnknownShadow200)
This commit is contained in:
parent
001c960395
commit
af8fd02659
@ -182,7 +182,6 @@ namespace MCGalaxy
|
||||
|
||||
string model = Chat.Format(m, pl, true, false);
|
||||
|
||||
OnSendingModelEvent.Call(e, ref model, pl);
|
||||
pl.EntityList.SendModel(e, model);
|
||||
pl.EntityList.SendScales(e);
|
||||
}
|
||||
|
@ -199,12 +199,14 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the given entity. Returns true if an entity was spawned, otherwise false if it could not immediately be spawned (it will spawn later if enough are removed)
|
||||
/// Adds the given entity and calls OnSendingModelEvent. Returns true if an entity was spawned, otherwise false if it could not immediately be spawned (it will spawn later if enough are removed)
|
||||
/// If this returns false and tabList is true, once the entity spawns, it will be added to the tab list.
|
||||
/// </summary>
|
||||
public bool Add(Entity e, Position pos, Orientation rot, string skin, string name, string model, bool tabList) {
|
||||
bool self = e == p;
|
||||
|
||||
OnSendingModelEvent.Call(e, ref model, p);
|
||||
|
||||
lock (locker) {
|
||||
if (freeIDs.Count > 0 || self) {
|
||||
VisibleEntity vis;
|
||||
@ -294,7 +296,11 @@ namespace MCGalaxy {
|
||||
p.Session.SendRemoveEntity(vis.id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls OnSendingModelEvent and changes the model of the given entity.
|
||||
/// </summary>
|
||||
public void SendModel(Entity e, string model) {
|
||||
OnSendingModelEvent.Call(e, ref model, p);
|
||||
lock (locker) {
|
||||
VisibleEntity vis;
|
||||
if (!visible.TryGetValue(e, out vis)) return;
|
||||
@ -303,7 +309,6 @@ namespace MCGalaxy {
|
||||
}
|
||||
void _SendModel(VisibleEntity vis, string model, bool spawning) {
|
||||
if (p.hasChangeModel) {
|
||||
OnSendingModelEvent.Call(vis.e, ref model, p);
|
||||
if (!(spawning && model.CaselessEq("humanoid"))) p.Session.SendChangeModel(vis.id, model);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user