Add an extra property to WorldPosition

This commit is contained in:
Tara 2023-01-07 17:37:20 -07:00
parent 7f2dca58d1
commit 83a2bff15b
3 changed files with 13 additions and 2 deletions

View file

@ -5,4 +5,4 @@ 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.2.1 myversion=1.0.2.2

View file

@ -13,6 +13,7 @@ public class WorldPosition
public Vector3 Position; public Vector3 Position;
public String Dimension; public String Dimension;
public String DimSafe;
public WorldPosition(CompoundTag tag, boolean pretty) throws InvalidDeserialization public WorldPosition(CompoundTag tag, boolean pretty) throws InvalidDeserialization
{ {
@ -25,18 +26,28 @@ public class WorldPosition
Dimension = tag.getString("Dimension"); Dimension = tag.getString("Dimension");
} }
calcDimSafe();
} }
public WorldPosition(Vector3 pos, String dim) public WorldPosition(Vector3 pos, String dim)
{ {
Position=pos; Position=pos;
Dimension=dim; Dimension=dim;
calcDimSafe();
} }
public WorldPosition(Vector3 pos, ServerLevel lvl) public WorldPosition(Vector3 pos, ServerLevel lvl)
{ {
Position=pos; Position=pos;
Dimension = lvl.dimension().location().getNamespace() + ":"+lvl.dimension().location().getPath(); Dimension = lvl.dimension().location().getNamespace() + ":"+lvl.dimension().location().getPath();
calcDimSafe();
}
public void calcDimSafe()
{
ServerLevel lvl = getActualDimension();
DimSafe = lvl.dimension().location().getNamespace() + "-" + lvl.dimension().location().getPath();
} }
@Override @Override

View file

@ -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.2.1" #mandatory version="1.0.2.2" #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/