Hologram Module
Overview
The hologram module enhances vanilla Minecraft's current system for holograms and backports all the improvements and vanilla features to Minecraft 1.7 players.
- Backports all vanilla Minecraft hologram capabilities, found in 1.8+ to the 1.7 version of Lunar Client.
- Added the interactivity that is provided in 1.8+ to the 1.7 version of Lunar Client.
- Adds improvements to enhance vanilla Minecraft holograms.
- Removes the need to do any complex process to create holograms on 1.7 Minecraft.
- Custom hologram colors can be provided.
Integration
Sample Code
public void displayHologramExample() {
this.hologramModule.displayHologram(Recipients.ofEveryone(), Hologram.builder()
.id("welcome-hologram")
.location(ApolloLocation.builder()
.world("world")
.x(5)
.y(105)
.z(0)
.build())
.lines(Lists.newArrayList(
Component.text()
.content("Welcome to my server!")
.color(NamedTextColor.RED)
.decorate(TextDecoration.BOLD, TextDecoration.UNDERLINED)
.build(),
Component.text()
.content("Type /help to get started!")
.build()
))
.showThroughWalls(true)
.showShadow(false)
.showBackground(true)
.build()
);
}
Hologram
Options
.id(String)
should include a unique identifier for the hologram.
.id("welcome-hologram")
.location(ApolloLocation)
is using the ApolloLocation
builder to create the location. See the locations page for more.
.location(ApolloLocation.builder()
.world("world")
.x(5)
.y(100)
.z(0)
.build()
)
.lines(Component)
should be a string, or an Adventure Component
. See the chat components (opens in a new tab) page for more.
.lines(List.of(
Component.text()
.content("Welcome to my server!")
.color(NamedTextColor.RED)
.decorate(TextDecoration.BOLD, TextDecoration.UNDERLINED)
.build(),
Component.text()
.content("Type /help to get started!")
.build()
))
.showThroughWalls(Boolean)
if the player is able to see the hologram through walls.
.showThroughWalls(true)
.showShadow(Boolean)
if the player is able to see the hologram shadow.
.showShadow(false)
.showBackground(Boolean)
if the player is able to see the hologram background.
.showBackground(true)
Removing a specific hologram for players
public void removeHologramExample() {
this.hologramModule.removeHologram(Recipients.ofEveryone(), "welcome-hologram");
}
Resetting all holograms for a player
public void resetHologramsExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.hologramModule::resetHolograms);
}