generated from AriasCreations/vsmodtemplate
Optimize by using the existing helper functions
This commit is contained in:
parent
6598eb44da
commit
3712399a03
2 changed files with 10 additions and 14 deletions
|
@ -49,13 +49,9 @@ public class RTPFactory
|
||||||
/// <returns>A safe position if able to be found</returns>
|
/// <returns>A safe position if able to be found</returns>
|
||||||
public static PlayerPosition GetSafePosition(RTPData data, RTPPosition position)
|
public static PlayerPosition GetSafePosition(RTPData data, RTPPosition position)
|
||||||
{
|
{
|
||||||
PlayerPosition PPos = PlayerPosition.from(data.player.Entity);
|
PlayerPosition PPos = data.LastPosition.GetPlayerPosition();
|
||||||
BlockPos check = new(
|
BlockPos check = data.LastPosition.GetBlockPos();
|
||||||
x: position.x,
|
check.Y = 1;
|
||||||
y: 1,
|
|
||||||
z: position.z,
|
|
||||||
dim: position.dimension
|
|
||||||
);
|
|
||||||
|
|
||||||
int height = ServerUtilities.API.World.BlockAccessor.GetTerrainMapheightAt(check);
|
int height = ServerUtilities.API.World.BlockAccessor.GetTerrainMapheightAt(check);
|
||||||
|
|
||||||
|
@ -110,12 +106,12 @@ public class RTPFactory
|
||||||
chunk.dim = position.dimension;
|
chunk.dim = position.dimension;
|
||||||
chunk.rtp = rtp;
|
chunk.rtp = rtp;
|
||||||
|
|
||||||
// Load the chunk
|
|
||||||
worldManager.LoadChunkColumnForDimension(chunk.ChunkX, chunk.ChunkZ, chunk.dim);
|
|
||||||
|
|
||||||
// Log the request
|
// Log the request
|
||||||
ChunkChecks.Add(chunk);
|
ChunkChecks.Add(chunk);
|
||||||
|
|
||||||
|
// Load the chunk
|
||||||
|
worldManager.LoadChunkColumnPriority(chunk.ChunkX, chunk.ChunkZ);
|
||||||
|
|
||||||
if (rtp.NumTriesRemaining <= 0)
|
if (rtp.NumTriesRemaining <= 0)
|
||||||
{
|
{
|
||||||
// Send failure message to the player
|
// Send failure message to the player
|
||||||
|
@ -214,7 +210,7 @@ public class RTPPosition
|
||||||
this.dimension = dim;
|
this.dimension = dim;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerPosition GetPlayerPosition()
|
public PlayerPosition GetPlayerPosition()
|
||||||
{
|
{
|
||||||
return new PlayerPosition
|
return new PlayerPosition
|
||||||
{
|
{
|
||||||
|
@ -225,7 +221,7 @@ public class RTPPosition
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos GetBlockPos()
|
public BlockPos GetBlockPos()
|
||||||
{
|
{
|
||||||
return new BlockPos(new Vec3i(x, y, z), dimension);
|
return new BlockPos(new Vec3i(x, y, z), dimension);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 @ 10:36 AM MST",
|
"description": "A collection of server utilities\n\nBuild Date: 03-10-2025 @ 10:54 AM MST",
|
||||||
"version": "1.0.6-dev.13",
|
"version": "1.0.6-dev.14",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": ""
|
"game": ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue