-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
101 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/us/mytheria/bloblib/entities/display/DisplayInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package us.mytheria.bloblib.entities.display; | ||
|
||
import org.bukkit.entity.Display; | ||
import org.bukkit.util.Transformation; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.joml.Quaternionf; | ||
import org.joml.Vector3f; | ||
|
||
import java.util.Objects; | ||
|
||
public record DisplayInfo(@NotNull DisplayData getDisplayData, | ||
@NotNull Transformation getTransformation) { | ||
|
||
/** | ||
* Gets a DisplayInfo instance from the given Display. | ||
* | ||
* @param display the Display to get the DisplayInfo from | ||
* @return the DisplayInfo from the given Display | ||
*/ | ||
public static DisplayInfo of(@NotNull Display display) { | ||
Objects.requireNonNull(display, "'display' cannot be null"); | ||
Transformation transformation = display.getTransformation(); | ||
Vector3f translation = transformation.getTranslation(); | ||
Quaternionf leftRotation = transformation.getLeftRotation(); | ||
Vector3f scale = transformation.getScale(); | ||
Quaternionf rightRotation = transformation.getRightRotation(); | ||
return new DisplayInfo(DisplayData.of(display), | ||
new Transformation( | ||
new Vector3f(translation.x, translation.y, translation.z), | ||
new Quaternionf(leftRotation.x, leftRotation.y, leftRotation.z, leftRotation.w), | ||
new Vector3f(scale.x, scale.y, scale.z), | ||
new Quaternionf(rightRotation.x, rightRotation.y, rightRotation.z, rightRotation.w))); | ||
} | ||
|
||
/** | ||
* Applies the DisplayInfo to the given Display. | ||
* | ||
* @param display the Display to apply the DisplayInfo to | ||
*/ | ||
public void apply(@NotNull Display display) { | ||
getDisplayData.apply(display); | ||
display.setTransformation(getTransformation()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Listeners: | ||
TinyListeners: | ||
Display-Unriding: true | ||
Display-Unriding: false | ||
Locale: | ||
Console: en_us | ||
Default-To: | ||
|