generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a762635
commit ef6b452
Showing
7 changed files
with
184 additions
and
21 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
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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/portingdeadmods/nautec/utils/ComponentUtils.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,30 @@ | ||
package com.portingdeadmods.nautec.utils; | ||
|
||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.network.chat.MutableComponent; | ||
|
||
public final class ComponentUtils { | ||
public static MutableComponent colored(String text, ChatFormatting col) { | ||
return Component.literal(text).withStyle(col); | ||
} | ||
|
||
public static MutableComponent countableStatShow(String name, Number val, Number max) { | ||
MutableComponent mc1 = colored(name, ChatFormatting.YELLOW) | ||
.append(Component.literal(": ").withStyle(ChatFormatting.WHITE)); | ||
|
||
if (val.doubleValue() < max.doubleValue()) { | ||
mc1.append(colored(val.toString(), ChatFormatting.GREEN)); | ||
} else { | ||
mc1.append(colored(val.toString(), ChatFormatting.RED)); | ||
} | ||
|
||
return mc1; | ||
} | ||
|
||
public static MutableComponent stringStatShow(String name, String val) { | ||
return colored(name, ChatFormatting.YELLOW) | ||
.append(Component.literal(": ").withStyle(ChatFormatting.WHITE)) | ||
.append(colored(val, ChatFormatting.GREEN)); | ||
} | ||
} |
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