From 01445b4c92eef7bd2c32f65189eed2f00d4b4767 Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 24 Dec 2020 21:59:23 +0800 Subject: keep up with main stream (1.1.3-beta) --- src/main/java/com/keuin/blame/data/entry/LogEntry.java | 2 +- src/main/java/com/keuin/blame/util/MinecraftUtil.java | 5 ++++- src/main/java/com/keuin/blame/util/PrintUtil.java | 18 ++++++++---------- src/main/resources/fabric.mod.json | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/keuin/blame/data/entry/LogEntry.java b/src/main/java/com/keuin/blame/data/entry/LogEntry.java index 090d77c..e47cc92 100644 --- a/src/main/java/com/keuin/blame/data/entry/LogEntry.java +++ b/src/main/java/com/keuin/blame/data/entry/LogEntry.java @@ -44,7 +44,7 @@ public class LogEntry { public int version = 1; @BsonProperty(GAME_VERSION) - public String gameVersion = MinecraftVersion.field_25319.getName(); + public String gameVersion = (new MinecraftVersion()).getName(); @BsonProperty(TIMESTAMP_MILLIS) public long timeMillis = 0; diff --git a/src/main/java/com/keuin/blame/util/MinecraftUtil.java b/src/main/java/com/keuin/blame/util/MinecraftUtil.java index ce8707e..4cb7e2b 100644 --- a/src/main/java/com/keuin/blame/util/MinecraftUtil.java +++ b/src/main/java/com/keuin/blame/util/MinecraftUtil.java @@ -1,11 +1,14 @@ package com.keuin.blame.util; import net.minecraft.world.World; +import net.minecraft.world.dimension.DimensionType; + +import java.util.Objects; public class MinecraftUtil { public static String worldToString(World world) { - return world.getRegistryKey().getValue().toString(); + return Objects.requireNonNull(DimensionType.getId(world.dimension.getType())).toString(); } } diff --git a/src/main/java/com/keuin/blame/util/PrintUtil.java b/src/main/java/com/keuin/blame/util/PrintUtil.java index 75b73d4..07985f9 100644 --- a/src/main/java/com/keuin/blame/util/PrintUtil.java +++ b/src/main/java/com/keuin/blame/util/PrintUtil.java @@ -2,7 +2,6 @@ package com.keuin.blame.util; import com.mojang.brigadier.context.CommandContext; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.minecraft.network.MessageType; import net.minecraft.server.MinecraftServer; import net.minecraft.server.PlayerManager; import net.minecraft.server.command.ServerCommandSource; @@ -12,19 +11,19 @@ import net.minecraft.util.Formatting; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import static com.keuin.blame.util.UuidUtils.UUID_NULL; - public final class PrintUtil implements ServerLifecycleEvents.ServerStarted { + // version: 1.2 (for 1.15.2) + private static final Object syncMessage = new Object(); private static final Object syncBroadcast = new Object(); - private static final Style broadcastStyle = Style.EMPTY.withColor(Formatting.AQUA); - private static final Style infoStyle = Style.EMPTY.withColor(Formatting.WHITE); - private static final Style stressStyle = Style.EMPTY.withColor(Formatting.AQUA); - private static final Style warnStyle = Style.EMPTY.withColor(Formatting.YELLOW); - private static final Style errorStyle = Style.EMPTY.withColor(Formatting.DARK_RED); + private static final Style broadcastStyle = new Style().setColor(Formatting.AQUA); + private static final Style infoStyle = new Style().setColor(Formatting.WHITE); + private static final Style stressStyle = new Style().setColor(Formatting.AQUA); + private static final Style warnStyle = new Style().setColor(Formatting.YELLOW); + private static final Style errorStyle = new Style().setColor(Formatting.DARK_RED); private static final Logger LOGGER = LogManager.getLogger(); private static final String LOG_HEADING = "[Blame]"; @@ -52,8 +51,7 @@ public final class PrintUtil implements ServerLifecycleEvents.ServerStarted { if (playerManager != null) playerManager.broadcastChatMessage( new LiteralText(message).setStyle(broadcastStyle), - MessageType.SYSTEM, - UUID_NULL + false ); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f4d8e92..aa17a7b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -25,7 +25,7 @@ "depends": { "fabricloader": ">=0.7.4", "fabric": "*", - "minecraft": "1.16.x" + "minecraft": "1.15.x" }, "suggests": { "another-mod": "*" -- cgit v1.2.3