generated from AriasCreations/vsmodtemplate
Patch rtp in already loaded chunks
This commit is contained in:
parent
cf7084c164
commit
bda8e49ee1
2 changed files with 31 additions and 4 deletions
|
@ -168,9 +168,36 @@ public class RTPFactory
|
||||||
// Log the request
|
// Log the request
|
||||||
ChunkChecks.Add(chunk);
|
ChunkChecks.Add(chunk);
|
||||||
|
|
||||||
// Load the chunk
|
// Check if the chunk's coordinates are loaded
|
||||||
worldManager.LoadChunkColumnPriority(chunk.ChunkX, chunk.ChunkZ);
|
var cxCheck = ServerUtilities.API.World.IsFullyLoadedChunk(position.GetBlockPos());
|
||||||
|
if (cxCheck)
|
||||||
|
{
|
||||||
|
// Process the check here, no need to load
|
||||||
|
var posX = GetSafePosition(rtp, position);
|
||||||
|
if (posX == null)
|
||||||
|
{
|
||||||
|
// Let this get checked again
|
||||||
|
ServerUtilities.API.Logger.Notification("position null: resume search");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// Found! Perform teleport and remove the RTP Check
|
||||||
|
RTPCache.Remove(rtp);
|
||||||
|
posX.Merge(rtp.player.Entity);
|
||||||
|
|
||||||
|
ServerUtilities.SendMessageTo(rtp.player, Lang.Get($"{ServerUtilities.MOD_ID}:rtp", GetDistance(new Vec2i(rtp.StartPosition.X, rtp.StartPosition.Z), new Vec2i(posX.X, posX.Z))));
|
||||||
|
|
||||||
|
ServerUtilities.API.Logger.Notification("position found");
|
||||||
|
}
|
||||||
|
|
||||||
|
ChunkChecks.Remove(chunk);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Load the chunk
|
||||||
|
worldManager.LoadChunkColumnPriority(chunk.ChunkX, chunk.ChunkZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
"modid": "ariasserverutils",
|
"modid": "ariasserverutils",
|
||||||
"name": "Aria's Server Utilities",
|
"name": "Aria's Server Utilities",
|
||||||
"authors": ["zontreck"],
|
"authors": ["zontreck"],
|
||||||
"description": "A collection of server utilities\n\nBuild Date: 03-10-2025 @ 11:52 AM MST",
|
"description": "A collection of server utilities\n\nBuild Date: 03-10-2025 @ 11:55 AM MST",
|
||||||
"version": "1.0.6-dev.17",
|
"version": "1.0.6-dev.18",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": ""
|
"game": ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue