diff --git a/gradle.properties b/gradle.properties index d41eef5..d4a7c68 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,5 +4,5 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false mc_version=1.19.2 -forge_version=43.1.16 -myversion=1.0.1.0 \ No newline at end of file +forge_version=43.1.43 +myversion=1.0.1.1 \ No newline at end of file diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/NonAbsVector3.java b/src/main/java/dev/zontreck/libzontreck/vectors/NonAbsVector3.java index acb320d..6ca3c1a 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/NonAbsVector3.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/NonAbsVector3.java @@ -1,5 +1,7 @@ package dev.zontreck.libzontreck.vectors; +import net.minecraft.nbt.CompoundTag; + /* * This is a non-serializable instanced Vector that is meant to slam positions down as a integer */ @@ -15,4 +17,32 @@ public class NonAbsVector3 y = Math.round(origin.y); z = Math.round(origin.z); } + + + public CompoundTag serialize() + { + CompoundTag tag = new CompoundTag(); + tag.putLong("x", x); + tag.putLong("y", y); + tag.putLong("z", z); + + return tag; + } + + public NonAbsVector3(CompoundTag tag) { + this.deserialize(tag); + } + public void deserialize(CompoundTag tag) + { + x=tag.getLong("x"); + y=tag.getLong("y"); + z=tag.getLong("z"); + } + + + public boolean same(NonAbsVector3 other) + { + if(x == other.x && y==other.y && z==other.z)return true; + else return false; + } } diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java b/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java index daf9e5e..c03c998 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java @@ -1,6 +1,7 @@ package dev.zontreck.libzontreck.vectors; import dev.zontreck.libzontreck.exceptions.InvalidDeserialization; +import net.minecraft.nbt.CompoundTag; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; @@ -65,4 +66,29 @@ public class Vector2 { return "<"+String.valueOf(x)+", "+String.valueOf(y) + ">"; } + + + public CompoundTag serialize() + { + CompoundTag tag = new CompoundTag(); + tag.putFloat("x", x); + tag.putFloat("y", y); + + return tag; + } + + public Vector2(CompoundTag tag) { + this.deserialize(tag); + } + public void deserialize(CompoundTag tag) + { + x=tag.getFloat("x"); + y=tag.getFloat("y"); + } + + public boolean same(Vector2 other) + { + if(x == other.x && y==other.y)return true; + else return false; + } } diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java b/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java index 6ec105e..f5794be 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java @@ -137,4 +137,11 @@ public class Vector3 y=tag.getDouble("y"); z=tag.getDouble("z"); } + + + public boolean same(Vector3 other) + { + if(x == other.x && y==other.y && z==other.z)return true; + else return false; + } } diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java b/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java index 6479536..328acef 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java @@ -92,4 +92,11 @@ public class WorldPosition return dimL; } + + + public boolean same(WorldPosition other) + { + if(Position.same(other.Position) && Dimension == other.Dimension)return true; + else return false; + } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index e84b498..ca19a52 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -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 # ${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 -version="1.0.1.0" #mandatory +version="1.0.1.1" #mandatory # A display name for the mod 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/