Skip to content

Commit 32579ee

Browse files
committed
Add documentation & API method for scoreboard color fallback
1 parent 1f263d8 commit 32579ee

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

api/src/main/java/com/lunarclient/apollo/module/glow/GlowModule.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ public boolean isClientNotify() {
4747
/**
4848
* Overrides the glow effect for the glowingPlayer, visible by the viewers.
4949
*
50+
* <p>If no color is specified, the glowing color will match the player's scoreboard team color.</p>
51+
*
52+
*
53+
* @param recipients the recipients that are receiving the packet
54+
* @param glowingPlayer the UUID of the player whose glowing effect will be overwrote
55+
* @since 1.1.9
56+
*/
57+
public abstract void overrideGlow(Recipients recipients, UUID glowingPlayer);
58+
59+
/**
60+
* Overrides the glow effect for the glowingPlayer, visible by the viewers.
61+
*
62+
* <p>If the {@code color} parameter is {@code null}, the glowing color will match the player's scoreboard team color.</p>
63+
*
5064
* @param recipients the recipients that are receiving the packet
5165
* @param glowingPlayer the UUID of the player whose glowing effect will be overwrote
5266
* @param color the new color glowingPlayer should glow in.

common/src/main/java/com/lunarclient/apollo/module/glow/GlowModuleImpl.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.awt.Color;
3333
import java.util.UUID;
3434
import lombok.NonNull;
35+
import org.jetbrains.annotations.Nullable;
3536

3637
/**
3738
* Provides the glow module.
@@ -41,12 +42,20 @@
4142
public final class GlowModuleImpl extends GlowModule {
4243

4344
@Override
44-
public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @NonNull Color color) {
45-
OverrideGlowEffectMessage message = OverrideGlowEffectMessage.newBuilder()
46-
.setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer))
47-
.setColor(NetworkTypes.toProtobuf(color))
48-
.build();
45+
public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer) {
46+
this.overrideGlow(recipients, glowingPlayer, null);
47+
}
48+
49+
@Override
50+
public void overrideGlow(@NonNull Recipients recipients, @NonNull UUID glowingPlayer, @Nullable Color color) {
51+
OverrideGlowEffectMessage.Builder builder = OverrideGlowEffectMessage.newBuilder()
52+
.setPlayerUuid(NetworkTypes.toProtobuf(glowingPlayer));
53+
54+
if (color != null) {
55+
builder.setColor(NetworkTypes.toProtobuf(color));
56+
}
4957

58+
OverrideGlowEffectMessage message = builder.build();
5059
recipients.forEach(player -> ((AbstractApolloPlayer) player).sendPacket(message));
5160
}
5261

docs/developers/modules/glow.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The glow module allows you to take advantage of the vanilla Minecraft Glow Effec
1010
- Backports all vanilla Minecraft glow effect functionality, found on 1.9+ to the 1.7 and 1.8 version of Lunar Client.
1111
- Adds improvements to glow effect for Lunar Client users.
1212
- Customizable colors for the glow effect, different from the vanilla Minecraft colors.
13+
- If no color is specified, the glow effect will default to the player's scoreboard team color.
1314

1415
<Callout type="Warning">
1516
In Version 1.12, Optifine's 'Fast Render' setting alters player rendering. This is expected behavior for Optifine.
@@ -65,6 +66,7 @@ public void resetGlowEffectsExample(Player viewer) {
6566
2. `UUID target`
6667
- The player or living entity you want to display the glow effect on.
6768
3. `Color glowColor`
69+
- If `null` is passed (or if no color is specified), the glow effect will default to the target's scoreboard team color.
6870
- How you'll dictate the color of the glow effect, see the [colors page](/apollo/developers/utilities/colors) for more.
6971

7072
</Tab>

0 commit comments

Comments
 (0)