diff --git a/gradle.properties b/gradle.properties index 43b6031..6339287 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ org.gradle.daemon=false mc_version=1.19.2 forge_version=43.2.3 -myversion=1.0.2.3 \ No newline at end of file +myversion=1.0.2.4 \ No newline at end of file diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java b/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java index c03c998..e75473c 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/Vector2.java @@ -3,7 +3,6 @@ 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; public class Vector2 { diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java b/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java index f5794be..19f21df 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/Vector3.java @@ -1,5 +1,8 @@ package dev.zontreck.libzontreck.vectors; +import java.util.ArrayList; +import java.util.List; + import dev.zontreck.libzontreck.exceptions.InvalidDeserialization; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -71,6 +74,103 @@ public class Vector3 } } + public List makeCube(Vector3 other) + { + List vecs = new ArrayList<>(); + Vector3 work = new Vector3(); + + double xx = x; + double yy = y; + double zz = z; + + int yState = 0; + int zState = 0; + int xState = 0; + + for(xx = Math.round(x); (xx != Math.round(other.x) && xState != 2);) + { + for(zz = Math.round(z); (zz != Math.round(other.z) && zState != 2);) + { + for(yy = Math.round(y); (yy != Math.round(other.y) && yState != 2);) + { + work = new Vector3(xx, yy, zz); + + if(!vecs.contains(work)) vecs.add(work); + + if(yy > other.y) + { + yy -= 1.0; + if(yy == Math.round(other.y) && yState == 0) + { + yState++; + }else{ + if(yState == 1) + { + yState ++; + } + } + } else if(yy < other.y) + { + yy += 1.0; + if(yy == Math.round(other.y) && yState == 0){ + yState ++; + }else { + if(yState == 1)yState++; + } + } + } + + yState=0; + work = new Vector3(xx,yy,zz); + + if(!vecs.contains(work)) vecs.add(work); + + if(zz > other.z) + { + zz -= 1.0; + + if(zz == Math.round(other.z) && zState == 0)zState++; + else{ + if(zState == 1)zState++; + } + }else if(zz < other.z) + { + zz += 1.0; + + if(zz == Math.round(other.z) && zState == 0)zState++; + else { + if(zState==1)zState++; + } + } + } + + zState=0; + work = new Vector3(xx,yy,zz); + + if(!vecs.contains(work)) vecs.add(work); + + if(xx > other.x) + { + xx -= 1.0; + + if(xx == Math.round(other.x) && xState == 0) xState++; + else{ + if(xState == 1)xState++; + } + }else if(xx < other.x) + { + xx += 1.0; + + if(xx == Math.round(other.x) && xState==0)xState++; + else{ + if(xState==1)xState++; + } + } + } + + return vecs; + } + public Vector3 subtract(Vector3 other) { return new Vector3(x-other.x, y-other.y, z-other.z); diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java b/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java index acab1c3..c031220 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java @@ -5,7 +5,6 @@ import dev.zontreck.libzontreck.exceptions.InvalidDeserialization; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; public class WorldPosition diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 398f3ad..f3bbca7 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.2.3" #mandatory +version="1.0.2.4" #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/