Add some more utility functions

This commit is contained in:
zontreck 2024-04-07 19:50:32 -07:00
parent ed9d9bd249
commit a4da2bb52b
10 changed files with 164 additions and 47 deletions

View file

@ -1,11 +1,11 @@
package dev.zontreck.libzontreck.api;
import dev.zontreck.libzontreck.vectors.Vector2d;
import dev.zontreck.libzontreck.vectors.Vector2f;
import dev.zontreck.libzontreck.vectors.Vector2i;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.phys.Vec2;
public interface Vector2
public interface Vector2<T>
{
/**
* Converts the current Vector2 representation into a minecraft Vec2
@ -62,7 +62,7 @@ public interface Vector2
* Converts, if necessary, to Vector2d
* @return A vector2d instance
*/
Vector2d asVector2d();
Vector2f asVector2f();
/**
* Converts, if necessary, to Vector2i
@ -123,4 +123,16 @@ public interface Vector2
* @return New instance
*/
Vector2 moveDown();
/**
* Gets the X value
* @return X
*/
T getX();
/**
* Gets the Y value
* @return Y
*/
T getY();
}

View file

@ -1,16 +1,13 @@
package dev.zontreck.libzontreck.api;
import dev.zontreck.libzontreck.vectors.Vector2d;
import dev.zontreck.libzontreck.vectors.Vector2i;
import dev.zontreck.libzontreck.vectors.Vector3d;
import dev.zontreck.libzontreck.vectors.Vector3i;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
public interface Vector3
public interface Vector3<T>
{
/**
* Converts the current Vector3 representation into a minecraft Vec3
@ -140,4 +137,22 @@ public interface Vector3
* @return New instance
*/
Vector3 moveDown();
/**
* Gets the X value
* @return X
*/
T getX();
/**
* Gets the Y value
* @return Y
*/
T getY();
/**
* Gets the Z value
* @return Z
*/
T getZ();
}