9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-22 08:29:28 +00:00
This commit is contained in:
XiaoMoMi
2024-03-10 08:13:34 +08:00
parent 6fafb85cec
commit be8cf27f37
4 changed files with 19 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ plugins {
allprojects { allprojects {
version = "2.3.3.3" version = "2.3.3.4"
apply<JavaPlugin>() apply<JavaPlugin>()
apply(plugin = "java") apply(plugin = "java")

View File

@@ -29,6 +29,7 @@ import net.kyori.adventure.text.minimessage.internal.parser.node.ElementNode;
import net.kyori.adventure.text.minimessage.internal.parser.node.TagNode; import net.kyori.adventure.text.minimessage.internal.parser.node.TagNode;
import net.kyori.adventure.text.minimessage.internal.parser.node.ValueNode; import net.kyori.adventure.text.minimessage.internal.parser.node.ValueNode;
import net.kyori.adventure.text.minimessage.tag.Inserting; import net.kyori.adventure.text.minimessage.tag.Inserting;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.momirealms.customnameplates.api.CustomNameplatesPlugin; import net.momirealms.customnameplates.api.CustomNameplatesPlugin;
import net.momirealms.customnameplates.api.manager.WidthManager; import net.momirealms.customnameplates.api.manager.WidthManager;
import net.momirealms.customnameplates.api.mechanic.background.BackGround; import net.momirealms.customnameplates.api.mechanic.background.BackGround;
@@ -907,7 +908,6 @@ public class WidthManagerImpl implements WidthManager {
ElementNode node = (ElementNode) MiniMessage.miniMessage().deserializeToTree(text); ElementNode node = (ElementNode) MiniMessage.miniMessage().deserializeToTree(text);
ArrayList<Tuple<String, Key, Boolean>> list = new ArrayList<>(); ArrayList<Tuple<String, Key, Boolean>> list = new ArrayList<>();
nodeToStringInfo(node, list, Key.of("minecraft", "default"), false); nodeToStringInfo(node, list, Key.of("minecraft", "default"), false);
int totalLength = 0; int totalLength = 0;
for (Tuple<String, Key, Boolean> element : list) { for (Tuple<String, Key, Boolean> element : list) {
FontData data = getFontData(element.getMid()); FontData data = getFontData(element.getMid());
@@ -936,7 +936,11 @@ public class WidthManagerImpl implements WidthManager {
} else if (node instanceof TagNode tagNode) { } else if (node instanceof TagNode tagNode) {
if (tagNode.tag() instanceof Inserting inserting) { if (tagNode.tag() instanceof Inserting inserting) {
Component component = inserting.value(); Component component = inserting.value();
isBold = component.hasDecoration(TextDecoration.BOLD); if (component.decoration(TextDecoration.BOLD) == TextDecoration.State.TRUE) {
isBold = true;
} else if (component.decoration(TextDecoration.BOLD) == TextDecoration.State.FALSE) {
isBold = false;
}
var key = component.font(); var key = component.font();
if (key != null) { if (key != null) {
font = net.momirealms.customnameplates.common.Key.of(key.namespace(), key.value()); font = net.momirealms.customnameplates.common.Key.of(key.namespace(), key.value());

View File

@@ -378,7 +378,8 @@ public class RequirementManagerImpl implements RequirementManager {
return condition -> { return condition -> {
String currentWeather; String currentWeather;
World world = Objects.requireNonNull(condition.getOfflinePlayer().getPlayer()).getWorld(); World world = Objects.requireNonNull(condition.getOfflinePlayer().getPlayer()).getWorld();
if (world.isThundering()) currentWeather = "thunder"; if (world.hasStorm()) currentWeather = "rainstorm";
else if (world.isThundering()) currentWeather = "thunder";
else if (world.isClearWeather()) currentWeather = "clear"; else if (world.isClearWeather()) currentWeather = "clear";
else currentWeather = "rain"; else currentWeather = "rain";
for (String weather : weathers) for (String weather : weathers)

View File

@@ -36,3 +36,13 @@ customcrops:default:
: 6 : 6
: 6 : 6
: 4 : 4
minecraft:customcrops:
default: 8
template-loading-sequence: []
values:
: -2
: 4
: 6
: 6
: 4