mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-24 01:19:19 +00:00
Xaero Map Protocol (#13)
This commit is contained in:
@@ -133,11 +133,11 @@ index 7647b8bb3117d005dd616b29e7310f8328973b7f..eaeac639924098b86da57e2a87efc2af
|
||||
@Nullable
|
||||
private DamageSource lastDamageSource;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index fdca60bb67c1ab574b3623ea83872608ade6951f..17ffd0ae638f44b1bcf945640e430e9b753ba3f9 100644
|
||||
index fdca60bb67c1ab574b3623ea83872608ade6951f..0fe63c9af69ed86561d22eac293a62fbb6f34e43 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -466,6 +466,11 @@ public final class LeavesConfig {
|
||||
doMcTechnicalMode(mcTechnicalMode);
|
||||
@@ -476,6 +476,11 @@ public final class LeavesConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean netherPortalFix = false;
|
||||
@@ -145,9 +145,9 @@ index fdca60bb67c1ab574b3623ea83872608ade6951f..17ffd0ae638f44b1bcf945640e430e9b
|
||||
+ netherPortalFix = getBoolean("settings.modify.return-nether-portal-fix", netherPortalFix);
|
||||
+ }
|
||||
+
|
||||
private static void doMcTechnicalMode(boolean is) {
|
||||
if (is) {
|
||||
GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication = true;
|
||||
public static final class WorldConfig {
|
||||
|
||||
public final String worldName;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/util/ReturnPortalManager.java b/src/main/java/top/leavesmc/leaves/util/ReturnPortalManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0452ad7adb8d2a52f7bfe239765dfbca6ba2523
|
||||
|
||||
@@ -55,11 +55,11 @@ index b69f915226dd9cda4b5f24e307d89c19e739ab8b..1febe4e731356f9470020048bf78b1eb
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 17ffd0ae638f44b1bcf945640e430e9b753ba3f9..b3d94da02fb25863c37a385d25bb7acced0a7837 100644
|
||||
index 0fe63c9af69ed86561d22eac293a62fbb6f34e43..25b19e288eb7d2dcf00bbfed98c69591901ec9cf 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -481,6 +481,11 @@ public final class LeavesConfig {
|
||||
}
|
||||
netherPortalFix = getBoolean("settings.modify.return-nether-portal-fix", netherPortalFix);
|
||||
}
|
||||
|
||||
+ public static boolean appleskinProtocol = false;
|
||||
|
||||
89
patches/server/0059-Xaero-Map-Protocol.patch
Normal file
89
patches/server/0059-Xaero-Map-Protocol.patch
Normal file
@@ -0,0 +1,89 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Fri, 27 Jan 2023 09:42:57 +0800
|
||||
Subject: [PATCH] Xaero Map Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 67c6d95e81f0df600916d797af4af552d6e77604..290807a539909f95e7a75b8ec7e21316eb3ecd57 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1264,6 +1264,7 @@ public abstract class PlayerList {
|
||||
player.connection.send(new ClientboundInitializeBorderPacket(worldborder));
|
||||
player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
|
||||
player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle()));
|
||||
+ top.leavesmc.leaves.protocol.XaeroMapProtocol.onSendWorldInfo(player); // Leaves - xaero map protocol
|
||||
if (world.isRaining()) {
|
||||
// CraftBukkit start - handle player weather
|
||||
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
index 25b19e288eb7d2dcf00bbfed98c69591901ec9cf..9ca49bbe0dd3e537616ff1309012cc2fee4858f5 100644
|
||||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
||||
@@ -20,6 +20,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
+import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
|
||||
// Powered by Tuinity(https://github.com/Tuinity/Tuinity)
|
||||
@@ -486,6 +487,13 @@ public final class LeavesConfig {
|
||||
appleskinProtocol = getBoolean("settings.protocol.appleskin-protocol", appleskinProtocol);
|
||||
}
|
||||
|
||||
+ public static boolean xaeroMapProtocol = false;
|
||||
+ public static int xaeroMapServerID = new Random().nextInt();
|
||||
+ private static void xaeroMapProtocol() {
|
||||
+ xaeroMapProtocol = getBoolean("settings.protocol.xaero-map-protocol", xaeroMapProtocol);
|
||||
+ xaeroMapServerID = getInt("settings.protocol.xaero-map-server-id", xaeroMapServerID);
|
||||
+ }
|
||||
+
|
||||
public static final class WorldConfig {
|
||||
|
||||
public final String worldName;
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java b/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..01c370ec64835fdd038256560f89ed251b3d3d6d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
||||
@@ -0,0 +1,39 @@
|
||||
+package top.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import io.netty.buffer.Unpooled;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import top.leavesmc.leaves.LeavesConfig;
|
||||
+import top.leavesmc.leaves.util.ProtocolUtils;
|
||||
+
|
||||
+public class XaeroMapProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID_MINI = "xaerominimap";
|
||||
+ public static final String PROTOCOL_ID_WORLD = "xaeroworldmap";
|
||||
+
|
||||
+ private static final ResourceLocation MINIMAP_KEY = idMini("main");
|
||||
+ private static final ResourceLocation WORLDMAP_KEY = idWorld("main");
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation idMini(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID_MINI, path);
|
||||
+ }
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation idWorld(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID_WORLD, path);
|
||||
+ }
|
||||
+
|
||||
+ public static void onSendWorldInfo(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.xaeroMapProtocol) {
|
||||
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
+ buf.writeByte(0);
|
||||
+ buf.writeInt(LeavesConfig.xaeroMapServerID);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user