-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔖 SpruceUI v1.3.5: Add utility methods, 1.16 compability and more.
- Loading branch information
1 parent
3c32933
commit e5d9416
Showing
9 changed files
with
176 additions
and
10 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
88 changes: 88 additions & 0 deletions
88
src/main/java/me/lambdaurora/spruceui/hud/component/TextHudComponent.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,88 @@ | ||
/* | ||
* Copyright © 2020 LambdAurora <[email protected]> | ||
* | ||
* This file is part of SpruceUI. | ||
* | ||
* Licensed under the MIT license. For more information, | ||
* see the LICENSE file. | ||
*/ | ||
|
||
package me.lambdaurora.spruceui.hud.component; | ||
|
||
import me.lambdaurora.spruceui.hud.HudComponent; | ||
import net.minecraft.client.MinecraftClient; | ||
import org.aperlambda.lambdacommon.Identifier; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* Represents a text HUD component. | ||
* | ||
* @author LambdAurora | ||
* @version 1.3.5 | ||
* @since 1.3.5 | ||
*/ | ||
public class TextHudComponent extends HudComponent | ||
{ | ||
protected MinecraftClient client; | ||
protected String text; | ||
protected int color; | ||
|
||
public TextHudComponent(@NotNull Identifier identifier, int x, int y, String text) | ||
{ | ||
this(identifier, x, y, text, 0xffffffff); | ||
} | ||
|
||
public TextHudComponent(@NotNull Identifier identifier, int x, int y, String text, int color) | ||
{ | ||
super(identifier, x, y); | ||
this.client = MinecraftClient.getInstance(); | ||
this.text = text; | ||
this.color = color; | ||
} | ||
|
||
/** | ||
* Gets this component's text. | ||
* | ||
* @return The component's text. | ||
*/ | ||
public String getText() | ||
{ | ||
return this.text; | ||
} | ||
|
||
/** | ||
* Sets this component's text. | ||
* | ||
* @param text The text. | ||
*/ | ||
public void setText(String text) | ||
{ | ||
this.text = text; | ||
} | ||
|
||
/** | ||
* Gets this component's text color. | ||
* | ||
* @return The text color. | ||
*/ | ||
public int getColor() | ||
{ | ||
return this.color; | ||
} | ||
|
||
/** | ||
* Sets this component's text color. | ||
* | ||
* @param color The text color. | ||
*/ | ||
public void setColor(int color) | ||
{ | ||
this.color = color; | ||
} | ||
|
||
@Override | ||
public void render(float tickDelta) | ||
{ | ||
this.drawString(client.textRenderer, this.text, this.x, this.y, this.color); | ||
} | ||
} |
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