Files
Purpur/patches/server/0005-Purpur-client-support.patch
granny 08aa4dccaa Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@afa16e6 Modify offline mode warning to include Velocity line (#8812)
PaperMC/Paper@de38a45 Add projectile hit simulation API (#8816)
PaperMC/Paper@7e7e6b4 More Win Screen API (#8805)
PaperMC/Paper@bd77b78 Fix desync of honeycomb when the event is canceled (#8713)
PaperMC/Paper@bb05fcf Add missing isFuel Material entries (#8843)
PaperMC/Paper@8d1acf6 Call PlayerReadyArrowEvent for when items in the offhand are used (#8842)
PaperMC/Paper@f2f9e8c Remove patch that was made obsolete by vanilla (#8847)
2023-02-13 15:48:05 -08:00

61 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 30 Jul 2021 14:31:25 -0500
Subject: [PATCH] Purpur client support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9160725f031c9698a00229c3dfa19d39b4a826c1..74d332479556ec01cc3fb8d13fe82a77e2fbf3e9 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -268,6 +268,7 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
+ public boolean purpurClient = false; // Purpur
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d04a30ee940a785b848240ae6b1aa9705deb7902..9c5f191205b5f413890e78e316a08e6f5542bdc1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3511,6 +3511,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
+ private static final ResourceLocation PURPUR_CLIENT = new ResourceLocation("purpur", "client"); // Purpur
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@@ -3535,6 +3536,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
+ // Purpur start
+ } else if (packet.identifier.equals(PURPUR_CLIENT)) {
+ try {
+ player.purpurClient = true;
+ } catch (Exception ignore) {
+ }
+ // Purpur end
} else {
try {
byte[] data = new byte[packet.data.readableBytes()];
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 03430916a8107c1b0f04d84e1dce494e2da06e7a..b3135e6d66fe8f176a98adb8230e788c4c0d662e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3058,4 +3058,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.spigot;
}
// Spigot end
+
+ // Purpur start
+ @Override
+ public boolean usesPurpurClient() {
+ return getHandle().purpurClient;
+ }
+ // Purpur end
}