Add a method to world position to get chunk position using minecraft positions
This commit is contained in:
parent
f911d4e9d2
commit
9636519147
4 changed files with 15 additions and 8 deletions
|
@ -4,12 +4,6 @@ public class ChunkPos {
|
|||
public boolean isSubArea;
|
||||
public Points subclaim;
|
||||
|
||||
public ChunkPos(Vector2 chunkPos)
|
||||
{
|
||||
isSubArea=false;
|
||||
Vector3 min = new Vector3(chunkPos.x, -70, chunkPos.y);
|
||||
subclaim = new Points(min, min.add(new Vector3(15, 300, 15)));
|
||||
}
|
||||
|
||||
public ChunkPos(Vector3 point1, Vector3 point2)
|
||||
{
|
||||
|
@ -21,4 +15,9 @@ public class ChunkPos {
|
|||
{
|
||||
return point.inside(subclaim.Point1, subclaim.Point2);
|
||||
}
|
||||
|
||||
public static ChunkPos getChunkPos(WorldPosition pos)
|
||||
{
|
||||
return pos.getChunkPos();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,4 +113,12 @@ public class WorldPosition
|
|||
if(Position.same(other.Position) && Dimension == other.Dimension)return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
public ChunkPos getChunkPos()
|
||||
{
|
||||
net.minecraft.world.level.ChunkPos mcChunk = getActualDimension().getChunkAt(Position.asBlockPos()).getPos();
|
||||
ChunkPos pos = new ChunkPos(new Vector3(mcChunk.getMinBlockX(),-70,mcChunk.getMinBlockZ()), new Vector3(mcChunk.getMaxBlockX(), 400, mcChunk.getMaxBlockZ()));
|
||||
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue