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
|
@ -5,5 +5,5 @@ org.gradle.daemon=false
|
||||||
|
|
||||||
mc_version=1.19.2
|
mc_version=1.19.2
|
||||||
forge_version=43.2.3
|
forge_version=43.2.3
|
||||||
myversion=1.0.4.0
|
myversion=1.0.4.1
|
||||||
parchment_version=2022.11.27
|
parchment_version=2022.11.27
|
|
@ -4,12 +4,6 @@ public class ChunkPos {
|
||||||
public boolean isSubArea;
|
public boolean isSubArea;
|
||||||
public Points subclaim;
|
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)
|
public ChunkPos(Vector3 point1, Vector3 point2)
|
||||||
{
|
{
|
||||||
|
@ -21,4 +15,9 @@ public class ChunkPos {
|
||||||
{
|
{
|
||||||
return point.inside(subclaim.Point1, subclaim.Point2);
|
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;
|
if(Position.same(other.Position) && Dimension == other.Dimension)return true;
|
||||||
else return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ modId="libzontreck" #mandatory
|
||||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||||
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
|
||||||
# see the associated build.gradle script for how to populate this completely automatically during a build
|
# see the associated build.gradle script for how to populate this completely automatically during a build
|
||||||
version="1.0.4.0" #mandatory
|
version="1.0.4.1" #mandatory
|
||||||
# A display name for the mod
|
# A display name for the mod
|
||||||
displayName="LibZontreck" #mandatory
|
displayName="LibZontreck" #mandatory
|
||||||
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||||
|
|
Reference in a new issue