From dfbc26fd0657f36d1e5ed29b0f3d4fbe871234ee Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 03:06:15 -0500 Subject: [PATCH 01/21] Bump version to 3.6.1-PRE --- api/pom.xml | 2 +- plugin/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index e8515c20..47aa9c63 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.6.0 + 3.6.1-PRE api diff --git a/plugin/pom.xml b/plugin/pom.xml index da30ac15..208819bb 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.6.0 + 3.6.1-PRE plugin diff --git a/pom.xml b/pom.xml index d74d6e75..b5e86510 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.6.0 + 3.6.1-PRE pom DisplayEntityUtils From f26766353ce50ddc4e4ad83053a314187284939f Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 03:06:48 -0500 Subject: [PATCH 02/21] Add #rotate and #set to PivotAxis, to rotate and set angle on a Quaternion --- .../displayentityutils/utils/PivotAxis.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java b/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java index bb16b0b7..4f02999f 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java @@ -1,7 +1,46 @@ package net.donnypz.displayentityutils.utils; +import org.jetbrains.annotations.NotNull; +import org.joml.Quaternionf; +import org.joml.Vector3f; + public enum PivotAxis { X, Y, Z; + + /** + * Rotate a quaternion on this {@link PivotAxis}'s axis + * @param quaternionf the quaternion + * @param angleInDegrees the angle in degrees + * @return a new {@link Quaternionf} with the rotation applied + */ + public @NotNull Quaternionf rotate(@NotNull Quaternionf quaternionf, float angleInDegrees){ + Quaternionf newRot = new Quaternionf(quaternionf); + float angleDeg = (float) Math.toRadians(angleInDegrees); + switch(this){ + case X -> newRot.rotateX(angleDeg); + case Y -> newRot.rotateY(angleDeg); + case Z -> newRot.rotateZ(angleDeg); + } + return newRot; + } + + /** + * Set a quaternion's axis to a given angle + * @param quaternionf the quaternion + * @param angleInDegrees the angle in degrees + * @return a new {@link Quaternionf} with the axis representative of this set + */ + public @NotNull Quaternionf set(@NotNull Quaternionf quaternionf, float angleInDegrees){ + Vector3f euler = quaternionf.getEulerAnglesXYZ(new Vector3f()); + float angleRad = (float) Math.toRadians(angleInDegrees); + + switch (this) { + case X -> euler.x = angleRad; + case Y -> euler.y = angleRad; + case Z -> euler.z = angleRad; + } + return new Quaternionf().rotateXYZ(euler.x, euler.y, euler.z); + } } From 0bfc444acece66a9f9dd488c624b9261dfbc5185 Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 03:34:39 -0500 Subject: [PATCH 03/21] update setting logic --- .../displayentityutils/utils/PivotAxis.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java b/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java index 4f02999f..f7a02b09 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java @@ -33,14 +33,26 @@ public enum PivotAxis { * @return a new {@link Quaternionf} with the axis representative of this set */ public @NotNull Quaternionf set(@NotNull Quaternionf quaternionf, float angleInDegrees){ - Vector3f euler = quaternionf.getEulerAnglesXYZ(new Vector3f()); float angleRad = (float) Math.toRadians(angleInDegrees); - switch (this) { - case X -> euler.x = angleRad; - case Y -> euler.y = angleRad; - case Z -> euler.z = angleRad; + Quaternionf q = new Quaternionf(); + switch (this){ + case X -> { + q.rotateX(angleRad); + q.rotateY(quaternionf.y); + q.rotateZ(quaternionf.z); + } + case Y -> { + q.rotateX(quaternionf.x); + q.rotateY(angleRad); + q.rotateZ(quaternionf.z); + } + case Z -> { + q.rotateX(quaternionf.x); + q.rotateY(quaternionf.y); + q.rotateZ(angleRad); + } } - return new Quaternionf().rotateXYZ(euler.x, euler.y, euler.z); + return q; } } From 9c1b54cda978c3edd55ad60d1ef7c6b131ebe7cd Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 04:18:48 -0500 Subject: [PATCH 04/21] Add setting of group rotation angle on axis --- .../displayentityutils/DisplayKeys.java | 1 + .../utils/DisplayEntities/ActiveGroup.java | 113 +++++++++++++++++- .../utils/DisplayEntities/DisplayEntity.java | 15 ++- .../PacketDisplayEntityGroup.java | 4 + .../SpawnedDisplayEntityGroup.java | 45 +++---- .../utils/DisplayUtils.java | 22 +--- .../displayentityutils/utils/MathUtils.java | 47 ++++++++ .../displayentityutils/utils/PacketUtils.java | 18 +-- .../command/group/GroupCMD.java | 1 + .../command/group/GroupSetRotationCMD.java | 69 +++++++++++ 10 files changed, 260 insertions(+), 75 deletions(-) create mode 100644 api/src/main/java/net/donnypz/displayentityutils/utils/MathUtils.java create mode 100644 plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java diff --git a/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java b/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java index 1a87b0b4..291d7f88 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java +++ b/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java @@ -7,6 +7,7 @@ public final class DisplayKeys { public static final class Group{ public static final NamespacedKey GROUP_TAG = new NamespacedKey(DisplayAPI.getPlugin(), "groupTag"); public static final NamespacedKey CHUNK_PACKET_GROUP = new NamespacedKey(DisplayAPI.getPlugin(), "chunkpacketgroups"); + public static final NamespacedKey GROUP_ROTATION = new NamespacedKey(DisplayAPI.getPlugin(), "group_rotation"); } public static final class Part{ diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java index ea8400b3..1eba7edf 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java @@ -7,12 +7,10 @@ import net.donnypz.displayentityutils.managers.DEUUser; import net.donnypz.displayentityutils.managers.DisplayAnimationManager; import net.donnypz.displayentityutils.managers.LoadMethod; -import net.donnypz.displayentityutils.utils.Direction; +import net.donnypz.displayentityutils.utils.*; import net.donnypz.displayentityutils.utils.DisplayEntities.concurrent.GroupTeleportCompletableFuture; import net.donnypz.displayentityutils.utils.DisplayEntities.machine.DisplayStateMachine; import net.donnypz.displayentityutils.utils.DisplayEntities.machine.MachineState; -import net.donnypz.displayentityutils.utils.FollowType; -import net.donnypz.displayentityutils.utils.PacketUtils; import net.donnypz.displayentityutils.utils.controller.GroupFollowProperties; import org.bukkit.Bukkit; import org.bukkit.Color; @@ -23,8 +21,10 @@ import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.joml.Quaternionf; import org.joml.Vector3f; +import java.nio.ByteBuffer; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicInteger; @@ -49,13 +49,13 @@ public abstract class ActiveGroup extends ActivePartHolder protected MachineState currentMachineState; + protected Quaternionf rotation = new Quaternionf(); private volatile float scaleMultiplier = 1; private volatile Vector rideOffset = new Vector(); private volatile int lastAnimatedTick = -1; private boolean isSelectable = true; - /** * Get this group's unique ID created during the current game session * @return the group's ID @@ -175,6 +175,111 @@ public void removeCulling(){ } } + /** + * Set the transformation rotation of this group, optionally pivoting non-display entities as well + * @param axis the axis to rotate on + * @param pivotNonDisplays whether non-displays should be pivoted + */ + public void setGroupRotation(float angleInDegrees, @NotNull PivotAxis axis, boolean pivotNonDisplays){ + Quaternionf newRotation = new Quaternionf(this.rotation); + newRotation = axis.set(newRotation, angleInDegrees); + setGroupRotation(newRotation, pivotNonDisplays); + } + + /** + * Set the transformation rotation of this group, optionally pivoting non-display entities as well + * @param rotation the local space rotation to set the group's orientation to + * @param pivotNonDisplays whether non-displays should be pivoted + */ + public void setGroupRotation(@NotNull Quaternionf rotation, boolean pivotNonDisplays){ + Quaternionf delta = new Quaternionf(this.rotation) + .invert() + .mul(rotation); + + this.rotate(delta, false); + + if (pivotNonDisplays){ + this.pivot(delta, getLocation(), false); + } + } + + @Override + public void rotateAround(@NotNull Quaternionf rotation, @NotNull Location pivotLocation, boolean worldSpace) { + if (!worldSpace) { + this.rotation.mul(rotation); + } else { + Location groupLoc = getLocation(); + Quaternionf worldSpaceRot = MathUtils.applyWorldSpaceRotation(rotation, groupLoc.getPitch(), groupLoc.getYaw()); + worldSpaceRot.mul(this.rotation, this.rotation); + } + super.rotateAround(rotation, pivotLocation, worldSpace); + this.saveGroupRotation(); + } + + @Override + public void pivotOrRotateAround(@NotNull Quaternionf rotation, @NotNull Location pivotLocation, boolean worldSpace) { + if (!worldSpace) { + this.rotation.mul(rotation); + } else { + Location groupLoc = getLocation(); + Quaternionf worldSpaceRot = MathUtils.applyWorldSpaceRotation(rotation, groupLoc.getPitch(), groupLoc.getYaw()); + worldSpaceRot.mul(this.rotation, this.rotation); + } + super.pivotOrRotateAround(rotation, pivotLocation, worldSpace); + this.saveGroupRotation(); + } + + protected abstract void saveGroupRotation(); + + protected static byte @NotNull[] getRotationByteArray(@NotNull Quaternionf rotation){ + Quaternionf q = new Quaternionf(rotation); + + ByteBuffer buf = ByteBuffer.allocate(16); //4 bytes per quaternion val + buf.putFloat(q.x); + buf.putFloat(q.y); + buf.putFloat(q.z); + buf.putFloat(q.w); + return buf.array(); + } + + protected @NotNull Quaternionf getRotation(byte[] quaternionBytes){ + if (quaternionBytes == null || quaternionBytes.length != 16) return new Quaternionf(); + + ByteBuffer buf = ByteBuffer.wrap(quaternionBytes); + return new Quaternionf( + buf.getFloat(), + buf.getFloat(), + buf.getFloat(), + buf.getFloat() + ); + } + + protected void setRotation(PersistentDataContainer pdc){ + byte[] rotation = pdc.get(DisplayKeys.Group.GROUP_ROTATION, PersistentDataType.BYTE_ARRAY); + this.rotation = getRotation(rotation); + } + + + public @NotNull Quaternionf getGroupRotation(){ + return new Quaternionf(this.rotation); + } + + /** + * Reset the group's rotation to its default orientation + * @param pivotNonDisplays whether non-displays should be pivoted + */ + public void resetGroupRotation(boolean pivotNonDisplays){ + setGroupRotation(new Quaternionf(), pivotNonDisplays); + } + + /** + * Make the group's current rotation its default orientation, resetting the group's + * stored rotation but retaining the current orientation + */ + public void rebaseGroupRotation(){ + this.rotation = new Quaternionf(); + } + /** * Change the scale of all parts in this group by the given scale multiplier * @param newScaleMultiplier the scale multiplier to apply to this group diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java index 409fd6fd..19c9c80e 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java @@ -69,10 +69,13 @@ else if (type == Type.TEXT) { try{ PersistentDataContainer pdc = new ItemStack(Material.STICK).getItemMeta().getPersistentDataContainer(); pdc.set(DisplayKeys.Part.PART_TAGS, PersistentDataType.LIST.strings(), new ArrayList<>(part.getTags())); - if (part.isMaster && group.getSpawnAnimationTag() != null){ - pdc.set(DisplayKeys.SpawnAnimation.ANIMATION_TAG, PersistentDataType.STRING, group.spawnAnimationTag); - pdc.set(DisplayKeys.SpawnAnimation.TYPE, PersistentDataType.STRING, group.spawnAnimationType.name()); - pdc.set(DisplayKeys.SpawnAnimation.LOAD_METHOD, PersistentDataType.STRING, group.spawnAnimationLoadMethod.name()); + if (part.isMaster){ + if (group.getSpawnAnimationTag() != null){ + pdc.set(DisplayKeys.SpawnAnimation.ANIMATION_TAG, PersistentDataType.STRING, group.spawnAnimationTag); + pdc.set(DisplayKeys.SpawnAnimation.TYPE, PersistentDataType.STRING, group.spawnAnimationType.name()); + pdc.set(DisplayKeys.SpawnAnimation.LOAD_METHOD, PersistentDataType.STRING, group.spawnAnimationLoadMethod.name()); + } + pdc.set(DisplayKeys.Group.GROUP_ROTATION, PersistentDataType.BYTE_ARRAY, ActiveGroup.getRotationByteArray(group.getGroupRotation())); } persistentDataContainer = pdc.serializeToBytes(); } @@ -115,8 +118,9 @@ Display createEntity(SpawnedDisplayEntityGroup group, Location location, GroupSp LoadMethod loadMethod = getSpawnAnimationLoadMethod(pdc); DisplayAnimator.AnimationType type = getSpawnAnimationType(pdc); if (animationTag != null){ - group.setSpawnAnimation(pdc, animationTag, type, loadMethod); + group.setSpawnAnimation(animationTag, type, loadMethod); } + group.setRotation(pdc); } return d; } @@ -140,6 +144,7 @@ PacketDisplayEntityPart createPacketPart(PacketDisplayEntityGroup group, Locatio if (group.masterPart == null && isMaster){ part.isMaster = true; group.setSpawnAnimation(pdc); + group.setRotation(pdc); } } } diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityGroup.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityGroup.java index 8f52bdd4..dc231a17 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityGroup.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityGroup.java @@ -25,6 +25,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.joml.Quaternionf; import org.joml.Vector3f; import java.util.*; @@ -350,6 +351,9 @@ void updatePassengerIds(int passengerId, boolean add) { return new PacketPartSelection(this, partFilter); } + @Override + protected void saveGroupRotation() {} + @Override public GroupTeleportCompletableFuture scale(float newScaleMultiplier, int durationInTicks, boolean scaleNonDisplays) { diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java index ed2a7159..a33a0a17 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java @@ -35,7 +35,7 @@ public final class SpawnedDisplayEntityGroup extends ActiveGroup partSelections = new HashSet<>(); private final long creationTime; - boolean isVisibleByDefault; + private boolean isVisibleByDefault; private boolean isPersistent = DisplayConfig.defaultPersistence(); private boolean persistenceOverride = DisplayConfig.persistenceOverride(); @@ -53,29 +53,18 @@ public final class SpawnedDisplayEntityGroup extends ActiveGroup players, boolean worldSpace, float pitch, float yaw){ - Quaternionf originalRot = transformation.getLeftRotation(); - Quaternionf appliedRotation = new Quaternionf(rotation); - - if (worldSpace) { - Quaternionf entityRot = new Quaternionf() - .rotateY((float) Math.toRadians(-yaw)) - .rotateX((float) Math.toRadians(pitch)); - - Quaternionf invertedEntityRot = new Quaternionf(entityRot).invert(); - - //world space to display's space - appliedRotation = invertedEntityRot - .mul(appliedRotation) - .mul(entityRot); - } - - Quaternionf finalRot = new Quaternionf(appliedRotation).mul(originalRot); + Quaternionf finalRot = MathUtils.calculateLeftRotation(transformation, rotation, worldSpace, pitch, yaw); new DisplayAttributeMap() .add(DisplayAttributes.Transform.LEFT_ROTATION, finalRot) diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupCMD.java index 0ceae04e..4d0c3cc0 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupCMD.java @@ -44,6 +44,7 @@ public GroupCMD(){ new GroupPitchCMD(this); new GroupScaleCMD(this); new GroupRotateCMD(this); + new GroupSetRotationCMD(this); new GroupBrightnessCMD(this); new GroupMoveHereCMD(this); new GroupMoveCMD(this); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java new file mode 100644 index 00000000..f481e18e --- /dev/null +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java @@ -0,0 +1,69 @@ +package net.donnypz.displayentityutils.command.group; + +import net.donnypz.displayentityutils.DisplayAPI; +import net.donnypz.displayentityutils.command.DEUSubCommand; +import net.donnypz.displayentityutils.command.GroupSubCommand; +import net.donnypz.displayentityutils.command.Permission; +import net.donnypz.displayentityutils.utils.DisplayEntities.ActiveGroup; +import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.relativepoints.RelativePointUtils; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.MiniMessage; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.joml.Quaternionf; + +import java.util.List; + +public class GroupSetRotationCMD extends GroupSubCommand { + + private static final String DISPLAYS_ONLY_FLAG = "-displaysonly"; + + public GroupSetRotationCMD(@NotNull DEUSubCommand parentSubCommand) { + super("setrotation", parentSubCommand, Permission.GROUP_TRANSFORM, true); + setTabComplete(2, List.of("x", "y", "z")); + setTabComplete(3, ""); + addFlag(DISPLAYS_ONLY_FLAG); + } + + @Override + protected void sendIncorrectUsage(@NotNull Player player) {} + + @Override + protected void execute(@NotNull Player player, @Nullable ActiveGroup group, @NotNull String[] args) { + if (RelativePointUtils.isViewingRelativePoints(player)){ + player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("You cannot play do that while viewing points!", NamedTextColor.RED))); + return; + } + try{ + String axisInput = args[2]; + PivotAxis axis = PivotAxis.valueOf(axisInput.toUpperCase()); + float rotation = Float.parseFloat(args[3]); + + OptionalArguments oArgs = getOptionalArguments(player, args); + boolean displaysOnly = oArgs.hasFlag(DISPLAYS_ONLY_FLAG); + + group.setGroupRotation(rotation, axis, !displaysOnly); + + player.sendMessage(DisplayAPI.pluginPrefix.append(MiniMessage + .miniMessage() + .deserialize(String.format("Set your selected group's local %s axis rotation to %s degrees!", + axis.name(), + rotation)))); + } + catch(NumberFormatException e){ + player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter valid numbers!", NamedTextColor.RED))); + } + catch(IllegalArgumentException e){ + super.incorrectUsage(player); + } + } + + @Override + protected String getDescription() { + return "Rotate a group around a given local space axis. " + + "Use \""+DISPLAYS_ONLY_FLAG+"\" to only rotate display entities."; + } +} From ffb0d6d2982dc25041d6489b193aa8461712a313 Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 04:19:56 -0500 Subject: [PATCH 05/21] Add group rotation to `/deu group info` --- .../command/group/GroupInfoCMD.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java index 6ead1a41..eab6170e 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java @@ -14,6 +14,7 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; +import org.joml.Vector3f; public class GroupInfoCMD extends PlayerSubCommand { GroupInfoCMD(@NotNull DEUSubCommand parentSubCommand) { @@ -35,7 +36,8 @@ public void execute(Player player, String[] args) { player.sendMessage(MiniMessage.miniMessage().deserialize("Group Tag: "+groupTag)); player.sendMessage(MiniMessage.miniMessage().deserialize("Total Parts: "+(group.getParts().size()))); - String packetBased = group instanceof PacketDisplayEntityGroup ? "TRUE" : "FALSE"; + + Component persistence; if (group.isPersistent()){ persistence = MiniMessage.miniMessage().deserialize("Is Persistent: TRUE"); @@ -49,6 +51,7 @@ public void execute(Player player, String[] args) { persistence = MiniMessage.miniMessage().deserialize("Is Persistent: FALSE"); } + String packetBased = group instanceof PacketDisplayEntityGroup ? "TRUE" : "FALSE"; player.sendMessage(MiniMessage.miniMessage().deserialize("Is Packet Based: "+packetBased)); player.sendMessage(persistence); @@ -58,6 +61,14 @@ public void execute(Player player, String[] args) { Location loc = group.getLocation(); player.sendMessage(MiniMessage.miniMessage().deserialize("Pitch & Yaw: "+loc.getPitch()+", "+loc.getYaw())); + Vector3f euler = group.getGroupRotation().getEulerAnglesXYZ(new Vector3f()); + float eulerXDeg = (float) Math.toDegrees(euler.x); + float eulerYDeg = (float) Math.toDegrees(euler.y); + float eulerZDeg = (float) Math.toDegrees(euler.z); + player.sendMessage(MiniMessage.miniMessage().deserialize("Group Rotation (X, Y, Z): " + +eulerXDeg+", " + +eulerYDeg+", " + +eulerZDeg)); player.sendMessage(MiniMessage.miniMessage().deserialize("Scale Multiplier: "+group.getScaleMultiplier())); String animTag = group.getSpawnAnimationTag(); From 45f5605a491db04ad08b6dcc0ff654a1308d8b21 Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 04:25:53 -0500 Subject: [PATCH 06/21] Remove SpawnedDisplayEntityPart#getCreationTime --- .../DisplayEntities/SpawnedDisplayEntityPart.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java index 0c98b209..210e2aa8 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java @@ -229,16 +229,6 @@ public float getYaw() { return getEntity().getYaw(); } - - @ApiStatus.Internal - public long getCreationTime() { - if (!getEntity().getPersistentDataContainer().has(SpawnedDisplayEntityGroup.creationTimeKey)){ - return -1; - } - return getEntity().getPersistentDataContainer().get(SpawnedDisplayEntityGroup.creationTimeKey, PersistentDataType.LONG); - } - - /** * Get the entity of that this part represents * @return This part's entity or null if this part has been previously removed. From df5b457a84a8b4900004d22727739d7fae51cee4 Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 04:29:58 -0500 Subject: [PATCH 07/21] Move NamespacedKeys from SpawnedDisplayEntityGroup to DisplayKeys --- .../displayentityutils/DisplayKeys.java | 7 +++++++ .../SpawnedDisplayEntityGroup.java | 18 +++++++----------- .../SpawnedDisplayEntityPart.java | 4 ++-- .../displayentityutils/utils/DisplayUtils.java | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java b/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java index 291d7f88..c4673253 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java +++ b/api/src/main/java/net/donnypz/displayentityutils/DisplayKeys.java @@ -1,13 +1,20 @@ package net.donnypz.displayentityutils; import org.bukkit.NamespacedKey; +import org.jetbrains.annotations.ApiStatus; +@ApiStatus.Internal public final class DisplayKeys { + private DisplayKeys(){} + public static final class Group{ public static final NamespacedKey GROUP_TAG = new NamespacedKey(DisplayAPI.getPlugin(), "groupTag"); public static final NamespacedKey CHUNK_PACKET_GROUP = new NamespacedKey(DisplayAPI.getPlugin(), "chunkpacketgroups"); public static final NamespacedKey GROUP_ROTATION = new NamespacedKey(DisplayAPI.getPlugin(), "group_rotation"); + public static final NamespacedKey CREATION_TIME = new NamespacedKey(DisplayAPI.getPlugin(), "creationtime"); + public static final NamespacedKey SCALE_MULTIPLIER = new NamespacedKey(DisplayAPI.getPlugin(), "scale"); + public static final NamespacedKey PERSISTENCE_OVERRIDE = new NamespacedKey(DisplayAPI.getPlugin(), "persistence_override"); } public static final class Part{ diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java index a33a0a17..9bf3eaaf 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityGroup.java @@ -39,10 +39,6 @@ public final class SpawnedDisplayEntityGroup extends ActiveGroup Date: Sun, 2 Aug 2026 04:49:41 -0500 Subject: [PATCH 08/21] Changed Active#setRotation to Active#setEntityRotation --- .../displayentityutils/utils/DisplayEntities/Active.java | 6 +++--- .../utils/DisplayEntities/ActivePartHolder.java | 4 ++-- .../utils/DisplayEntities/PacketDisplayEntityPart.java | 2 +- .../utils/DisplayEntities/SinglePartSelection.java | 4 ++-- .../utils/DisplayEntities/SpawnedDisplayEntityPart.java | 2 +- .../displayentityutils/utils/gizmo/GizmoSessionImpl.java | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java index e2d8e9e4..8d424da4 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java @@ -60,11 +60,11 @@ public interface Active { void setYaw(float yaw, boolean pivot); - default void setRotation(float pitch, float yaw){ - setRotation(pitch, yaw, false, false); + default void setEntityRotation(float pitch, float yaw){ + setEntityRotation(pitch, yaw, false, false); } - void setRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw); + void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw); /** * @param angleInDegrees the pivot angle diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java index a466ec56..38d40356 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java @@ -320,9 +320,9 @@ public void setYaw(float yaw, boolean pivot){ * @param pivotYaw whether non-display parts should pivot with the yaw change */ @Override - public void setRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw) { + public void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw) { for (ActivePart part : getPartsRaw()) { - part.setRotation(pitch, yaw, pivotPitch, pivotYaw); + part.setEntityRotation(pitch, yaw, pivotPitch, pivotYaw); } } diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java index 0f0bb86e..258d6709 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java @@ -1135,7 +1135,7 @@ public void setBrightness(Display.@Nullable Brightness brightness) { * @param pivotYaw whether the part should pivot, using the yaw value, around its group's location, if it has one */ @Override - public void setRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw){ + public void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw){ pitch = Math.clamp(pitch, -90, 90); setPitchSilent(pitch, pivotPitch); setYawSilent(yaw, pivotYaw); diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java index 50c58e9c..83bf07ac 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java @@ -142,8 +142,8 @@ public void setYaw(float yaw, boolean pivot) { * @param pivotYaw whether the non-display parts should pivot, using the yaw value, around its group's location, if it has one */ @Override - public void setRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw) { - selectedPart.setRotation(pitch, yaw, pivotPitch, pivotYaw); + public void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw) { + selectedPart.setEntityRotation(pitch, yaw, pivotPitch, pivotYaw); } /** diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java index 440a66a4..a1a2b761 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java @@ -567,7 +567,7 @@ public void setYaw(float yaw, boolean pivot){ * @param pivotYaw whether the part should pivot, using the yaw value, around its group's location, if it has one */ @Override - public void setRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw) { + public void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolean pivotYaw) { setPitch(pitch, pivotPitch); setYaw(yaw, pivotYaw); } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java index 4c4ca517..8bb3f6e2 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java @@ -178,10 +178,10 @@ public void updateRotation() { switch (gizmoSpace) { case LOCAL -> { - gizmoModel.setRotation(selLoc.getPitch(), selLoc.getYaw(), false, false); + gizmoModel.setEntityRotation(selLoc.getPitch(), selLoc.getYaw(), false, false); } case WORLD -> { - gizmoModel.setRotation(0, 0, false, false); + gizmoModel.setEntityRotation(0, 0, false, false); } } From b87c1aeb55cd688d8bfce06b37ce0fc47a6d2200 Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 04:50:38 -0500 Subject: [PATCH 09/21] Rename Axis to GizmoAxis --- .../utils/gizmo/GizmoSessionImpl.java | 8 ++++---- .../utils/gizmo/controls/Control.java | 6 +++--- .../gizmo/controls/{Axis.java => GizmoAxis.java} | 12 ++++++------ .../utils/gizmo/controls/drag/Drag.java | 4 ++-- .../utils/gizmo/controls/drag/RotationDrag.java | 6 +++--- .../utils/gizmo/controls/drag/ScaleDrag.java | 10 +++++----- .../gizmo/controls/drag/TranslationAxisDrag.java | 4 ++-- .../gizmo/controls/drag/TranslationDrag.java | 4 ++-- .../controls/drag/TranslationPlaneDrag.java | 5 ++--- .../gizmo/controls/selector/AxisSelector.java | 16 ++++++++-------- .../controls/selector/RotationSelector.java | 12 ++++++------ .../gizmo/controls/selector/ScaleSelector.java | 4 ++-- .../utils/gizmo/controls/selector/Selector.java | 4 ++-- .../selector/TranslationAxisSelector.java | 4 ++-- .../selector/TranslationPlaneSelector.java | 4 ++-- 15 files changed, 51 insertions(+), 52 deletions(-) rename plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/{Axis.java => GizmoAxis.java} (82%) diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java index 8bb3f6e2..94ec82af 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/GizmoSessionImpl.java @@ -6,7 +6,7 @@ import net.donnypz.displayentityutils.managers.DisplayGroupManager; import net.donnypz.displayentityutils.managers.GizmoManager; import net.donnypz.displayentityutils.utils.DisplayEntities.*; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.controls.Control; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.Drag; import net.donnypz.displayentityutils.utils.gizmo.controls.selector.RotationSelector; @@ -75,9 +75,9 @@ public GizmoSessionImpl(Player player, Location spawnLocation) { this.selectors.add(AxisSelector.yz()); //Scale Axis - this.selectors.add(new ScaleSelector(Axis.X)); - this.selectors.add(new ScaleSelector(Axis.Y)); - this.selectors.add(new ScaleSelector(Axis.Z)); + this.selectors.add(new ScaleSelector(GizmoAxis.X)); + this.selectors.add(new ScaleSelector(GizmoAxis.Y)); + this.selectors.add(new ScaleSelector(GizmoAxis.Z)); //Rotate Axis this.selectors.add(RotationSelector.x()); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/Control.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/Control.java index 0a8d78ce..be262d76 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/Control.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/Control.java @@ -5,11 +5,11 @@ public abstract class Control { - protected final Axis axis; + protected final GizmoAxis axis; public static final float MAX_DISTANCE = 15.0f; public static final float MAX_DISTANCE_SQUARED = MAX_DISTANCE*MAX_DISTANCE; - protected Control(Axis axis){ + protected Control(GizmoAxis axis){ this.axis = axis; } @@ -29,7 +29,7 @@ public void unglow(ActiveGroup gizmo) { }); } - public Axis getAxis() { + public GizmoAxis getAxis() { return axis; } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/Axis.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/GizmoAxis.java similarity index 82% rename from plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/Axis.java rename to plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/GizmoAxis.java index 1988accd..5e7ee174 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/Axis.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/GizmoAxis.java @@ -5,7 +5,7 @@ import java.util.Arrays; -public enum Axis { +public enum GizmoAxis { //axes X(Color.RED, "move_x", new Vector3f(1, 0, 0)), Y(Color.LIME, "move_y", new Vector3f(0, 1, 0)), @@ -20,7 +20,7 @@ public enum Axis { private final Color baseColor; private final String tag; - Axis(Color baseColor, String tag, Vector3f... directions) { + GizmoAxis(Color baseColor, String tag, Vector3f... directions) { this.directions = directions; this.baseColor = baseColor; this.tag = tag; @@ -48,10 +48,10 @@ public String getRotationTag(){ return isPlane() ? null : "rotate_"+tag.substring(5); } - public Axis[] getRotationPlaneAxes(){ - if (this == X) return new Axis[]{Y,Z}; - if (this == Y) return new Axis[]{Z,X}; - if (this == Z) return new Axis[]{X,Y}; + public GizmoAxis[] getRotationPlaneAxes(){ + if (this == X) return new GizmoAxis[]{Y,Z}; + if (this == Y) return new GizmoAxis[]{Z,X}; + if (this == Z) return new GizmoAxis[]{X,Y}; return null; } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/Drag.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/Drag.java index b603dce6..a37cd652 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/Drag.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/Drag.java @@ -1,12 +1,12 @@ package net.donnypz.displayentityutils.utils.gizmo.controls.drag; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.controls.Control; import org.bukkit.entity.Player; public abstract class Drag extends Control { - public Drag(Axis axis) { + public Drag(GizmoAxis axis) { super(axis); } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/RotationDrag.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/RotationDrag.java index b6aed308..d32d608d 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/RotationDrag.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/RotationDrag.java @@ -5,7 +5,7 @@ import net.donnypz.displayentityutils.utils.gizmo.GizmoSelectionMode; import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.util.GizmoMathUtil; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -30,13 +30,13 @@ public class RotationDrag extends Drag { //prev dir from gizmo to player's looking dir private final Vector3f lastDirection = new Vector3f(); - public RotationDrag(Player player, GizmoSessionImpl gizmo, Axis axis) { + public RotationDrag(Player player, GizmoSessionImpl gizmo, GizmoAxis axis) { super(axis); this.gizmo = gizmo; this.originalAxis = axis.getDirections()[0]; this.pivotPoint = gizmo.getGizmoModel().getLocation().toVector().toVector3f(); - Axis[] rotPlaneAxes = axis.getRotationPlaneAxes(); + GizmoAxis[] rotPlaneAxes = axis.getRotationPlaneAxes(); planeAxis1.set( GizmoMathUtil.rotate( diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/ScaleDrag.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/ScaleDrag.java index eacc007f..9fef8e65 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/ScaleDrag.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/ScaleDrag.java @@ -6,7 +6,7 @@ import net.donnypz.displayentityutils.utils.gizmo.GizmoSelectionMode; import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.util.GizmoTitleUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -30,7 +30,7 @@ public class ScaleDrag extends Drag { private final Vector3f lastHitPoint; - public ScaleDrag(Player player, GizmoSessionImpl gizmo, Axis axis) { + public ScaleDrag(Player player, GizmoSessionImpl gizmo, GizmoAxis axis) { super(axis); this.gizmo = gizmo; @@ -134,7 +134,7 @@ private void applyScale(float movementAmount) { if (part.isDisplay()) { scaleDisplay(part, scaleDelta); } else if (part.getType() == SpawnedDisplayEntityPart.PartType.INTERACTION) { - if (axis == Axis.Y) { + if (axis == GizmoAxis.Y) { part.setInteractionHeight(part.getInteractionHeight() + scaleDelta); } else { part.setInteractionWidth(part.getInteractionWidth() + scaleDelta); @@ -165,10 +165,10 @@ private void applyScale(float movementAmount) { private void scaleDisplay(ActivePart part, float scaleDelta) { Transformation t = part.getTransformation(); - if (axis == Axis.X) { + if (axis == GizmoAxis.X) { float scale = t.getScale().x + scaleDelta; part.setDisplayXScale(scale); - } else if (axis == Axis.Y) { + } else if (axis == GizmoAxis.Y) { float scale = t.getScale().y + scaleDelta; part.setDisplayYScale(scale); } else { diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationAxisDrag.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationAxisDrag.java index 651e61d9..3cde0038 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationAxisDrag.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationAxisDrag.java @@ -1,7 +1,7 @@ package net.donnypz.displayentityutils.utils.gizmo.controls.drag; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -9,7 +9,7 @@ public class TranslationAxisDrag extends TranslationDrag { - public TranslationAxisDrag(Player player, GizmoSessionImpl gizmo, Axis axis) { + public TranslationAxisDrag(Player player, GizmoSessionImpl gizmo, GizmoAxis axis) { super(player, gizmo, axis); } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationDrag.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationDrag.java index 882fe4f6..bdee48b2 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationDrag.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationDrag.java @@ -7,7 +7,7 @@ import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; import net.donnypz.displayentityutils.utils.gizmo.TranslationMode; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.util.GizmoTitleUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -33,7 +33,7 @@ public abstract class TranslationDrag extends Drag { protected final Vector3f[] originalAxes; protected final Vector3f[] currentAxesDir; - public TranslationDrag(Player player, GizmoSessionImpl gizmo, Axis axis) { + public TranslationDrag(Player player, GizmoSessionImpl gizmo, GizmoAxis axis) { super(axis); this.gizmo = gizmo; this.originalAxes = axis.getDirections(); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationPlaneDrag.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationPlaneDrag.java index bd824490..67342488 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationPlaneDrag.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/drag/TranslationPlaneDrag.java @@ -1,16 +1,15 @@ package net.donnypz.displayentityutils.utils.gizmo.controls.drag; -import net.donnypz.displayentityutils.utils.DisplayEntities.*; import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import org.bukkit.Location; import org.bukkit.entity.Player; import org.joml.Vector3f; public class TranslationPlaneDrag extends TranslationDrag { - public TranslationPlaneDrag(Player player, GizmoSessionImpl gizmo, Axis axis) { + public TranslationPlaneDrag(Player player, GizmoSessionImpl gizmo, GizmoAxis axis) { super(player, gizmo, axis); } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/AxisSelector.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/AxisSelector.java index 44187bf0..b8a35e6e 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/AxisSelector.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/AxisSelector.java @@ -1,34 +1,34 @@ package net.donnypz.displayentityutils.utils.gizmo.controls.selector; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; public abstract class AxisSelector extends Selector{ - AxisSelector(Axis axis) { + AxisSelector(GizmoAxis axis) { super(axis); } public static TranslationAxisSelector x() { - return new TranslationAxisSelector(Axis.X); + return new TranslationAxisSelector(GizmoAxis.X); } public static TranslationAxisSelector y() { - return new TranslationAxisSelector(Axis.Y); + return new TranslationAxisSelector(GizmoAxis.Y); } public static TranslationAxisSelector z() { - return new TranslationAxisSelector(Axis.Z); + return new TranslationAxisSelector(GizmoAxis.Z); } public static TranslationPlaneSelector xy() { - return new TranslationPlaneSelector(Axis.XY); + return new TranslationPlaneSelector(GizmoAxis.XY); } public static TranslationPlaneSelector xz() { - return new TranslationPlaneSelector(Axis.ZX); + return new TranslationPlaneSelector(GizmoAxis.ZX); } public static TranslationPlaneSelector yz() { - return new TranslationPlaneSelector(Axis.YZ); + return new TranslationPlaneSelector(GizmoAxis.YZ); } } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/RotationSelector.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/RotationSelector.java index b3133643..c0c84162 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/RotationSelector.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/RotationSelector.java @@ -2,7 +2,7 @@ import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.Drag; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.RotationDrag; import net.donnypz.displayentityutils.utils.gizmo.util.GizmoMathUtil; @@ -15,20 +15,20 @@ public class RotationSelector extends Selector { private float ringRadius = 1.125f; private float ringThickness = 0.075f; - RotationSelector(Axis axis) { + RotationSelector(GizmoAxis axis) { super(axis); } public static RotationSelector x() { - return new RotationSelector(Axis.X); + return new RotationSelector(GizmoAxis.X); } public static RotationSelector y() { - return new RotationSelector(Axis.Y); + return new RotationSelector(GizmoAxis.Y); } public static RotationSelector z() { - return new RotationSelector(Axis.Z); + return new RotationSelector(GizmoAxis.Z); } @Override @@ -78,7 +78,7 @@ public float intersect(GizmoSpace gizmoSpace, .fma(distanceAlongRay, ray); //keep selection ring as a quarter-circle - Axis[] rotPlaneAxes = axis.getRotationPlaneAxes(); + GizmoAxis[] rotPlaneAxes = axis.getRotationPlaneAxes(); Vector3f axis1 = GizmoMathUtil.rotate( rotPlaneAxes[0].getDirections()[0], gizmoSpace, diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/ScaleSelector.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/ScaleSelector.java index e4f315ba..71b7218b 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/ScaleSelector.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/ScaleSelector.java @@ -1,7 +1,7 @@ package net.donnypz.displayentityutils.utils.gizmo.controls.selector; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.Drag; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.ScaleDrag; @@ -16,7 +16,7 @@ public class ScaleSelector extends AxisSelector { private final Vector3f localEnd; private float radius = 0.125f; - public ScaleSelector(Axis axis) { + public ScaleSelector(GizmoAxis axis) { super(axis); this.localStart = axis.getDirections()[0] .mul(1.2f); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/Selector.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/Selector.java index d6fa2f2a..64d29c18 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/Selector.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/Selector.java @@ -1,7 +1,7 @@ package net.donnypz.displayentityutils.utils.gizmo.controls.selector; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.controls.Control; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.Drag; @@ -10,7 +10,7 @@ public abstract class Selector extends Control { - public Selector(Axis axis) { + public Selector(GizmoAxis axis) { super(axis); } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationAxisSelector.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationAxisSelector.java index 5c2eb84e..cc55c365 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationAxisSelector.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationAxisSelector.java @@ -1,7 +1,7 @@ package net.donnypz.displayentityutils.utils.gizmo.controls.selector; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.Drag; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.TranslationAxisDrag; @@ -16,7 +16,7 @@ public class TranslationAxisSelector extends AxisSelector { private final Vector3f localEnd; private float radius = 0.075f; - TranslationAxisSelector(Axis axis) { + TranslationAxisSelector(GizmoAxis axis) { super(axis); this.localStart = axis.getDirections()[0] .mul(0.1125f); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationPlaneSelector.java b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationPlaneSelector.java index 60de7bb7..345cb85c 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationPlaneSelector.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/utils/gizmo/controls/selector/TranslationPlaneSelector.java @@ -2,7 +2,7 @@ import net.donnypz.displayentityutils.utils.gizmo.GizmoSessionImpl; import net.donnypz.displayentityutils.utils.gizmo.GizmoSpace; -import net.donnypz.displayentityutils.utils.gizmo.controls.Axis; +import net.donnypz.displayentityutils.utils.gizmo.controls.GizmoAxis; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.Drag; import net.donnypz.displayentityutils.utils.gizmo.controls.drag.TranslationPlaneDrag; import net.donnypz.displayentityutils.utils.gizmo.util.GizmoMathUtil; @@ -16,7 +16,7 @@ public class TranslationPlaneSelector extends Selector { private final Vector3f corner2; private float size = 0.25f; - TranslationPlaneSelector(Axis axis) { + TranslationPlaneSelector(GizmoAxis axis) { super(axis); Vector3f[] axes = axis.getDirections(); Vector3f axis1 = axes[0]; From 2cf03adf4e76e923ef39057b4211baa09d8511dc Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 04:52:22 -0500 Subject: [PATCH 10/21] Rename PivotAxis to Axis --- .../utils/{PivotAxis.java => Axis.java} | 5 ++--- .../utils/DisplayEntities/Active.java | 6 +++--- .../utils/DisplayEntities/ActiveGroup.java | 2 +- .../utils/DisplayEntities/ActivePartHolder.java | 6 +++--- .../utils/DisplayEntities/InteractionEntity.java | 1 - .../DisplayEntities/PacketDisplayEntityPart.java | 13 +++++++------ .../utils/DisplayEntities/SinglePartSelection.java | 6 +++--- .../DisplayEntities/SpawnedDisplayEntityPart.java | 9 +++++---- .../displayentityutils/utils/DisplayUtils.java | 8 ++++---- .../displayentityutils/utils/WorldUtils.java | 14 +++++++------- .../displayentityutils/command/CMDUtils.java | 10 +++++----- .../command/group/GroupSetRotationCMD.java | 5 ++--- .../command/interaction/InteractionCMD.java | 6 +++--- .../command/interaction/InteractionPivotCMD.java | 4 ++-- .../command/mannequin/MannequinPivotCMD.java | 6 +++--- 15 files changed, 50 insertions(+), 51 deletions(-) rename api/src/main/java/net/donnypz/displayentityutils/utils/{PivotAxis.java => Axis.java} (93%) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java b/api/src/main/java/net/donnypz/displayentityutils/utils/Axis.java similarity index 93% rename from api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java rename to api/src/main/java/net/donnypz/displayentityutils/utils/Axis.java index f7a02b09..4b00e590 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/PivotAxis.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/Axis.java @@ -2,15 +2,14 @@ import org.jetbrains.annotations.NotNull; import org.joml.Quaternionf; -import org.joml.Vector3f; -public enum PivotAxis { +public enum Axis { X, Y, Z; /** - * Rotate a quaternion on this {@link PivotAxis}'s axis + * Rotate a quaternion on this {@link Axis}'s axis * @param quaternionf the quaternion * @param angleInDegrees the angle in degrees * @return a new {@link Quaternionf} with the rotation applied diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java index 8d424da4..f5cff0bf 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java @@ -1,7 +1,7 @@ package net.donnypz.displayentityutils.utils.DisplayEntities; import net.donnypz.displayentityutils.utils.Direction; -import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.Axis; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.entity.Display; @@ -68,10 +68,10 @@ default void setEntityRotation(float pitch, float yaw){ /** * @param angleInDegrees the pivot angle - * @param pivotAxis the axis to perform the pivot on + * @param axis the axis to perform the pivot on * @param worldSpace whether the pivot should occur on world space axis */ - void pivot(float angleInDegrees, @NotNull PivotAxis pivotAxis, boolean worldSpace); + void pivot(float angleInDegrees, @NotNull Axis axis, boolean worldSpace); /** * @param rotation the rotation diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java index 1eba7edf..8f5f97f8 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java @@ -180,7 +180,7 @@ public void removeCulling(){ * @param axis the axis to rotate on * @param pivotNonDisplays whether non-displays should be pivoted */ - public void setGroupRotation(float angleInDegrees, @NotNull PivotAxis axis, boolean pivotNonDisplays){ + public void setGroupRotation(float angleInDegrees, @NotNull Axis axis, boolean pivotNonDisplays){ Quaternionf newRotation = new Quaternionf(this.rotation); newRotation = axis.set(newRotation, angleInDegrees); setGroupRotation(newRotation, pivotNonDisplays); diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java index 38d40356..b6c224af 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePartHolder.java @@ -1,6 +1,6 @@ package net.donnypz.displayentityutils.utils.DisplayEntities; -import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.Axis; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.entity.Display; @@ -330,10 +330,10 @@ public void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolea * Pivot all non-display parts in this */ @Override - public void pivot(float angleInDegrees, @NotNull PivotAxis pivotAxis, boolean worldSpace) { + public void pivot(float angleInDegrees, @NotNull Axis axis, boolean worldSpace) { for (T part : getPartsRaw()){ if (part.isDisplay()) continue; - part.pivot(angleInDegrees, pivotAxis, worldSpace); + part.pivot(angleInDegrees, axis, worldSpace); } } diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/InteractionEntity.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/InteractionEntity.java index 795980fa..682fa6f8 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/InteractionEntity.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/InteractionEntity.java @@ -3,7 +3,6 @@ import net.donnypz.displayentityutils.DisplayKeys; import net.donnypz.displayentityutils.utils.DisplayUtils; import net.donnypz.displayentityutils.utils.InteractionUtils; -import net.donnypz.displayentityutils.utils.PivotAxis; import net.donnypz.displayentityutils.utils.WorldUtils; import net.donnypz.displayentityutils.utils.packet.PacketAttributeContainer; import net.donnypz.displayentityutils.utils.packet.attributes.DisplayAttributes; diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java index 258d6709..ba28a84c 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/PacketDisplayEntityPart.java @@ -8,6 +8,7 @@ import net.donnypz.displayentityutils.events.GroupSpawnedEvent; import net.donnypz.displayentityutils.managers.DEUUser; import net.donnypz.displayentityutils.utils.*; +import net.donnypz.displayentityutils.utils.Axis; import net.donnypz.displayentityutils.utils.packet.DisplayAttributeMap; import net.donnypz.displayentityutils.utils.packet.PacketAttributeContainer; import net.donnypz.displayentityutils.utils.packet.attributes.DisplayAttribute; @@ -1221,7 +1222,7 @@ private Location setPitchSilent(float pitch, boolean pivot){ packetLocation.pitch = pitch; if (!isDisplay() && pivot){ - return pivotSilent(delta, PivotAxis.X, false); + return pivotSilent(delta, Axis.X, false); } return packetLocation.toLocation(); } @@ -1232,7 +1233,7 @@ private Location setYawSilent(float yaw, boolean pivot){ packetLocation.yaw = yaw; if (!isDisplay() && pivot){ - return pivotSilent(delta, PivotAxis.Y, true); + return pivotSilent(delta, Axis.Y, true); } return packetLocation.toLocation(); @@ -1242,20 +1243,20 @@ private Location setYawSilent(float yaw, boolean pivot){ * Pivot a non-display entity around its group */ @Override - public void pivot(float angleInDegrees, @NotNull PivotAxis pivotAxis, boolean worldSpace) { + public void pivot(float angleInDegrees, @NotNull Axis axis, boolean worldSpace) { if (isDisplay() || group == null) return; - Location result = pivotSilent(angleInDegrees, pivotAxis, worldSpace); + Location result = pivotSilent(angleInDegrees, axis, worldSpace); this.teleport(result); } - private Location pivotSilent(float angleInDegrees, @NotNull PivotAxis pivotAxis, boolean worldSpace){ + private Location pivotSilent(float angleInDegrees, @NotNull Axis axis, boolean worldSpace){ if (angleInDegrees == 0.0f) return getLocation(); Location result = WorldUtils.getPivotLocation( getLocation(), group.getLocation(), angleInDegrees, - pivotAxis, + axis, worldSpace); packetLocation.setCoordinates(result); return result; diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java index 83bf07ac..5a3ebacd 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SinglePartSelection.java @@ -1,7 +1,7 @@ package net.donnypz.displayentityutils.utils.DisplayEntities; import net.donnypz.displayentityutils.utils.Direction; -import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.Axis; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.entity.Display; @@ -150,9 +150,9 @@ public void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolea * Pivot the part in this selection around this selection's group, if it's not a display */ @Override - public void pivot(float angleInDegrees, @NotNull PivotAxis pivotAxis, boolean worldSpace) { + public void pivot(float angleInDegrees, @NotNull Axis axis, boolean worldSpace) { if (selectedPart.isDisplay()) return; - selectedPart.pivot(angleInDegrees, pivotAxis, worldSpace); + selectedPart.pivot(angleInDegrees, axis, worldSpace); } /** diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java index a1a2b761..a108246f 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/SpawnedDisplayEntityPart.java @@ -6,6 +6,7 @@ import net.donnypz.displayentityutils.DisplayAPI; import net.donnypz.displayentityutils.DisplayKeys; import net.donnypz.displayentityutils.utils.*; +import net.donnypz.displayentityutils.utils.Axis; import net.donnypz.displayentityutils.utils.packet.DisplayAttributeMap; import net.donnypz.displayentityutils.utils.packet.PacketAttributeContainer; import net.donnypz.displayentityutils.utils.packet.attributes.DisplayAttribute; @@ -532,7 +533,7 @@ public void setPitch(float pitch, boolean pivot){ entity.setRotation(entity.getYaw(), pitch); if (!isDisplay() && pivot){ - pivot(delta, PivotAxis.X, false); + pivot(delta, Axis.X, false); } } @@ -551,7 +552,7 @@ public void setYaw(float yaw, boolean pivot){ entity.setRotation(yaw, entity.getPitch()); if (!isDisplay() && pivot){ - pivot(delta, PivotAxis.Y, true); + pivot(delta, Axis.Y, true); } if (entity instanceof LivingEntity le){ @@ -576,7 +577,7 @@ public void setEntityRotation(float pitch, float yaw, boolean pivotPitch, boolea * Pivot a non-display entity around its group */ @Override - public void pivot(float angleInDegrees, @NotNull PivotAxis pivotAxis, boolean worldSpace) { + public void pivot(float angleInDegrees, @NotNull Axis axis, boolean worldSpace) { if (isDisplay() || isSingle || group == null) return; Entity e = getEntity(); if (e == null) return; @@ -585,7 +586,7 @@ public void pivot(float angleInDegrees, @NotNull PivotAxis pivotAxis, boolean wo e, group.getLocation(), angleInDegrees, - pivotAxis, + axis, worldSpace); } } diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayUtils.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayUtils.java index 2295c729..04f2acaa 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayUtils.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayUtils.java @@ -594,21 +594,21 @@ public static void translate(@NotNull SpawnedDisplayEntityPart part, @NotNull Di * @param entity the entity * @param pivotLocation the location to pivot around * @param angleInDegrees the pivot angle in degrees - * @param pivotAxis the axis to pivot around + * @param axis the axis to pivot around * @param worldSpace whether the pivot should occur on world space axis */ public static void pivot(@NotNull Entity entity, @NotNull Location pivotLocation, double angleInDegrees, - @NotNull PivotAxis pivotAxis, + @NotNull Axis axis, boolean worldSpace){ float angleRad = (float) Math.toRadians(angleInDegrees); Quaternionf rotation = new Quaternionf(); - if (pivotAxis == PivotAxis.X){ + if (axis == Axis.X){ rotation.rotateX(angleRad); } - else if (pivotAxis == PivotAxis.Y){ + else if (axis == Axis.Y){ rotation.rotateY(-angleRad); } else{ diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/WorldUtils.java b/api/src/main/java/net/donnypz/displayentityutils/utils/WorldUtils.java index 411e6faf..df809b90 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/WorldUtils.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/WorldUtils.java @@ -78,14 +78,14 @@ public static Set getNearbyChunkKeys(@NotNull Location origin, double radi * @param origin the pivoting location * @param pivotLocation the location to pivot around * @param angleInDegrees the pivot angle in degrees - * @param pivotAxis the axis to pivot around + * @param axis the axis to pivot around * @param worldSpace whether the pivot should occur on world space axis * @return a {@link Location} */ public static @NotNull Location getPivotLocation(@NotNull Location origin, @NotNull Location pivotLocation, double angleInDegrees, - @NotNull PivotAxis pivotAxis, + @NotNull Axis axis, boolean worldSpace){ Vector translationVector = pivotLocation .clone() @@ -96,7 +96,7 @@ public static Set getNearbyChunkKeys(@NotNull Location origin, double radi translationVector, pivotLocation, angleInDegrees, - pivotAxis, + axis, worldSpace, origin.getYaw(), origin.getPitch()); @@ -107,7 +107,7 @@ public static Set getNearbyChunkKeys(@NotNull Location origin, double radi * @param translationVector the translation offset vector from an origin, that will pivot * @param pivotLocation the location to pivot around * @param angleInDegrees the pivot angle in degrees - * @param pivotAxis the axis to pivot around + * @param axis the axis to pivot around * @param worldSpace whether the pivot should occur on world space axis * @param yaw the yaw to consider when pivoting * @param pitch the yaw to consider when pivoting @@ -116,7 +116,7 @@ public static Set getNearbyChunkKeys(@NotNull Location origin, double radi public static @NotNull Location getPivotLocation(@NotNull Vector translationVector, @NotNull Location pivotLocation, double angleInDegrees, - @NotNull PivotAxis pivotAxis, + @NotNull Axis axis, boolean worldSpace, float yaw, float pitch) { @@ -125,10 +125,10 @@ public static Set getNearbyChunkKeys(@NotNull Location origin, double radi Quaternionf rotation = new Quaternionf(); - if (pivotAxis == PivotAxis.X){ + if (axis == Axis.X){ rotation.rotateX(angleRad); } - else if (pivotAxis == PivotAxis.Y){ + else if (axis == Axis.Y){ rotation.rotateY(-angleRad); } else{ diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/CMDUtils.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/CMDUtils.java index f505ecd8..587b80c0 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/CMDUtils.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/CMDUtils.java @@ -5,7 +5,7 @@ import net.donnypz.displayentityutils.managers.DisplayGroupManager; import net.donnypz.displayentityutils.utils.DisplayEntities.*; import net.donnypz.displayentityutils.utils.DisplayUtils; -import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.Axis; import net.donnypz.displayentityutils.utils.relativepoints.RelativePointSelector; import net.donnypz.displayentityutils.utils.relativepoints.RelativePointUtils; import net.kyori.adventure.text.Component; @@ -87,15 +87,15 @@ public static void tryAddEntityToGroup(Player player, String[] args, Entity enti } } - public static PivotAxis getPivotAxis(String arg, Player player) { + public static Axis getPivotAxis(String arg, Player player) { if (arg.equalsIgnoreCase("x")){ - return PivotAxis.X; + return Axis.X; } else if (arg.equalsIgnoreCase("y")){ - return PivotAxis.Y; + return Axis.Y; } else if (arg.equalsIgnoreCase("z")){ - return PivotAxis.Z; + return Axis.Z; } else{ player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Invalid pivot axis!", NamedTextColor.RED))); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java index f481e18e..a3a549f0 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java @@ -5,7 +5,7 @@ import net.donnypz.displayentityutils.command.GroupSubCommand; import net.donnypz.displayentityutils.command.Permission; import net.donnypz.displayentityutils.utils.DisplayEntities.ActiveGroup; -import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.Axis; import net.donnypz.displayentityutils.utils.relativepoints.RelativePointUtils; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -13,7 +13,6 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.joml.Quaternionf; import java.util.List; @@ -39,7 +38,7 @@ protected void execute(@NotNull Player player, @Nullable ActiveGroup group, @ } try{ String axisInput = args[2]; - PivotAxis axis = PivotAxis.valueOf(axisInput.toUpperCase()); + Axis axis = Axis.valueOf(axisInput.toUpperCase()); float rotation = Float.parseFloat(args[3]); OptionalArguments oArgs = getOptionalArguments(player, args); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionCMD.java index 663cdae4..820cb8b6 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionCMD.java @@ -107,12 +107,12 @@ void setResponsive(boolean responsive){ } } - void pivot(Location pivotLoc, float angle, PivotAxis pivotAxis, boolean worldSpace){ + void pivot(Location pivotLoc, float angle, Axis axis, boolean worldSpace){ if (interaction != null){ - DisplayUtils.pivot(interaction, pivotLoc, angle, pivotAxis, worldSpace); + DisplayUtils.pivot(interaction, pivotLoc, angle, axis, worldSpace); } else{ - interactionPart.pivot(angle, pivotAxis, worldSpace); + interactionPart.pivot(angle, axis, worldSpace); updatePacketGroup(); } } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionPivotCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionPivotCMD.java index 809effa8..f74c82ef 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionPivotCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/interaction/InteractionPivotCMD.java @@ -5,7 +5,7 @@ import net.donnypz.displayentityutils.command.parts.PartsCMD; import net.donnypz.displayentityutils.managers.DisplayGroupManager; import net.donnypz.displayentityutils.utils.DisplayEntities.*; -import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.Axis; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.entity.Player; @@ -40,7 +40,7 @@ public void execute(Player player, String[] args) { return; } - PivotAxis axis = CMDUtils.getPivotAxis(args[2], player); + Axis axis = CMDUtils.getPivotAxis(args[2], player); if (axis == null) return; if (!hasMinimumArguments(player, args)) return; diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/mannequin/MannequinPivotCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/mannequin/MannequinPivotCMD.java index 173137a0..24797641 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/mannequin/MannequinPivotCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/mannequin/MannequinPivotCMD.java @@ -6,7 +6,7 @@ import net.donnypz.displayentityutils.command.PartsSubCommand; import net.donnypz.displayentityutils.command.Permission; import net.donnypz.displayentityutils.utils.DisplayEntities.*; -import net.donnypz.displayentityutils.utils.PivotAxis; +import net.donnypz.displayentityutils.utils.Axis; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.bukkit.entity.Player; @@ -28,7 +28,7 @@ protected void sendIncorrectUsage(@NotNull Player player) {} @Override protected boolean executeAllPartsAction(@NotNull Player player, @Nullable ActiveGroup group, @NotNull MultiPartSelection selection, @NotNull String[] args) { - PivotAxis axis = CMDUtils.getPivotAxis(args[2], player); + Axis axis = CMDUtils.getPivotAxis(args[2], player); if (axis == null) return false; try{ @@ -51,7 +51,7 @@ protected boolean executeAllPartsAction(@NotNull Player player, @Nullable Active protected boolean executeSinglePartAction(@NotNull Player player, @Nullable ActiveGroup group, @NotNull ActivePartSelection selection, @NotNull ActivePart selectedPart, @NotNull String[] args) { if (isInvalidType(player, selectedPart, SpawnedDisplayEntityPart.PartType.MANNEQUIN)) return false; - PivotAxis axis = CMDUtils.getPivotAxis(args[2], player); + Axis axis = CMDUtils.getPivotAxis(args[2], player); if (axis == null) return false; try{ From 8595470ae09491fef107a5967d9fa62800ad017a Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 06:05:31 -0500 Subject: [PATCH 11/21] Rename #setGroupRotation to #setRotation --- .../utils/DisplayEntities/ActiveGroup.java | 8 ++++---- .../command/group/GroupSetRotationCMD.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java index 8f5f97f8..0d60d0e6 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java @@ -180,10 +180,10 @@ public void removeCulling(){ * @param axis the axis to rotate on * @param pivotNonDisplays whether non-displays should be pivoted */ - public void setGroupRotation(float angleInDegrees, @NotNull Axis axis, boolean pivotNonDisplays){ + public void setRotation(float angleInDegrees, @NotNull Axis axis, boolean pivotNonDisplays){ Quaternionf newRotation = new Quaternionf(this.rotation); newRotation = axis.set(newRotation, angleInDegrees); - setGroupRotation(newRotation, pivotNonDisplays); + setRotation(newRotation, pivotNonDisplays); } /** @@ -191,7 +191,7 @@ public void setGroupRotation(float angleInDegrees, @NotNull Axis axis, boolean p * @param rotation the local space rotation to set the group's orientation to * @param pivotNonDisplays whether non-displays should be pivoted */ - public void setGroupRotation(@NotNull Quaternionf rotation, boolean pivotNonDisplays){ + public void setRotation(@NotNull Quaternionf rotation, boolean pivotNonDisplays){ Quaternionf delta = new Quaternionf(this.rotation) .invert() .mul(rotation); @@ -269,7 +269,7 @@ protected void setRotation(PersistentDataContainer pdc){ * @param pivotNonDisplays whether non-displays should be pivoted */ public void resetGroupRotation(boolean pivotNonDisplays){ - setGroupRotation(new Quaternionf(), pivotNonDisplays); + setRotation(new Quaternionf(), pivotNonDisplays); } /** diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java index a3a549f0..bb196f38 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupSetRotationCMD.java @@ -44,7 +44,7 @@ protected void execute(@NotNull Player player, @Nullable ActiveGroup group, @ OptionalArguments oArgs = getOptionalArguments(player, args); boolean displaysOnly = oArgs.hasFlag(DISPLAYS_ONLY_FLAG); - group.setGroupRotation(rotation, axis, !displaysOnly); + group.setRotation(rotation, axis, !displaysOnly); player.sendMessage(DisplayAPI.pluginPrefix.append(MiniMessage .miniMessage() From 78239fbd16d482e0f5f08be1d16cbd67e15c2c4e Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 06:06:39 -0500 Subject: [PATCH 12/21] Add Active#rotate using Axis --- .../utils/DisplayEntities/Active.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java index f5cff0bf..05f6c000 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/Active.java @@ -80,6 +80,18 @@ default void setEntityRotation(float pitch, float yaw){ */ void pivot(@NotNull Quaternionf rotation, @NotNull Location pivotLocation, boolean worldSpace); + /** + * Rotate display transformation + * @param angleInDegrees the rotation angle + * @param axis the axis to rotate on + * @param worldSpace whether the rotation should occur on world space axis + */ + default void rotate(float angleInDegrees, @NotNull Axis axis, boolean worldSpace){ + Quaternionf q = new Quaternionf(); + axis.rotate(q, angleInDegrees); + this.rotate(q, worldSpace); + } + /** * @param rotation the rotation * @param worldSpace whether the rotation should occur on world space axis From 3178569b638a41aff629bead84c37244ec55535e Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 06:08:35 -0500 Subject: [PATCH 13/21] corrected error output --- .../displayentityutils/command/display/DisplayRotateCMD.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java index 96bdccf9..db6df55f 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java @@ -56,7 +56,7 @@ protected boolean executeAllPartsAction(@NotNull Player player, @Nullable Active rotation)))); return true; } catch (NumberFormatException e) { - player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the scale!", NamedTextColor.RED))); + player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the rotation!", NamedTextColor.RED))); return false; } } @@ -86,7 +86,7 @@ protected boolean executeSinglePartAction(@NotNull Player player, @Nullable Acti rotation)))); return true; } catch (NumberFormatException e) { - player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the scale!", NamedTextColor.RED))); + player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the rotation!", NamedTextColor.RED))); return false; } } From 6f59622d9200598ba181af7f3a2add4facd9923e Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 06:24:43 -0500 Subject: [PATCH 14/21] Added ActivePart#setRotation --- .../utils/DisplayEntities/ActivePart.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePart.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePart.java index 9b3e41af..4da1c0ce 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePart.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActivePart.java @@ -8,6 +8,7 @@ import net.donnypz.displayentityutils.utils.DisplayUtils; import net.donnypz.displayentityutils.utils.InteractionCommand; import net.donnypz.displayentityutils.utils.PacketUtils; +import net.donnypz.displayentityutils.utils.Axis; import net.donnypz.displayentityutils.utils.packet.DisplayAttributeMap; import net.donnypz.displayentityutils.utils.packet.PacketAttributeContainer; import net.donnypz.displayentityutils.utils.packet.attributes.DisplayAttribute; @@ -360,6 +361,46 @@ public void unglow(@NotNull Player player) { */ public abstract void setTransformationMatrix(@NotNull Matrix4f matrix); + /** + * Change this display entity part's left rotation + * @param rotation The rotation to set + * @return false if this part is not a display entity + */ + public boolean setRotation(@NotNull Quaternionf rotation){ + if (!isDisplay()) return false; + Transformation t = getTransformation(); + setTransformation(new Transformation( + t.getTranslation(), + new Quaternionf(rotation), + t.getScale(), + t.getRightRotation() + )); + + return true; + } + + /** + * Change this display entity part's left rotation on a local axis + * @param angleInDegrees the angle in degrees + * @param axis the axis + * @return false if this part is not a display entity + */ + public boolean setRotation(float angleInDegrees, @NotNull Axis axis){ + if (!isDisplay()) return false; + Transformation t = getTransformation(); + Quaternionf existing = t.getLeftRotation(); + + setTransformation(new Transformation( + t.getTranslation(), + axis.set(existing, angleInDegrees), + t.getScale(), + t.getRightRotation() + )); + + return true; + } + + /** * Change this display entity part's X scale * @param scale The X scale to set From 61214897bdd68b026197b8e9ea2a4d4d7a923e03 Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 06:26:11 -0500 Subject: [PATCH 15/21] Added `/deu display setrotation` --- .../command/display/DisplayCMD.java | 1 + .../command/display/DisplayRotateCMD.java | 43 ++++----- .../display/DisplaySetRotationCMD.java | 90 +++++++++++++++++++ 3 files changed, 110 insertions(+), 24 deletions(-) create mode 100644 plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplaySetRotationCMD.java diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayCMD.java index 9e88e486..96671614 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayCMD.java @@ -14,6 +14,7 @@ public DisplayCMD(){ new DisplayTranslateCMD(this); new DisplayResetCMD(this); new DisplayRotateCMD(this); + new DisplaySetRotationCMD(this); new DisplayScaleCMD(this); new DisplaySetBlockCMD(this); } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java index db6df55f..32c3cc92 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplayRotateCMD.java @@ -4,6 +4,7 @@ import net.donnypz.displayentityutils.command.DEUSubCommand; import net.donnypz.displayentityutils.command.PartsSubCommand; import net.donnypz.displayentityutils.command.Permission; +import net.donnypz.displayentityutils.utils.Axis; import net.donnypz.displayentityutils.utils.DisplayEntities.ActiveGroup; import net.donnypz.displayentityutils.utils.DisplayEntities.ActivePart; import net.donnypz.displayentityutils.utils.DisplayEntities.ActivePartSelection; @@ -32,16 +33,15 @@ class DisplayRotateCMD extends PartsSubCommand { @Override protected boolean executeAllPartsAction(@NotNull Player player, @Nullable ActiveGroup group, @NotNull MultiPartSelection selection, @NotNull String[] args) { try { + String axisInput = args[2]; + Axis axis = Axis.valueOf(axisInput.toUpperCase()); float rotation = Float.parseFloat(args[3]); if (rotation == 0.0f) { player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a non-zero number for the rotation, in degrees!", NamedTextColor.RED))); return false; } - Quaternionf q = getRotation(args[2], rotation); - if (q == null) { - incorrectUsage(player); - return false; - } + + Quaternionf q = axis.rotate(new Quaternionf(), rotation); boolean worldSpace = getOptionalArguments(player, args).hasFlag(WORLD_SPACE); for (ActivePart selectedPart : selection.getParts()) { @@ -59,22 +59,26 @@ protected boolean executeAllPartsAction(@NotNull Player player, @Nullable Active player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the rotation!", NamedTextColor.RED))); return false; } + catch(IllegalArgumentException e){ + super.incorrectUsage(player); + return false; + } } @Override protected boolean executeSinglePartAction(@NotNull Player player, @Nullable ActiveGroup group, @NotNull ActivePartSelection selection, @NotNull ActivePart selectedPart, @NotNull String[] args) { if (isNotDisplay(player, selectedPart)) return false; try { + String axisInput = args[2]; + Axis axis = Axis.valueOf(axisInput.toUpperCase()); float rotation = Float.parseFloat(args[3]); + if (rotation == 0.0f) { player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a non-zero number for the rotation, in degrees!", NamedTextColor.RED))); return false; } - Quaternionf q = getRotation(args[2], rotation); - if (q == null) { - incorrectUsage(player); - return false; - } + + Quaternionf q = axis.rotate(new Quaternionf(), rotation); boolean worldSpace = getOptionalArguments(player, args).hasFlag(WORLD_SPACE); selectedPart.rotate(q, worldSpace); @@ -89,25 +93,16 @@ protected boolean executeSinglePartAction(@NotNull Player player, @Nullable Acti player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the rotation!", NamedTextColor.RED))); return false; } + catch(IllegalArgumentException e){ + super.incorrectUsage(player); + return false; + } } @Override - protected void sendIncorrectUsage(@NotNull Player player) { - } + protected void sendIncorrectUsage(@NotNull Player player) {} - private Quaternionf getRotation(String arg, float angle) { - float angleRad = (float) Math.toRadians(angle); - if (arg.equalsIgnoreCase("x")) { - return new Quaternionf().rotateX(angleRad); - } else if (arg.equalsIgnoreCase("y")) { - return new Quaternionf().rotateY(angleRad); - } else if (arg.equalsIgnoreCase("z")) { - return new Quaternionf().rotateZ(angleRad); - } - return null; - } - @Override protected String getDescription() { return "Rotate your selected display on an axis"; diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplaySetRotationCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplaySetRotationCMD.java new file mode 100644 index 00000000..d9657de2 --- /dev/null +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/display/DisplaySetRotationCMD.java @@ -0,0 +1,90 @@ +package net.donnypz.displayentityutils.command.display; + +import net.donnypz.displayentityutils.DisplayAPI; +import net.donnypz.displayentityutils.command.DEUSubCommand; +import net.donnypz.displayentityutils.command.PartsSubCommand; +import net.donnypz.displayentityutils.command.Permission; +import net.donnypz.displayentityutils.utils.Axis; +import net.donnypz.displayentityutils.utils.DisplayEntities.ActiveGroup; +import net.donnypz.displayentityutils.utils.DisplayEntities.ActivePart; +import net.donnypz.displayentityutils.utils.DisplayEntities.ActivePartSelection; +import net.donnypz.displayentityutils.utils.DisplayEntities.MultiPartSelection; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.MiniMessage; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +class DisplaySetRotationCMD extends PartsSubCommand { + + DisplaySetRotationCMD(@NotNull DEUSubCommand parentSubCommand) { + super("setrotation", parentSubCommand, Permission.DISPLAY_TRANSFORM, true); + setTabComplete(2, List.of("x", "y", "z")); + setTabComplete(3, ""); + } + + @Override + protected boolean executeAllPartsAction(@NotNull Player player, @Nullable ActiveGroup group, @NotNull MultiPartSelection selection, @NotNull String[] args) { + try { + String axisInput = args[2]; + Axis axis = Axis.valueOf(axisInput.toUpperCase()); + float rotation = Float.parseFloat(args[3]); + + for (ActivePart selectedPart : selection.getParts()) { + if (!selectedPart.isDisplay()) continue; + selectedPart.setRotation(rotation, axis); + } + + player.sendMessage(DisplayAPI.pluginPrefix.append(MiniMessage + .miniMessage() + .deserialize(String.format("Rotating your selected parts on their local %s axis by %s degrees!", + args[2].toUpperCase(), + rotation)))); + return true; + } catch (NumberFormatException e) { + player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the scale!", NamedTextColor.RED))); + return false; + } + catch(IllegalArgumentException e){ + super.incorrectUsage(player); + return false; + } + } + + @Override + protected boolean executeSinglePartAction(@NotNull Player player, @Nullable ActiveGroup group, @NotNull ActivePartSelection selection, @NotNull ActivePart selectedPart, @NotNull String[] args) { + if (isNotDisplay(player, selectedPart)) return false; + try { + String axisInput = args[2]; + Axis axis = Axis.valueOf(axisInput.toUpperCase()); + float rotation = Float.parseFloat(args[3]); + + selectedPart.setRotation(rotation, axis); + + player.sendMessage(DisplayAPI.pluginPrefix.append(MiniMessage + .miniMessage() + .deserialize(String.format("Rotating your selected part on the local %s axis by %s degrees!", + args[2].toUpperCase(), + rotation)))); + return true; + } catch (NumberFormatException e) { + player.sendMessage(DisplayAPI.pluginPrefix.append(Component.text("Enter a valid number for the rotation!", NamedTextColor.RED))); + return false; + } + catch(IllegalArgumentException e){ + super.incorrectUsage(player); + return false; + } + } + + @Override + protected void sendIncorrectUsage(@NotNull Player player) {} + + @Override + protected String getDescription() { + return "Rotate your selected display on an axis"; + } +} From 52c37f3a076a426a381cb9f1ac78caa67d0ca0a2 Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 06:32:11 -0500 Subject: [PATCH 16/21] Bump to 3.7.0-PRE --- api/pom.xml | 2 +- plugin/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 47aa9c63..b6b6df35 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.6.1-PRE + 3.7.0-PRE api diff --git a/plugin/pom.xml b/plugin/pom.xml index 208819bb..1fe344d3 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.6.1-PRE + 3.7.0-PRE plugin diff --git a/pom.xml b/pom.xml index b5e86510..77d9661d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.6.1-PRE + 3.7.0-PRE pom DisplayEntityUtils From 25d62dadb6224021845db0123f9afa6d3c3a39ac Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 06:55:13 -0500 Subject: [PATCH 17/21] Rename new rotation related methods in ActiveGroup --- .../utils/DisplayEntities/ActiveGroup.java | 6 +++--- .../utils/DisplayEntities/DisplayEntity.java | 2 +- .../displayentityutils/command/group/GroupInfoCMD.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java index 0d60d0e6..a286892a 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/ActiveGroup.java @@ -260,7 +260,7 @@ protected void setRotation(PersistentDataContainer pdc){ } - public @NotNull Quaternionf getGroupRotation(){ + public @NotNull Quaternionf getRotation(){ return new Quaternionf(this.rotation); } @@ -268,7 +268,7 @@ protected void setRotation(PersistentDataContainer pdc){ * Reset the group's rotation to its default orientation * @param pivotNonDisplays whether non-displays should be pivoted */ - public void resetGroupRotation(boolean pivotNonDisplays){ + public void resetRotation(boolean pivotNonDisplays){ setRotation(new Quaternionf(), pivotNonDisplays); } @@ -276,7 +276,7 @@ public void resetGroupRotation(boolean pivotNonDisplays){ * Make the group's current rotation its default orientation, resetting the group's * stored rotation but retaining the current orientation */ - public void rebaseGroupRotation(){ + public void rebaseRotation(){ this.rotation = new Quaternionf(); } diff --git a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java index 19c9c80e..d8a963e7 100644 --- a/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java +++ b/api/src/main/java/net/donnypz/displayentityutils/utils/DisplayEntities/DisplayEntity.java @@ -75,7 +75,7 @@ else if (type == Type.TEXT) { pdc.set(DisplayKeys.SpawnAnimation.TYPE, PersistentDataType.STRING, group.spawnAnimationType.name()); pdc.set(DisplayKeys.SpawnAnimation.LOAD_METHOD, PersistentDataType.STRING, group.spawnAnimationLoadMethod.name()); } - pdc.set(DisplayKeys.Group.GROUP_ROTATION, PersistentDataType.BYTE_ARRAY, ActiveGroup.getRotationByteArray(group.getGroupRotation())); + pdc.set(DisplayKeys.Group.GROUP_ROTATION, PersistentDataType.BYTE_ARRAY, ActiveGroup.getRotationByteArray(group.getRotation())); } persistentDataContainer = pdc.serializeToBytes(); } diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java index eab6170e..a5536ca0 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/command/group/GroupInfoCMD.java @@ -61,7 +61,7 @@ public void execute(Player player, String[] args) { Location loc = group.getLocation(); player.sendMessage(MiniMessage.miniMessage().deserialize("Pitch & Yaw: "+loc.getPitch()+", "+loc.getYaw())); - Vector3f euler = group.getGroupRotation().getEulerAnglesXYZ(new Vector3f()); + Vector3f euler = group.getRotation().getEulerAnglesXYZ(new Vector3f()); float eulerXDeg = (float) Math.toDegrees(euler.x); float eulerYDeg = (float) Math.toDegrees(euler.y); float eulerZDeg = (float) Math.toDegrees(euler.z); From 3b5c4aeaf6ae38530fcb6da4d8377dc4427a78ce Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 07:49:58 -0500 Subject: [PATCH 18/21] Add syntax to set rotation on axis for parts and groups --- .../skript/active/ActiveModule.java | 1 + .../expressions/ExprActiveRotation.java | 171 ++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 plugin/src/main/java/net/donnypz/displayentityutils/skript/active/expressions/ExprActiveRotation.java diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/skript/active/ActiveModule.java b/plugin/src/main/java/net/donnypz/displayentityutils/skript/active/ActiveModule.java index 9a030964..84384c5d 100644 --- a/plugin/src/main/java/net/donnypz/displayentityutils/skript/active/ActiveModule.java +++ b/plugin/src/main/java/net/donnypz/displayentityutils/skript/active/ActiveModule.java @@ -22,6 +22,7 @@ public void load(SkriptAddon addon) { ExprActiveDirection::register, ExprActiveGlowColor::register, ExprActiveInterpolation::register, + ExprActiveRotation::register, ExprActiveTeleportDuration::register, ExprActiveViewRange::register ); diff --git a/plugin/src/main/java/net/donnypz/displayentityutils/skript/active/expressions/ExprActiveRotation.java b/plugin/src/main/java/net/donnypz/displayentityutils/skript/active/expressions/ExprActiveRotation.java new file mode 100644 index 00000000..52e3259f --- /dev/null +++ b/plugin/src/main/java/net/donnypz/displayentityutils/skript/active/expressions/ExprActiveRotation.java @@ -0,0 +1,171 @@ +package net.donnypz.displayentityutils.skript.active.expressions; + +import ch.njol.skript.classes.Changer; +import ch.njol.skript.doc.Description; +import ch.njol.skript.doc.Examples; +import ch.njol.skript.doc.Name; +import ch.njol.skript.doc.Since; +import ch.njol.skript.expressions.base.SimplePropertyExpression; +import ch.njol.skript.lang.Expression; +import ch.njol.skript.lang.SkriptParser; +import ch.njol.util.Kleenean; +import ch.njol.util.coll.CollectionUtils; +import net.donnypz.displayentityutils.utils.Axis; +import net.donnypz.displayentityutils.utils.DisplayEntities.Active; +import net.donnypz.displayentityutils.utils.DisplayEntities.ActiveGroup; +import net.donnypz.displayentityutils.utils.DisplayEntities.ActivePart; +import org.bukkit.event.Event; +import org.bukkit.util.Vector; +import org.joml.Quaternionf; +import org.skriptlang.skript.registration.SyntaxInfo; +import org.skriptlang.skript.registration.SyntaxRegistry; + + +@Name("Active Group/Part - Rotation") +@Description("Get/Set the local, transformation space rotation of an active group or active part. " + + "Vectors can be used to set the rotation, and its values must be in degrees.") +@Examples({ + "set {_activepart}'s deu y rotation to 90 degrees", + "set {_activegroup}'s deu x rotation to 45 degrees", + "", + "set {_activegroup}'s deu rotation to {_vector}", + "set {_activepart}'s deu rotation to {_quaternion}", + "", + "set {_quaternion} to {_activepart}'s deu rotation", + "set {_quaternion} to {_activegroup}'s deu display rotation", +}) +@Since("3.7.0") +public class ExprActiveRotation extends SimplePropertyExpression { + + Axis axis; + + public static void register(SyntaxRegistry registry){ + registry.register(SyntaxRegistry.EXPRESSION, + SyntaxInfo.Expression.builder(ExprActiveRotation.class, Quaternionf.class) + .addPatterns(getPatterns("deu [display|transform[ation]] [:x|:y|:z] rotation [degrees]", "activegroups/activeparts")) + .supplier(ExprActiveRotation::new) + .build() + ); + } + + @Override + public Quaternionf convert(Active from) { + Quaternionf q; + if (from instanceof ActivePart p && p.isDisplay()){ + q = p.getTransformation().getLeftRotation(); + } + else if (from instanceof ActiveGroup g){ + q = g.getRotation(); + } + else{ + q = null; + } + return q; + } + + @Override + protected String getPropertyName() { + return "deu rotation"; + } + + @Override + public Class getReturnType() { + return Quaternionf.class; + } + + @Override + public void change(Event event, Object[] delta, Changer.ChangeMode mode){ + Object[] active = getExpr().getArray(event); + if (active == null){ + return; + } + + switch (mode) { + case SET -> { + if (delta == null) return; + + Object o = delta[0]; + if (o == null) return; + + Quaternionf q; + Number n; + switch (o) { + case Quaternionf quaternionf -> { + q = quaternionf; + n = null; + } + case Vector vector -> { + q = new Quaternionf().rotationXYZ( + (float) Math.toRadians(vector.getX()), + (float) Math.toRadians(vector.getY()), + (float) Math.toRadians(vector.getZ()) + ); + n = null; + } + case Number number -> { + q = null; + n = number; + } + default -> { + return; + } + } + + if (q != null && !q.isFinite()) return; + + for (Object a : active){ + if (a instanceof ActiveGroup g){ + if (axis == null){ + if (q == null) return; + g.setRotation(q, true); + } + else{ + if (n == null) return; + g.setRotation(n.floatValue(), axis, true); + } + } + else if (a instanceof ActivePart p){ + if (axis == null){ + if (q == null) return; + p.setRotation(q); + } + else{ + if (n == null) return; + p.setRotation(n.floatValue(), axis); + } + } + } + } + case RESET -> { + for (Object a : active){ + if (a instanceof ActiveGroup g){ + if (axis == null) g.resetRotation(true); + else g.setRotation(0, axis, true); + } + else if (a instanceof ActivePart part){ + if (axis == null) part.setRotation(new Quaternionf()); + else part.setRotation(0, axis); + } + } + } + } + } + + @Override + public Class[] acceptChange(final Changer.ChangeMode mode) { + if (mode == Changer.ChangeMode.RESET) return CollectionUtils.array(); + if (mode == Changer.ChangeMode.SET) { + return CollectionUtils.array(Quaternionf.class, Vector.class, Number.class); + } + return null; + } + + @Override + public boolean init(Expression[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { + if (parseResult.hasTag("x")) axis = Axis.X; + else if (parseResult.hasTag("y")) axis = Axis.Y; + else if (parseResult.hasTag("z")) axis = Axis.Z; + else axis = null; + return super.init(expressions, matchedPattern, isDelayed, parseResult); + } +} From ca7e00ecb47532352b65ff58f1cdeee061ef1d0f Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 12:13:32 -0500 Subject: [PATCH 19/21] Bump version to 3.7.0 --- api/pom.xml | 2 +- plugin/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index b6b6df35..ff4df2a4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.7.0-PRE + 3.7.0 api diff --git a/plugin/pom.xml b/plugin/pom.xml index 1fe344d3..89a3cf69 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.7.0-PRE + 3.7.0 plugin diff --git a/pom.xml b/pom.xml index 77d9661d..84da3df0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.donnypz.displayentityutils deu - 3.7.0-PRE + 3.7.0 pom DisplayEntityUtils From 96edd2d2183207a35c188dda223cc3eeff9a77db Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 12:20:21 -0500 Subject: [PATCH 20/21] 3.7.0 release notes --- docs/release-notes/3.7.0.md | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 docs/release-notes/3.7.0.md diff --git a/docs/release-notes/3.7.0.md b/docs/release-notes/3.7.0.md new file mode 100644 index 00000000..e35a8879 --- /dev/null +++ b/docs/release-notes/3.7.0.md @@ -0,0 +1,46 @@ +**Release Highlights** +- New Rotation Commands💻 +- New Skript Syntax📜 +- New and Breaking API Changes 🔨 + +## Command Changes + +### New Commands +- Added `/deu group setrotation` + - Set a group's rotation on a given local axis + - Permission: `deu.group.transform` +- Added `/deu display setrotation` + - Set a display's rotation on a given local axis + - Permission: `deu.display.transform` + + +## Skript +### New Syntax + +- Added `Active Group/Part - Rotation` + - Get/Set an active group or active part's display transformation rotation + ```yml + set {_activepart}'s deu y rotation to 90 degrees + set {_activegroup}'s deu rotation to {_vector} + set {_quaternion} to {_activepart}'s deu rotation + ``` + +[![SkriptHubViewTheDocs](http://skripthub.net/static/addon/ViewTheDocsButton.png)](http://skripthub.net/docs/?addon=DisplayEntityUtils) + +## API Changes +> [!NOTE] +>**New Version:** `3.7.0` + +### Additions/Changes +- Added `ActiveGroup#setRotation`, to change a group's transformation rotation, rather than entity pitch and yaws +- Added `getRotation`, `resetRotation`, and `rebaseRotation` to `ActiveGroup` +- Added `Active#rotate` using an `Axis` for rotation +- Added `ActivePart#setRotation` to change a display part's transformation rotation + +### Breaking Changes +- Removed `SpawnedDisplayEntityPart#getCreationTime` +- Changed `#setRotation` to `#setEntityRotation` in `Active` +- Renamed `PivotAxis` class to `Axis` + +## QOL +- Added group rotation info to `/deu group info` \ No newline at end of file From b20893c1c8d82ca92f143c2e79e76e9e95d6dd1a Mon Sep 17 00:00:00 2001 From: Jay <76460079+PZDonny@users.noreply.github.com> Date: Sun, 2 Aug 2026 12:21:17 -0500 Subject: [PATCH 21/21] update publish workflow, automatically creating releases --- .github/workflows/publish.yml | 45 +++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1ac43dd5..162fbbbc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,14 @@ name: Publish on: - release: - types: [ published ] + push: + tags: + - "*.*.*" jobs: publish: + env: + TAG: ${{ github.ref_name }} name: Publish runs-on: ubuntu-latest permissions: @@ -22,36 +25,52 @@ jobs: distribution: 'temurin' cache: maven + - name: Verify Release Notes Exist + run: test -f "docs/release-notes/$TAG.md" + - name: Set version from release tag - run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false + run: mvn -B versions:set -DnewVersion=$TAG -DgenerateBackupPoms=false - name: Build and package with Maven run: mvn -B clean package --file pom.xml - - name: Upload to GitHub Release + - name: Create GitHub Release env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} run: | - TAG="${{ github.event.release.tag_name }}" - - gh release upload "$TAG" \ + gh release create "$TAG" \ "plugin/target/displayentityutils-$TAG.jar" \ - --clobber + --verify-tag \ + --title "DEU $TAG" \ + --notes-file "docs/release-notes/$TAG.md" \ + --generate-notes + - name: Get Release body + id: release_notes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + { + echo "body<> "$GITHUB_OUTPUT" - name: Upload to Modrinth uses: cloudnode-pro/modrinth-publish@v2 with: token: ${{ secrets.MODRINTH_TOKEN }} project: ${{ vars.MODRINTH_ID }} - name: ${{ github.event.release.name }} - version: ${{ github.event.release.tag_name }} - changelog: ${{ github.event.release.body }} + name: DEU ${{ env.TAG }} + version: ${{ env.TAG }} + changelog: ${{ steps.release_notes.outputs.body }} loaders: |- paper game-versions: |- - 1.20.x + 1.20.4 + 1.20.5 + 1.20.6 1.21.x 26.1.x 26.2 - files: plugin/target/displayentityutils-${{ github.event.release.tag_name }}.jar \ No newline at end of file + files: plugin/target/displayentityutils-${{ env.TAG }}.jar \ No newline at end of file