From 0c59cea0e64d1a7521b4d1ea9392ff139b0460c3 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Wed, 4 Sep 2024 14:28:04 +0800 Subject: [PATCH] Update ImageAnnotationData to include opacity --- build.gradle.kts | 2 +- .../axiom/annotations/data/ImageAnnotationData.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 42098d3..0a307d3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "com.moulberry.axiom" -version = "4.0.0" +version = "4.0.1" description = "Serverside component for Axiom on Paper" java { diff --git a/src/main/java/com/moulberry/axiom/annotations/data/ImageAnnotationData.java b/src/main/java/com/moulberry/axiom/annotations/data/ImageAnnotationData.java index 8461a0e..03949a1 100644 --- a/src/main/java/com/moulberry/axiom/annotations/data/ImageAnnotationData.java +++ b/src/main/java/com/moulberry/axiom/annotations/data/ImageAnnotationData.java @@ -5,7 +5,7 @@ import net.minecraft.network.FriendlyByteBuf; import org.joml.Quaternionf; import org.joml.Vector3f; -public record ImageAnnotationData(String imageUrl, Vector3f position, Quaternionf rotation, Direction direction, float fallbackYaw, float width, int billboardMode) implements AnnotationData { +public record ImageAnnotationData(String imageUrl, Vector3f position, Quaternionf rotation, Direction direction, float fallbackYaw, float width, float opacity, int billboardMode) implements AnnotationData { @Override public void setPosition(Vector3f position) { @@ -31,6 +31,7 @@ public record ImageAnnotationData(String imageUrl, Vector3f position, Quaternion friendlyByteBuf.writeByte(this.direction.get3DDataValue()); friendlyByteBuf.writeFloat(this.fallbackYaw); friendlyByteBuf.writeFloat(this.width); + friendlyByteBuf.writeFloat(this.opacity); friendlyByteBuf.writeByte(this.billboardMode); } @@ -46,8 +47,9 @@ public record ImageAnnotationData(String imageUrl, Vector3f position, Quaternion Direction direction = Direction.from3DDataValue(friendlyByteBuf.readByte()); float fallbackYaw = friendlyByteBuf.readFloat(); float width = friendlyByteBuf.readFloat(); + float opacity = friendlyByteBuf.readFloat(); int billboardMode = friendlyByteBuf.readByte(); - return new ImageAnnotationData(imageUrl, new Vector3f(x, y, z), new Quaternionf(rotX, rotY, rotZ, rotW), direction, fallbackYaw, width, billboardMode); + return new ImageAnnotationData(imageUrl, new Vector3f(x, y, z), new Quaternionf(rotX, rotY, rotZ, rotW), direction, fallbackYaw, width, opacity, billboardMode); } }