From 3712399a03b577949f9218a28993b19e4b8d0744 Mon Sep 17 00:00:00 2001 From: zontreck Date: Mon, 10 Mar 2025 10:55:04 -0700 Subject: [PATCH] Optimize by using the existing helper functions --- AriasServerUtils/RTPFactory.cs | 20 ++++++++------------ AriasServerUtils/modinfo.json | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/AriasServerUtils/RTPFactory.cs b/AriasServerUtils/RTPFactory.cs index 3f36d9f..5f81d53 100644 --- a/AriasServerUtils/RTPFactory.cs +++ b/AriasServerUtils/RTPFactory.cs @@ -49,13 +49,9 @@ public class RTPFactory /// A safe position if able to be found public static PlayerPosition GetSafePosition(RTPData data, RTPPosition position) { - PlayerPosition PPos = PlayerPosition.from(data.player.Entity); - BlockPos check = new( - x: position.x, - y: 1, - z: position.z, - dim: position.dimension - ); + PlayerPosition PPos = data.LastPosition.GetPlayerPosition(); + BlockPos check = data.LastPosition.GetBlockPos(); + check.Y = 1; int height = ServerUtilities.API.World.BlockAccessor.GetTerrainMapheightAt(check); @@ -110,12 +106,12 @@ public class RTPFactory chunk.dim = position.dimension; chunk.rtp = rtp; - // Load the chunk - worldManager.LoadChunkColumnForDimension(chunk.ChunkX, chunk.ChunkZ, chunk.dim); - // Log the request ChunkChecks.Add(chunk); + // Load the chunk + worldManager.LoadChunkColumnPriority(chunk.ChunkX, chunk.ChunkZ); + if (rtp.NumTriesRemaining <= 0) { // Send failure message to the player @@ -214,7 +210,7 @@ public class RTPPosition this.dimension = dim; } - PlayerPosition GetPlayerPosition() + public PlayerPosition GetPlayerPosition() { return new PlayerPosition { @@ -225,7 +221,7 @@ public class RTPPosition }; } - BlockPos GetBlockPos() + public BlockPos GetBlockPos() { return new BlockPos(new Vec3i(x, y, z), dimension); } diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index cd1afab..9bd42e7 100644 --- a/AriasServerUtils/modinfo.json +++ b/AriasServerUtils/modinfo.json @@ -3,8 +3,8 @@ "modid": "ariasserverutils", "name": "Aria's Server Utilities", "authors": ["zontreck"], - "description": "A collection of server utilities\n\nBuild Date: 03-10-2025 @ 10:36 AM MST", - "version": "1.0.6-dev.13", + "description": "A collection of server utilities\n\nBuild Date: 03-10-2025 @ 10:54 AM MST", + "version": "1.0.6-dev.14", "dependencies": { "game": "" }