Skip to content

Commit

Permalink
Update text hologram
Browse files Browse the repository at this point in the history
  • Loading branch information
max1mde committed Jun 22, 2024
1 parent e7c1775 commit 6ea19ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = 'com.maximde'
version = '1.2.0'
version = '1.2.1'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private BukkitRunnable animateHologram(TextHologram hologram, TextAnimation text
int currentFrame = 0;
public void run() {
if(textAnimation.getTextFrames().isEmpty()) return;
hologram.setText(textAnimation.getTextFrames().get(currentFrame));
hologram.setMiniMessageText(textAnimation.getTextFrames().get(currentFrame));
hologram.update();
currentFrame++;
if(currentFrame >= textAnimation.getTextFrames().size()) currentFrame = 0;
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/com/maximde/hologramapi/hologram/TextHologram.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class TextHologram {

// No setters because own implementation of setters at the bottom
protected Component text = Component.text("Hologram API");
protected Vector3f scale = new Vector3f(0,0,0);
protected Vector3f translation = new Vector3f(0, 0.7F, 0);
protected Vector3f scale = new Vector3f(1,1,1);
protected Vector3f translation = new Vector3f(0, 0F, 0);

@Setter @Getter @Accessors(chain = true)
protected Display.Billboard billboard = Display.Billboard.CENTER;
Expand Down Expand Up @@ -110,6 +110,7 @@ public TextHologram spawn(Location location) {
new Vector3d(this.location.getX(), this.location.getY() + 1, this.location.getZ()), 0f, 0f, 0f, 0, Optional.empty());
updateAffectedPlayers();
sendPacket(packet);
this.dead = false;
return this;
}

Expand Down Expand Up @@ -171,6 +172,11 @@ public Vector3F getTranslation() {
return new Vector3F(this.translation.x, this.translation.y, this.translation.z);
}

public TextHologram setTranslation(float x, float y, float z) {
this.translation = new Vector3f(x, y, z);
return this;
}

public TextHologram setTranslation(Vector3F translation) {
this.translation = new Vector3f(translation.x, translation.y, translation.z);
return this;
Expand All @@ -182,6 +188,11 @@ public Vector3F getScale() {
}


public TextHologram setScale(float x, float y, float z) {
this.scale = new Vector3f(x, y, z);
return this;
}

public TextHologram setScale(Vector3F scale) {
this.scale = new Vector3f(scale.x, scale.y, scale.z);
return this;
Expand Down

0 comments on commit 6ea19ec

Please sign in to comment.