mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-21 16:09:19 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@1c3c47a Correctly check enchants for ItemStack#damage (#11240) PaperMC/Paper@1187544 Fix teleport event getTo returning null (#11239) PaperMC/Paper@dd941cc Re-add patches for can-place/can-destroy API (#11238) PaperMC/Paper@ab0d24a Configuration for horizontal-only item merging (#11219) PaperMC/Paper@098bd39 Remove arbitrary book page limit (#11228) PaperMC/Paper@f97aff7 [ci skip] Fix Effect javadocs (#11182) PaperMC/Paper@4a97ba3 Fix `setSendViewDistance`'s return (#11247) PaperMC/Paper@1798e94 Fix BasicCommand suggestion arg count (#11241) PaperMC/Paper@7c9240f Improve standard messenger logging PaperMC/Paper@9ab644e Fix `TooltipContext.create` being wrong(#11254) PaperMC/Paper@11b4ac7 Fix disableEndCredits world config (#11261) PaperMC/Paper@bf5852a Fix NPE for PlayerPostRespawnEvent#getRespawnedLocation (#11268) PaperMC/Paper@fb53074 Apply optimise collision checking in move packet handling patch PaperMC/Paper@81bfda8 [ci skip] Specify rebase location in CONTRIBUTING (#11255) PaperMC/Paper@9571983 Fix scanForLegacyEnderDragon world config (#11262) PaperMC/Paper@ec55c11 Fix indestructable light blocks (#11275) PaperMC/Paper@1b8ab11 Add Configuration for vertical Despawn Ranges (#10440) PaperMC/Paper@534ab86 [ci-skip] Revert "Add Configuration for vertical Despawn Ranges (#10440)" (#11278) PaperMC/Paper@e619744 Allow skipping of world symlink validation (#11250) PaperMC/Paper@78216fe Re-implement portalCreateRadius world config (#11267) PaperMC/Paper@4829fbf Handle custom registry elements properly (#11230) PaperMC/Paper@d5ffc57 Implement more methods for horse inventories (#11147) PaperMC/Paper@52ae4ad Migrate ArmorStand meta to using entity tag (#11107) PaperMC/Paper@75655ec Add Configuration for vertical Despawn Ranges (#11279) PaperMC/Paper@0e73617 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11284) PaperMC/Paper@66a97cc Update item data sanitization (#11227) PaperMC/Paper@2e82fd2 Add even more Enchantment API (#11115) PaperMC/Paper@57dd822 Leashable API (#10961) PaperMC/Paper@8c3018a Fix Selector Arguments not working with permission (#11286) PaperMC/Paper@4401748 Fix CraftBukkit drag system (#10703) PaperMC/Paper@64c9ee6 Allow getting/setting the sign's editor uuid (#10637) Gale Changes: Dreeam-qwq/Gale@dc228bb Updated Upstream (Paper) Dreeam-qwq/Gale@ecbaa9c Updated Upstream (Paper) Dreeam-qwq/Gale@7e2df5b Updated Upstream (Paper) Dreeam-qwq/Gale@ea59414 Updated Upstream (Paper) Dreeam-qwq/Gale@e373e97 Updated Upstream (Paper) Purpur Changes: PurpurMC/Purpur@366af80 Updated Upstream (Paper) PurpurMC/Purpur@07979c3 Updated Upstream (Paper) PurpurMC/Purpur@3f790ac Updated Upstream (Paper) PurpurMC/Purpur@201e928 Updated Upstream (Pufferfish) (#1575) PurpurMC/Purpur@f2307b8 Updated Upstream (Paper) PurpurMC/Purpur@bba87bf Updated Upstream (Paper) PurpurMC/Purpur@f530395 Fix no exp drops from spawners using silk touch pickaxe without option enabled (#1582)
98 lines
4.9 KiB
Diff
98 lines
4.9 KiB
Diff
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] Leaves: Xaero Map Protocol
|
|
|
|
Original license: GPLv3
|
|
Original project: https://github.com/LeavesMC/Leaves
|
|
|
|
This patch is Powered by Xaero Map
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 8e8346394ba5c48c551050725decbb7f6a91098a..42fa51a01c33d525d6858d53811b204280d362e6 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -1332,6 +1332,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()));
|
|
+ org.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/org/dreeam/leaf/config/modules/network/ProtocolSupport.java b/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java
|
|
index ec6fd416786e4a38ed797819138fbdc83348541d..c159340c3d7d90601bb69a4e1b997e372d48841a 100644
|
|
--- a/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java
|
|
+++ b/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java
|
|
@@ -3,6 +3,8 @@ package org.dreeam.leaf.config.modules.network;
|
|
import org.dreeam.leaf.config.ConfigModules;
|
|
import org.dreeam.leaf.config.EnumConfigCategory;
|
|
|
|
+import java.util.Random;
|
|
+
|
|
public class ProtocolSupport extends ConfigModules {
|
|
|
|
public String getBasePath() {
|
|
@@ -11,10 +13,14 @@ public class ProtocolSupport extends ConfigModules {
|
|
|
|
public static boolean jadeProtocol = false;
|
|
public static boolean appleskinProtocol = false;
|
|
+ public static boolean xaeroMapProtocol = false;
|
|
+ public static int xaeroMapServerID = new Random().nextInt();
|
|
|
|
@Override
|
|
public void onLoaded() {
|
|
jadeProtocol = config.getBoolean(getBasePath() + ".jade-protocol", jadeProtocol);
|
|
appleskinProtocol = config.getBoolean(getBasePath() + ".appleskin-protocol", appleskinProtocol);
|
|
+ xaeroMapProtocol = config.getBoolean(getBasePath() + ".xaero-map-protocol", xaeroMapProtocol);
|
|
+ xaeroMapServerID = config.getInt(getBasePath() + ".xaero-map-server-id", xaeroMapServerID);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..9e35dfaf8bb5511b4cd0a71175d7ecb6d835042f
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
|
@@ -0,0 +1,41 @@
|
|
+package org.leavesmc.leaves.protocol;
|
|
+
|
|
+import net.minecraft.resources.ResourceLocation;
|
|
+import net.minecraft.server.level.ServerPlayer;
|
|
+import org.jetbrains.annotations.Contract;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.leavesmc.leaves.protocol.core.LeavesProtocol;
|
|
+import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
|
+
|
|
+@LeavesProtocol(namespace = {"xaerominimap", "xaeroworldmap"})
|
|
+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 (org.dreeam.leaf.config.modules.network.ProtocolSupport.xaeroMapProtocol) {
|
|
+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf -> {
|
|
+ buf.writeByte(0);
|
|
+ buf.writeInt(org.dreeam.leaf.config.modules.network.ProtocolSupport.xaeroMapServerID);
|
|
+ });
|
|
+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf -> {
|
|
+ buf.writeByte(0);
|
|
+ buf.writeInt(org.dreeam.leaf.config.modules.network.ProtocolSupport.xaeroMapServerID);
|
|
+ });
|
|
+ }
|
|
+ }
|
|
+}
|