Hologram is now a Viewable

This commit is contained in:
Felix Cravic 2020-07-24 19:44:30 +02:00
parent 5c1e6e7572
commit 1345968aac

View File

@ -1,12 +1,16 @@
package net.minestom.server.entity.hologram;
import net.minestom.server.Viewable;
import net.minestom.server.chat.ColoredText;
import net.minestom.server.entity.Player;
import net.minestom.server.entity.type.EntityArmorStand;
import net.minestom.server.instance.Instance;
import net.minestom.server.utils.Position;
import net.minestom.server.utils.validate.Check;
public class Hologram {
import java.util.Set;
public class Hologram implements Viewable {
private static final float OFFSET_Y = -0.9875f;
@ -60,10 +64,35 @@ public class Hologram {
return removed;
}
/**
* Get the hologram entity (armor stand)
*
* @return the hologram entity
*/
public HologramEntity getEntity() {
return entity;
}
@Override
public boolean addViewer(Player player) {
return entity.addViewer(player);
}
@Override
public boolean removeViewer(Player player) {
return entity.removeViewer(player);
}
@Override
public Set<Player> getViewers() {
return entity.getViewers();
}
private void checkRemoved() {
Check.stateCondition(isRemoved(), "You cannot interact with a removed Hologram");
}
private class HologramEntity extends EntityArmorStand {
public HologramEntity(Position spawnPosition) {