Skip to content

Commit

Permalink
Update VectorSerializer.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chyzman authored Oct 30, 2023
1 parent ebd3108 commit 594ed66
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/java/io/wispforest/owo/util/VectorSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ public static NbtCompound putf(NbtCompound nbt, String key, Vector3f vec3f) {
*/
public static NbtCompound puti(NbtCompound nbt, String key, Vec3i vec3i) {

NbtList vectorArray = new NbtList();
vectorArray.add(NbtInt.of(vec3i.getX()));
vectorArray.add(NbtInt.of(vec3i.getY()));
vectorArray.add(NbtInt.of(vec3i.getZ()));
NbtIntArray vectorArray = new NbtIntArray(List.of(vec3i.getX(), vec3i.getY(), vec3i.getZ()));

nbt.put(key, vectorArray);

Expand Down Expand Up @@ -124,10 +121,10 @@ public static Vector3f getf(NbtCompound nbt, String key) {
*/
public static Vec3i geti(NbtCompound nbt, String key) {

NbtList vectorArray = nbt.getList(key, NbtElement.INT_TYPE);
int x = vectorArray.getInt(0);
int y = vectorArray.getInt(1);
int z = vectorArray.getInt(2);
int[] vectorArray = nbt.getIntArray(key);
int x = vectorArray[0];
int y = vectorArray[1];
int z = vectorArray[2];

return new Vec3i(x, y, z);
}
Expand Down

0 comments on commit 594ed66

Please sign in to comment.