mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Updated Upstream (Leaves)
Upstream has released updates that appear to apply and compile correctly Leaves Changes: LeavesMC/Leaves@88819fe8 Add mc-old hopper suck-in behavior (#395) LeavesMC/Leaves@7394e8dd Fix papermc repo LeavesMC/Leaves@85c7bf11 Remove cache-world-generator-sea-level (#392) LeavesMC/Leaves@00798036 init 1.21.4, and boom! LeavesMC/Leaves@91fc24da build change, but weight not work LeavesMC/Leaves@4ccdf459 just work LeavesMC/Leaves@05ee2e36 Build changes, and delete timings LeavesMC/Leaves@fcc859dc Fix API patches (#406) LeavesMC/Leaves@6a1259df 0006/0129 LeavesMC/Leaves@3e3b05df 0009/0129 LeavesMC/Leaves@c3255c4f 0011/0129 LeavesMC/Leaves@6284c7b6 0018/0129 LeavesMC/Leaves@7abdc88c 0030/0129 LeavesMC/Leaves@4d119ff9 0035/0129 LeavesMC/Leaves@60baed99 0043/0129 LeavesMC/Leaves@dc319d5b 0048/0129 LeavesMC/Leaves@73a505d5 0049/0129 LeavesMC/Leaves@016b29dd 0057/0129 LeavesMC/Leaves@c9cf5af8 0065/0129 LeavesMC/Leaves@330b79ff 0086/0129 (#408) LeavesMC/Leaves@06c1d946 0087/0129 LeavesMC/Leaves@bf4bc284 0091/0129 LeavesMC/Leaves@102a3b70 0097/0129 LeavesMC/Leaves@53b43fed 0101/0129 LeavesMC/Leaves@892f3925 102/129 LeavesMC/Leaves@08c3043a 0107/0129 LeavesMC/Leaves@48764d8e 0112/0129 LeavesMC/Leaves@8380feff 0118/0129 LeavesMC/Leaves@e51603db 0129/0129, 100% patched LeavesMC/Leaves@ef851152 fix some LeavesMC/Leaves@9b7c6e88 server work LeavesMC/Leaves@272b7dcb Protocol... (#409) LeavesMC/Leaves@7be1bc97 Make jade better LeavesMC/Leaves@5350f6ea Make action work LeavesMC/Leaves@f07c26c8 fix action jar
This commit is contained in:
@@ -11,18 +11,10 @@ Original project: https://github.com/LeavesMC/Leaves
|
||||
This patch is Powered by ReplayMod(https://github.com/ReplayMod)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index d67af3fdc4434817cea29673069430a33fb30a8e..1e32c10f3e7687cbd55985a2e03f0ab6c5f93b31 100644
|
||||
index d67af3fdc4434817cea29673069430a33fb30a8e..c8699e7b186caf0735a888f78ed4b777e1c119fe 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -3047,6 +3047,7 @@ public final class Bukkit {
|
||||
return server.spigot();
|
||||
}
|
||||
|
||||
+
|
||||
// Purpur start - Bring back server name
|
||||
/**
|
||||
* Get the name of this server
|
||||
@@ -3175,4 +3176,10 @@ public final class Bukkit {
|
||||
@@ -3175,4 +3175,10 @@ public final class Bukkit {
|
||||
server.clearBlockHighlights();
|
||||
}
|
||||
// Purpur end - Debug Marker API
|
||||
@@ -34,24 +26,16 @@ index d67af3fdc4434817cea29673069430a33fb30a8e..1e32c10f3e7687cbd55985a2e03f0ab6
|
||||
+ // Leaves end - Photographer API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 6790ca1648a17cf30063522f68b3ac3e82e3bd8c..223f3a4545996073872d1650c9a84feacfd2c493 100644
|
||||
index 6790ca1648a17cf30063522f68b3ac3e82e3bd8c..91c6808a6500c3f2e43818a7a30ab5d83d89f539 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -66,6 +66,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
+import org.leavesmc.leaves.entity.PhotographerManager;
|
||||
|
||||
/**
|
||||
* Represents a server implementation.
|
||||
@@ -2858,4 +2859,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2858,4 +2858,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
void clearBlockHighlights();
|
||||
// Purpur end - Debug Marker API
|
||||
+
|
||||
+ // Leaves start - Photographer API
|
||||
+ @NotNull PhotographerManager getPhotographerManager();
|
||||
+ @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager();
|
||||
+ // Leaves end - Photographer API
|
||||
}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/entity/Photographer.java b/src/main/java/org/leavesmc/leaves/entity/Photographer.java
|
||||
|
||||
@@ -3,6 +3,9 @@ From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 28 Sep 2023 20:30:46 +0800
|
||||
Subject: [PATCH] Leaves: Disable moved wrongly threshold
|
||||
|
||||
Removed since MC 1.21.4, Mojang added it as gamerule,
|
||||
use `/gamerule disablePlayerMovementCheck` instead
|
||||
|
||||
Original license: GPLv3
|
||||
Original project: https://github.com/LeavesMC/Leaves
|
||||
|
||||
@@ -9,10 +9,10 @@ and change store way to sql maybe?
|
||||
Original license: GPLv3
|
||||
Original project: https://github.com/LeavesMC/Leaves
|
||||
|
||||
Commit: 0O0oO00o0oO
|
||||
Commit: f07c26c892bc919de82ee0c90ccd5bdca41f20ed
|
||||
|
||||
diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
|
||||
index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..96ec0a0133ec244a5eb79dfcb34e7f9de22ea0f4 100644
|
||||
index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..7e19dfe90a63ff26f03b95891dacb7360bba5a3c 100644
|
||||
--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
|
||||
+++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
|
||||
@@ -40,13 +40,23 @@ public interface CustomPacketPayload {
|
||||
@@ -20,9 +20,9 @@ index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..96ec0a0133ec244a5eb79dfcb34e7f9d
|
||||
@Override
|
||||
public void encode(B buffer, CustomPacketPayload value) {
|
||||
+ // Leaves start - protocol core
|
||||
+ if (value instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload<?> leavesCustomPayload) {
|
||||
+ buffer.writeResourceLocation(leavesCustomPayload.id());
|
||||
+ leavesCustomPayload.write(buffer);
|
||||
+ if (value instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload<?> payload) {
|
||||
+ buffer.writeResourceLocation(payload.id());
|
||||
+ payload.write(buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - protocol core
|
||||
@@ -34,25 +34,12 @@ index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..96ec0a0133ec244a5eb79dfcb34e7f9d
|
||||
ResourceLocation resourceLocation = buffer.readResourceLocation();
|
||||
- return (CustomPacketPayload)this.findCodec(resourceLocation).decode(buffer);
|
||||
+ // Leaves start - protocol core
|
||||
+ var leavesCustomPayload = org.leavesmc.leaves.protocol.core.LeavesProtocolManager.decode(resourceLocation, buffer);
|
||||
+ return java.util.Objects.requireNonNullElseGet(leavesCustomPayload, () -> this.findCodec(resourceLocation).decode(buffer));
|
||||
+ var payload = org.leavesmc.leaves.protocol.core.LeavesProtocolManager.decode(resourceLocation, buffer);
|
||||
+ return java.util.Objects.requireNonNullElseGet(payload, () -> this.findCodec(resourceLocation).decode(buffer));
|
||||
+ // Leaves end - protocol core
|
||||
}
|
||||
};
|
||||
}
|
||||
diff --git a/net/minecraft/resources/ResourceLocation.java b/net/minecraft/resources/ResourceLocation.java
|
||||
index ea8cfa76093c70a44d065c1f80adaa9127fe4e07..7435e2c3f0defe98cbaa488219974887ee572c57 100644
|
||||
--- a/net/minecraft/resources/ResourceLocation.java
|
||||
+++ b/net/minecraft/resources/ResourceLocation.java
|
||||
@@ -36,7 +36,7 @@ public final class ResourceLocation implements Comparable<ResourceLocation> {
|
||||
private final String namespace;
|
||||
private final String path;
|
||||
|
||||
- private ResourceLocation(String namespace, String path) {
|
||||
+ public ResourceLocation(String namespace, String path) { // Leaves - private -> public
|
||||
assert isValidNamespace(namespace);
|
||||
|
||||
assert isValidPath(path);
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 047a09cf4a2c32e714aacedeccb0928ef2c7dfa9..dddbb18992348fb7e8a6552423d134809cd7fdbc 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
@@ -91,7 +78,7 @@ index de115ee71fa240440b54c553e0d3ddaf4c0dfca0..ee8cdd532b73180cb484fcc37c36f09c
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn't register custom payload", ex);
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index d2c11832d3ff9b01ccc3cdd5f77673eb7a844dae..0e81a445a4f960eab5c873bc16f79a9ebfab0122 100644
|
||||
index ef189bdd6c52c3f062774a6e9ae73a186d1d8346..924faf76763588fb41b8aee53236ccb05b1239b1 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -341,6 +341,8 @@ public abstract class PlayerList {
|
||||
|
||||
@@ -11,51 +11,20 @@ Original project: https://github.com/LeavesMC/Leaves
|
||||
This patch is Powered by ReplayMod(https://github.com/ReplayMod)
|
||||
|
||||
diff --git a/net/minecraft/commands/CommandSourceStack.java b/net/minecraft/commands/CommandSourceStack.java
|
||||
index 59c70c567051bc7dba0d308387352d1b15f3c842..6c13bf624bbb1af62f879ea08b72346a9932d75e 100644
|
||||
index 59c70c567051bc7dba0d308387352d1b15f3c842..e654387167cf3e9a88f0e62be940fe398387cffa 100644
|
||||
--- a/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -629,6 +629,13 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
|
||||
return this.entity instanceof ServerPlayer sourcePlayer && !sourcePlayer.getBukkitEntity().hasPermission("paper.bypass-visibility.tab-completion") ? this.getServer().getPlayerList().getPlayers().stream().filter(serverPlayer -> sourcePlayer.getBukkitEntity().canSee(serverPlayer.getBukkitEntity())).map(serverPlayer -> serverPlayer.getGameProfile().getName()).toList() : Lists.newArrayList(this.server.getPlayerNames()); // Paper - Make CommandSourceStack respect hidden players
|
||||
}
|
||||
@@ -626,7 +626,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
|
||||
|
||||
+ // Leaves start - skip photographer
|
||||
+ @Override
|
||||
+ public Collection<String> getOnlineRealPlayerNames() {
|
||||
+ return this.entity instanceof ServerPlayer sourcePlayer && !sourcePlayer.getBukkitEntity().hasPermission("paper.bypass-visibility.tab-completion") ? this.getServer().getPlayerList().getPlayers().stream().filter(serverPlayer -> !(serverPlayer instanceof org.leavesmc.leaves.replay.ServerPhotographer) && sourcePlayer.getBukkitEntity().canSee(serverPlayer.getBukkitEntity())).map(serverPlayer -> serverPlayer.getGameProfile().getName()).toList() : Lists.newArrayList(this.server.getPlayerNames()); // Paper - Make CommandSourceStack respect hidden players
|
||||
+ }
|
||||
+ // Leaves end - skip photographer
|
||||
+
|
||||
@Override
|
||||
public Collection<String> getAllTeams() {
|
||||
return this.server.getScoreboard().getTeamNames();
|
||||
diff --git a/net/minecraft/commands/SharedSuggestionProvider.java b/net/minecraft/commands/SharedSuggestionProvider.java
|
||||
index a2f13a86c635acef24ded974c96a400e1439011d..78e7948dfc99dda55455e964c3356b6c5002869c 100644
|
||||
--- a/net/minecraft/commands/SharedSuggestionProvider.java
|
||||
+++ b/net/minecraft/commands/SharedSuggestionProvider.java
|
||||
@@ -29,6 +29,8 @@ public interface SharedSuggestionProvider {
|
||||
|
||||
Collection<String> getOnlinePlayerNames();
|
||||
|
||||
+ Collection<String> getOnlineRealPlayerNames(); // Leaves - skip photographer
|
||||
+
|
||||
default Collection<String> getCustomTabSugggestions() {
|
||||
return this.getOnlinePlayerNames();
|
||||
public Collection<String> getOnlinePlayerNames() {
|
||||
- return this.entity instanceof ServerPlayer sourcePlayer && !sourcePlayer.getBukkitEntity().hasPermission("paper.bypass-visibility.tab-completion") ? this.getServer().getPlayerList().getPlayers().stream().filter(serverPlayer -> sourcePlayer.getBukkitEntity().canSee(serverPlayer.getBukkitEntity())).map(serverPlayer -> serverPlayer.getGameProfile().getName()).toList() : Lists.newArrayList(this.server.getPlayerNames()); // Paper - Make CommandSourceStack respect hidden players
|
||||
+ return this.entity instanceof ServerPlayer sourcePlayer && !(sourcePlayer instanceof org.leavesmc.leaves.replay.ServerPhotographer) && !sourcePlayer.getBukkitEntity().hasPermission("paper.bypass-visibility.tab-completion") ? this.getServer().getPlayerList().getPlayers().stream().filter(serverPlayer -> sourcePlayer.getBukkitEntity().canSee(serverPlayer.getBukkitEntity())).map(serverPlayer -> serverPlayer.getGameProfile().getName()).toList() : Lists.newArrayList(this.server.getPlayerNames()); // Paper - Make CommandSourceStack respect hidden players // Leaves - only real player
|
||||
}
|
||||
diff --git a/net/minecraft/commands/arguments/EntityArgument.java b/net/minecraft/commands/arguments/EntityArgument.java
|
||||
index 0a01df6ebd14afe79bc76364cb1df5e0c5c08074..7eea7e3345b889b885e9a118bb23fa08bc237150 100644
|
||||
--- a/net/minecraft/commands/arguments/EntityArgument.java
|
||||
+++ b/net/minecraft/commands/arguments/EntityArgument.java
|
||||
@@ -149,7 +149,7 @@ public class EntityArgument implements ArgumentType<EntitySelector> {
|
||||
return entitySelectorParser.fillSuggestions(
|
||||
builder,
|
||||
offsetBuilder -> {
|
||||
- Collection<String> onlinePlayerNames = sharedSuggestionProvider.getOnlinePlayerNames();
|
||||
+ Collection<String> onlinePlayerNames = sharedSuggestionProvider.getOnlineRealPlayerNames(); // Leaves - skip photographer
|
||||
Iterable<String> iterable = (Iterable<String>)(this.playersOnly
|
||||
? onlinePlayerNames
|
||||
: Iterables.concat(onlinePlayerNames, sharedSuggestionProvider.getSelectedEntities()));
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/commands/arguments/selector/EntitySelector.java b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..b8215b71971d16705bc11f19343823acf9970a3a 100644
|
||||
index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..c9b4f00d5ccde83898ecf69efdbfee7a3f91b96d 100644
|
||||
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
@@ -128,11 +128,12 @@ public class EntitySelector {
|
||||
@@ -89,7 +58,7 @@ index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..b8215b71971d16705bc11f19343823ac
|
||||
|
||||
return this.sortAndLimit(vec3, list);
|
||||
}
|
||||
@@ -192,27 +194,29 @@ public class EntitySelector {
|
||||
@@ -192,27 +194,30 @@ public class EntitySelector {
|
||||
this.checkPermissions(source);
|
||||
if (this.playerName != null) {
|
||||
ServerPlayer playerByName = source.getServer().getPlayerList().getPlayerByName(this.playerName);
|
||||
@@ -104,8 +73,8 @@ index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..b8215b71971d16705bc11f19343823ac
|
||||
AABB absoluteAabb = this.getAbsoluteAabb(vec3);
|
||||
Predicate<Entity> predicate = this.getPredicate(vec3, absoluteAabb, null);
|
||||
if (this.currentEntity) {
|
||||
- return source.getEntity() instanceof ServerPlayer serverPlayer && predicate.test(serverPlayer) && canSee(source, serverPlayer) ? List.of(serverPlayer) : List.of(); // Purpur - Hide hidden players from entity selector
|
||||
+ return source.getEntity() instanceof ServerPlayer serverPlayer && predicate.test(serverPlayer) && !(serverPlayer instanceof org.leavesmc.leaves.replay.ServerPhotographer) && canSee(source, serverPlayer) ? List.of(serverPlayer) : List.of(); // Purpur - Hide hidden players from entity selector // Leaves - skip photographer
|
||||
+ //return source.getEntity() instanceof ServerPlayer serverPlayer && predicate.test(serverPlayer) && !(serverPlayer instanceof org.leavesmc.leaves.replay.ServerPhotographer) && canSee(source, serverPlayer) ? List.of(serverPlayer) : List.of(); // Purpur - Hide hidden players from entity selector // Leaves - skip photographer
|
||||
return source.getEntity() instanceof ServerPlayer serverPlayer && predicate.test(serverPlayer) && canSee(source, serverPlayer) ? List.of(serverPlayer) : List.of(); // Purpur - Hide hidden players from entity selector
|
||||
} else {
|
||||
int resultLimit = this.getResultLimit();
|
||||
List<ServerPlayer> players;
|
||||
@@ -152,7 +121,7 @@ index 792ba93b531e9586e26aafa00830022a8996fc04..e4ea26ae84efde7ce54e08a246a6ea2a
|
||||
AdvancementProgress orStartProgress = this.getOrStartProgress(advancement);
|
||||
boolean isDone = orStartProgress.isDone();
|
||||
diff --git a/net/minecraft/server/commands/OpCommand.java b/net/minecraft/server/commands/OpCommand.java
|
||||
index 5c0a04db38821dbb0cba2bb6f0787f113d167efd..8a071166262fbb7d24735fec394cb19d4dd98096 100644
|
||||
index 5c0a04db38821dbb0cba2bb6f0787f113d167efd..cd153db93f709c3142942fac88ae3ca2226a65b3 100644
|
||||
--- a/net/minecraft/server/commands/OpCommand.java
|
||||
+++ b/net/minecraft/server/commands/OpCommand.java
|
||||
@@ -25,7 +25,7 @@ public class OpCommand {
|
||||
@@ -160,7 +129,7 @@ index 5c0a04db38821dbb0cba2bb6f0787f113d167efd..8a071166262fbb7d24735fec394cb19d
|
||||
PlayerList playerList = context.getSource().getServer().getPlayerList();
|
||||
return SharedSuggestionProvider.suggest(
|
||||
- playerList.getPlayers()
|
||||
+ playerList.realPlayers // Leaves - skip
|
||||
+ playerList.realPlayers // Leaves - only real player
|
||||
.stream()
|
||||
.filter(player -> !playerList.isOp(player.getGameProfile()))
|
||||
.map(player -> player.getGameProfile().getName()),
|
||||
@@ -222,7 +191,7 @@ index 622257dbbe572de33e15abef9055016268730261..dfb4524d80f642eff1b146dd2fbfa07f
|
||||
private final ServerStatsCounter stats;
|
||||
private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE;
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425eced33cc4 100644
|
||||
index e3d09d5f4efb32bb276e001e5ee747a775b502ee..86ce80765eb7645533806f730b15557f8ea6a9a2 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -132,6 +132,7 @@ public abstract class PlayerList {
|
||||
@@ -233,12 +202,12 @@ index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425e
|
||||
|
||||
// CraftBukkit start
|
||||
private org.bukkit.craftbukkit.CraftServer cserver;
|
||||
@@ -150,6 +151,105 @@ public abstract class PlayerList {
|
||||
@@ -150,6 +151,106 @@ public abstract class PlayerList {
|
||||
|
||||
abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
|
||||
|
||||
+ // Leaves start - replay api
|
||||
+ public void placeNewPhotographer(Connection connection, org.leavesmc.leaves.replay.ServerPhotographer player, ServerLevel worldserver, org.bukkit.Location location) {
|
||||
+ public void placeNewPhotographer(Connection connection, org.leavesmc.leaves.replay.ServerPhotographer player, ServerLevel worldserver) {
|
||||
+ player.isRealPlayer = true; // Paper
|
||||
+ player.loginTime = System.currentTimeMillis(); // Paper
|
||||
+
|
||||
@@ -264,6 +233,7 @@ index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425e
|
||||
+ playerconnection.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected));
|
||||
+ RecipeManager craftingmanager = this.server.getRecipeManager();
|
||||
+ playerconnection.send(new ClientboundUpdateRecipesPacket(craftingmanager.getSynchronizedItemProperties(), craftingmanager.getSynchronizedStonecutterRecipes()));
|
||||
+
|
||||
+ this.sendPlayerPermissionLevel(player);
|
||||
+ player.getStats().markAllDirty();
|
||||
+ player.getRecipeBook().sendInitialRecipeBook(player);
|
||||
@@ -339,7 +309,7 @@ index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425e
|
||||
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie cookie) {
|
||||
player.isRealPlayer = true; // Paper
|
||||
player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
|
||||
@@ -315,6 +415,7 @@ public abstract class PlayerList {
|
||||
@@ -315,6 +416,7 @@ public abstract class PlayerList {
|
||||
|
||||
// player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below
|
||||
this.players.add(player);
|
||||
@@ -347,7 +317,7 @@ index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425e
|
||||
this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot
|
||||
this.playersByUUID.put(player.getUUID(), player);
|
||||
this.addToSendAllPlayerInfoBuckets(player); // Gale - Purpur - spread out sending all player info
|
||||
@@ -374,6 +475,12 @@ public abstract class PlayerList {
|
||||
@@ -374,6 +476,12 @@ public abstract class PlayerList {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -360,7 +330,7 @@ index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425e
|
||||
onlinePlayers.add(entityplayer1); // Paper - Use single player info update packet on join
|
||||
}
|
||||
// Paper start - Use single player info update packet on join
|
||||
@@ -515,6 +622,43 @@ public abstract class PlayerList {
|
||||
@@ -515,6 +623,43 @@ public abstract class PlayerList {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +374,7 @@ index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425e
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer player) { // CraftBukkit - return string // Paper - return Component
|
||||
// Paper start - Fix kick event leave message not being sent
|
||||
return this.remove(player, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? player.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(player.getDisplayName())));
|
||||
@@ -591,6 +735,7 @@ public abstract class PlayerList {
|
||||
@@ -591,6 +736,7 @@ public abstract class PlayerList {
|
||||
player.retireScheduler(); // Paper - Folia schedulers
|
||||
player.getAdvancements().stopListening();
|
||||
this.players.remove(player);
|
||||
@@ -412,7 +382,7 @@ index 03bf654aaf1b4f7df9608ee1ad99230f7aa507f9..8893be00aa731d26a41b5e6b3996425e
|
||||
this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
||||
this.removeFromSendAllPlayerInfoBuckets(player); // Gale - Purpur - spread out sending all player info
|
||||
this.server.getCustomBossEvents().onPlayerDisconnect(player);
|
||||
@@ -688,7 +833,7 @@ public abstract class PlayerList {
|
||||
@@ -688,7 +834,7 @@ public abstract class PlayerList {
|
||||
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
|
||||
// ? Component.translatable("multiplayer.disconnect.server_full")
|
||||
// : null;
|
||||
|
||||
@@ -7,7 +7,7 @@ Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Co-authored by: MachineBreaker <machinebreaker>
|
||||
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index 78654e7ae26c0b2b2512f4e29a331e2ead2d6916..13edbcdabc159e3694e7dbe824ccb5bb447fe788 100644
|
||||
index 98cb62d4b79c0918abe139f198c5be118b9133c4..b39d67ab9ed446885111a5387d3332c36b4f3cc9 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -1006,17 +1006,19 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Fix sprint glitch
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 9f36d063168c262fec7e69a96bad375b4eaff797..d7bb99b6d0a5818ccd68aa361c77a8733023f1ea 100644
|
||||
index 4fb6102c8ef930de80356c66397ca2167b1d0174..c7f58236400dbb9d26cf4a5b83b3a9202b10471d 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1379,7 +1379,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -9,7 +9,7 @@ But still recommend to turn-off `checkForMinecartNearItemWhileActive`
|
||||
Since `Reduce-hopper-item-checks.patch` will cause lag under massive dropped items
|
||||
|
||||
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 0e21c644d62597cf3425c8717ab1e70c766e22f2..3fbdb1cdb2c69340cbca6b154cdb7eae95f6391f 100644
|
||||
index 6436afc0e59a8efdc9551fdde4d03d245548f3ef..280d9d5a23f5fc8560ca8eeb4f3652ea9c1505b2 100644
|
||||
--- a/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -241,7 +241,11 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -7,7 +7,7 @@ Subject: [PATCH] SparklyPaper: Allow throttling hopper checks if the target
|
||||
Original project: https://github.com/SparklyPower/SparklyPaper
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 276cb0dffaa253a6c13b4c68d8c703732118d0d1..962c870bc2ccff52c70be991850fec4663fa7f32 100644
|
||||
index 2549dd08b60cd81dcbf3412ed71cfc40729ae468..fe1dba198fced6f23556d95ba2f8fbc9200d878a 100644
|
||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -419,6 +419,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Remove useless creating stats json bases on player name logic
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 8893be00aa731d26a41b5e6b3996425eced33cc4..831d1a60a5ed57d4f09b5ece6ffb50e061398cc0 100644
|
||||
index 86ce80765eb7645533806f730b15557f8ea6a9a2..29275d0fd6b3d320d5e444fb32aa4004f4370720 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1555,6 +1555,8 @@ public abstract class PlayerList {
|
||||
@@ -1556,6 +1556,8 @@ public abstract class PlayerList {
|
||||
if (serverStatsCounter == null) {
|
||||
File file = this.server.getWorldPath(LevelResource.PLAYER_STATS_DIR).toFile();
|
||||
File file1 = new File(file, uuid + ".json");
|
||||
@@ -17,7 +17,7 @@ index 8893be00aa731d26a41b5e6b3996425eced33cc4..831d1a60a5ed57d4f09b5ece6ffb50e0
|
||||
if (!file1.exists()) {
|
||||
File file2 = new File(file, displayName + ".json"); // CraftBukkit
|
||||
Path path = file2.toPath();
|
||||
@@ -1562,6 +1564,8 @@ public abstract class PlayerList {
|
||||
@@ -1563,6 +1565,8 @@ public abstract class PlayerList {
|
||||
file2.renameTo(file1);
|
||||
}
|
||||
}
|
||||
@@ -53,10 +53,10 @@ index dfb4524d80f642eff1b146dd2fbfa07f21d844c6..2c67693cc3781eb5aee10b4dfb9617cb
|
||||
} else {
|
||||
getBukkitEntity().setPlayerListName(prefix + scoreboardName + suffix, true);
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 5078887fc6056a0f3ef5acd5e052116107737e62..9c5ba056376a731871a2c00654cc179915d4dafd 100644
|
||||
index 5cd5234e9f2b8a17b6f9fdaa62e8fc0a9aa6331b..44f2182b5d78b0e51e8f5253fa9c89ea687b72df 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2261,6 +2261,8 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2260,6 +2260,8 @@ public class ServerGamePacketListenerImpl
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ index 5078887fc6056a0f3ef5acd5e052116107737e62..9c5ba056376a731871a2c00654cc1799
|
||||
@Override
|
||||
public void handleChatCommand(ServerboundChatCommandPacket packet) {
|
||||
this.tryHandleChat(packet.command(), () -> {
|
||||
@@ -2281,6 +2283,32 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2280,6 +2282,32 @@ public class ServerGamePacketListenerImpl
|
||||
LOGGER.info("{} issued server command: {}", this.player.getScoreboardName(), prefixedCommand);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ index 5078887fc6056a0f3ef5acd5e052116107737e62..9c5ba056376a731871a2c00654cc1799
|
||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), prefixedCommand, new LazyPlayerSet(this.server));
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
|
||||
@@ -2318,11 +2346,37 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -2317,11 +2345,37 @@ public class ServerGamePacketListenerImpl
|
||||
|
||||
private void performSignedChatCommand(ServerboundChatCommandSignedPacket packet, LastSeenMessages lastSeenMessages) {
|
||||
// CraftBukkit start
|
||||
@@ -138,10 +138,10 @@ index 5078887fc6056a0f3ef5acd5e052116107737e62..9c5ba056376a731871a2c00654cc1799
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
command = event.getMessage().substring(1);
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 831d1a60a5ed57d4f09b5ece6ffb50e061398cc0..0bb8c326a468e79a7f5a4f3395a3c2fe84352f47 100644
|
||||
index 29275d0fd6b3d320d5e444fb32aa4004f4370720..2d8c20ddd675173e9ea5734cfde6687ac042e01d 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -667,6 +667,7 @@ public abstract class PlayerList {
|
||||
@@ -668,6 +668,7 @@ public abstract class PlayerList {
|
||||
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerLeave(player); // Leaves - protocol
|
||||
// Paper end - Fix kick event leave message not being sent
|
||||
org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar
|
||||
@@ -150,7 +150,7 @@ index 831d1a60a5ed57d4f09b5ece6ffb50e061398cc0..0bb8c326a468e79a7f5a4f3395a3c2fe
|
||||
player.awardStat(Stats.LEAVE_GAME);
|
||||
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
||||
diff --git a/org/purpurmc/purpur/PurpurConfig.java b/org/purpurmc/purpur/PurpurConfig.java
|
||||
index c168e9d2c395044a662efd2d9ccde8b20c070b22..ee254498e71d50d461b7d6716704df8c2733037e 100644
|
||||
index b8c8806789bd0060cd3faee5815bbf25c8715a9b..c726406ac67980f0403cc524d96f08916218667a 100644
|
||||
--- a/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -175,6 +175,11 @@ public class PurpurConfig {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Virtual thread for user authenticator
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index fec84afa274f8b7cc3e0e9bf500e672c16be53d4..9081780cff9d97b0f4a93afade62f5ef0d448209 100644
|
||||
index 4567067bd91000bb98052cd5a139292e4615b13f..069477e524a28b20a0289221858bdc802704a890 100644
|
||||
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -55,7 +55,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -91,7 +91,7 @@ index 30bd254542d631676494f349ff3f44f52d54ab2f..63e6411d8bac1629e143cc620fe35dba
|
||||
|
||||
public record Favicon(byte[] iconBytes) {
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 22b0f33dc3ef9f51ba2ca3cb665b07a16bd1c9d9..7b1e5addd6a1b815498233ba9032f224494af12a 100644
|
||||
index 6e7ac9128378586160230bd33462edb7d6880154..92eda3826518cf54891cccb46eed9e0d3da165ba 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -667,6 +667,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -138,10 +138,10 @@ index ee8cdd532b73180cb484fcc37c36f09c40faacda..becadda1642c1b9342f2fdff1fc062a2
|
||||
if (packet == null || this.processedDisconnect) { // Spigot
|
||||
return;
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 0bb8c326a468e79a7f5a4f3395a3c2fe84352f47..fe9784751f4291ce100998bf15554d19745025ca 100644
|
||||
index 2d8c20ddd675173e9ea5734cfde6687ac042e01d..739835ce8c02e485abbe8de2e02d19ce9b3f44f9 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1515,7 +1515,7 @@ public abstract class PlayerList {
|
||||
@@ -1516,7 +1516,7 @@ public abstract class PlayerList {
|
||||
public void broadcastChatMessage(PlayerChatMessage message, Predicate<ServerPlayer> shouldFilterMessageTo, @Nullable ServerPlayer sender, ChatType.Bound boundChatType, @Nullable Function<net.kyori.adventure.audience.Audience, Component> unsignedFunction) {
|
||||
// Paper end
|
||||
boolean flag = this.verifyChatTrusted(message);
|
||||
@@ -150,7 +150,7 @@ index 0bb8c326a468e79a7f5a4f3395a3c2fe84352f47..fe9784751f4291ce100998bf15554d19
|
||||
OutgoingChatMessage outgoingChatMessage = OutgoingChatMessage.create(message);
|
||||
boolean flag1 = false;
|
||||
|
||||
@@ -1540,6 +1540,7 @@ public abstract class PlayerList {
|
||||
@@ -1541,6 +1541,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||
@@ -14,7 +14,7 @@ ThreadUnsafeRandom (Moonrise): 102,265,100 ns
|
||||
SimpleThreadUnsafeRandom (Moonrise): 97,054,600 ns
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 92e70e132a86930d9cd0db32f10e106427621c7d..5b61e9e26fd63b938f38753c9ce38a474ffe80e5 100644
|
||||
index 4070a6eb52f6097e38c2d85c231d39ea3785cf46..bb76dbf98979fdc725676c98dafe64ea941cb290 100644
|
||||
--- a/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -150,7 +150,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
@@ -27,7 +27,7 @@ index 92e70e132a86930d9cd0db32f10e106427621c7d..5b61e9e26fd63b938f38753c9ce38a47
|
||||
final ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkData chunkData = ((ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemChunkHolder)((ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemLevelChunk)levelChunk).moonrise$getChunkAndHolder().holder())
|
||||
.moonrise$getRealChunkHolder().holderData;
|
||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||
index 22b929d30938a26837b21511425c62fc1665a669..677e5f31089879235677b82ff554e5b89e335a6d 100644
|
||||
index 40b6b5e4a1f73ee447ff0ee192d5d8ba5045f286..f9e335c86684969b744a7d7c1d96458e830bbd35 100644
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -902,7 +902,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
@@ -89,7 +89,7 @@ index 98a54bc4de251014342cda6d0951b7fea79ce553..6d56134cc9ed9d73104ae77b1a0baa5a
|
||||
RandomSource fork();
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 539cd1fe6ff15a4ebcbd65f41d8711d1f4ce5b97..034e10e912ab9b4b5435ad88c0cd4183c8b5c1a1 100644
|
||||
index 761b3806ddec0675935dc2e24d36e4b221c53c9b..8bb2abb01f1af34d6829cbbf759a425d871f3e3f 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -143,7 +143,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -102,7 +102,7 @@ index 539cd1fe6ff15a4ebcbd65f41d8711d1f4ce5b97..034e10e912ab9b4b5435ad88c0cd4183
|
||||
private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom {
|
||||
public RandomRandomSource() {
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index 13edbcdabc159e3694e7dbe824ccb5bb447fe788..367ba07f63917dc75883d5fd3dde93dc9ffc144a 100644
|
||||
index b39d67ab9ed446885111a5387d3332c36b4f3cc9..53cabe7dabc83618c8941c95e95c5b7e23ee694e 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -126,7 +126,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection message
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index fe9784751f4291ce100998bf15554d19745025ca..c69fcc9725738136341cc2e9d63b5e2ef11e1fe5 100644
|
||||
index 739835ce8c02e485abbe8de2e02d19ce9b3f44f9..9aa924cb58ea6d50572d67f628d35eebb809ae72 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -433,7 +433,7 @@ public abstract class PlayerList {
|
||||
@@ -434,7 +434,7 @@ public abstract class PlayerList {
|
||||
// Ensure that player inventory is populated with its viewer
|
||||
player.containerMenu.transferTo(player.containerMenu, bukkitPlayer);
|
||||
|
||||
@@ -17,7 +17,7 @@ index fe9784751f4291ce100998bf15554d19745025ca..c69fcc9725738136341cc2e9d63b5e2e
|
||||
this.cserver.getPluginManager().callEvent(playerJoinEvent);
|
||||
|
||||
if (!player.connection.isAcceptingMessages()) {
|
||||
@@ -446,7 +446,7 @@ public abstract class PlayerList {
|
||||
@@ -447,7 +447,7 @@ public abstract class PlayerList {
|
||||
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
@@ -26,7 +26,7 @@ index fe9784751f4291ce100998bf15554d19745025ca..c69fcc9725738136341cc2e9d63b5e2e
|
||||
joinMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(jm); // Paper - Adventure
|
||||
this.server.getPlayerList().broadcastSystemMessage(joinMessage, false); // Paper - Adventure
|
||||
}
|
||||
@@ -676,7 +676,7 @@ public abstract class PlayerList {
|
||||
@@ -677,7 +677,7 @@ public abstract class PlayerList {
|
||||
player.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - Inventory close reason
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ index fe9784751f4291ce100998bf15554d19745025ca..c69fcc9725738136341cc2e9d63b5e2e
|
||||
this.cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||
player.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
||||
|
||||
@@ -1667,4 +1667,34 @@ public abstract class PlayerList {
|
||||
@@ -1668,4 +1668,34 @@ public abstract class PlayerList {
|
||||
public boolean isAllowCommandsForAllPlayers() {
|
||||
return this.allowCommandsForAllPlayers;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in entity visible effects filter
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index c041cba43b4687e2f2f057edfae448a42f6d8753..8b096a0f9f23a9b90ef88414e8749a514e3910cf 100644
|
||||
index c7f58236400dbb9d26cf4a5b83b3a9202b10471d..7bdf6db0dd0e72d798de301d1acd190216dc8bc7 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -988,12 +988,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in trial spawner ticking
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java
|
||||
index 02723e61684fcf36094d7b9c81f6ab87ad6f620a..fc340def138824c7f922788e3dce48adfc1258dd 100644
|
||||
index 3e8d0c8d8409b6ba2e2846d7d64cdcc8fc6094a4..2f8324ce552f982f6b3388d9fa5a63fb9bee625b 100644
|
||||
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java
|
||||
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java
|
||||
@@ -173,17 +173,21 @@ public enum TrialSpawnerState implements StringRepresentable {
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Replace Entity active effects map with optimized collection
|
||||
Dreeam TODO: check this
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 8b096a0f9f23a9b90ef88414e8749a514e3910cf..d8a93bd85580c4bdc52d6f368b78ad210c265ae5 100644
|
||||
index 7bdf6db0dd0e72d798de301d1acd190216dc8bc7..54b7ae45de54dc335a88a8c48e5212e7e663bc54 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -211,6 +211,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Replace brain maps with optimized collection
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
|
||||
index 402279ff78f9e9eb74c63d35ec1968d239228d70..5eaa1dec9fbe72a22c34331a28f7b7115fb3aeba 100644
|
||||
index 083eb9a7a0bc14d30db944f356d98ca552fa1784..c561b749fb9b76ba9b1e9689089b743248c65d50 100644
|
||||
--- a/net/minecraft/world/entity/ai/Brain.java
|
||||
+++ b/net/minecraft/world/entity/ai/Brain.java
|
||||
@@ -45,14 +45,18 @@ public class Brain<E extends LivingEntity> {
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Use caffeine cache for kickPermission instead of using
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 2857e71ddb37f2a98c72df8cb439e2eab97d6f67..23092d6f6bca4eff4aaceabed51927e13156b30d 100644
|
||||
index 44f2182b5d78b0e51e8f5253fa9c89ea687b72df..7b493b28f57977c92c4a45049cedcb0cedbe8ae9 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -328,17 +328,12 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Do not place player if the server is full
|
||||
Fix https://github.com/PaperMC/Paper/issues/10668
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 5fe6a295f5b5285a20c535a026e1342f89896fd7..8233b250a8d0e9f26302f6756931d2edfe017504 100644
|
||||
index 9aa924cb58ea6d50572d67f628d35eebb809ae72..6327d508252b35fcbd2daebad078f00d44291c6e 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -340,6 +340,13 @@ public abstract class PlayerList {
|
||||
@@ -341,6 +341,13 @@ public abstract class PlayerList {
|
||||
return;
|
||||
}
|
||||
// Gale end - MultiPaper - do not place player in world if kicked before being spawned in
|
||||
@@ -23,7 +23,7 @@ index 5fe6a295f5b5285a20c535a026e1342f89896fd7..8233b250a8d0e9f26302f6756931d2ed
|
||||
|
||||
org.bukkit.Location loc = ev.getSpawnLocation();
|
||||
serverLevel = ((org.bukkit.craftbukkit.CraftWorld) loc.getWorld()).getHandle();
|
||||
@@ -834,7 +841,7 @@ public abstract class PlayerList {
|
||||
@@ -835,7 +842,7 @@ public abstract class PlayerList {
|
||||
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
|
||||
// ? Component.translatable("multiplayer.disconnect.server_full")
|
||||
// : null;
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Fix-MC-119417
|
||||
Related MC issue: https://bugs.mojang.com/browse/MC-119417
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 09c9ca038f359372bda3a3d8b743d497a530ce97..ef20741ab2a7feaa8a86759ee0ae6283e4d4651c 100644
|
||||
index 2c67693cc3781eb5aee10b4dfb9617cbe107e922..e1a1bddfc11da20f3a1b9a2773b19d4317fac914 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2260,6 +2260,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -24,7 +24,7 @@ index 8b3dfb1385a2252a4aaead5558c0ffbd5c204971..c32086ddf90fafcc55600f9e0724b9f9
|
||||
if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking
|
||||
this.goalSelector.tick();
|
||||
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
|
||||
index 5dbf28c15f828505d42dc31c1a2185e01a7542c1..3799cf1059e18448fc6da120d12d08f6bbbfbf49 100644
|
||||
index e8e2848c12e3cf2ad86fc3bd18f03182ee291775..bee017f2c47a9f0876e2e05ce1c720332fb74566 100644
|
||||
--- a/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -371,7 +371,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -12,7 +12,7 @@ before spawning, it checks isSpawnPositionOk() for the position which loads the
|
||||
This patch ensures the chunk at the random location is loaded before trying to spawn the reinforcement zombie in it.
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
||||
index cab69c308a0524137636fd50dc7a0dd0d2a4a2c3..660dff3fe7aacfe964dae22bb38b72aa36f0b8e3 100644
|
||||
index e64f9308fc848c0f22d8dbd6e544b7862054be7b..ecdfadca31c5833e2a685163925540df4b72dc81 100644
|
||||
--- a/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -396,6 +396,13 @@ public class Zombie extends Monster {
|
||||
@@ -218,10 +218,10 @@ index f9e335c86684969b744a7d7c1d96458e830bbd35..9f3fe9ffdbd2973754898233cca60b73
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b03ec4f449bf7c7bd56bf763fe5c2841ca1408ef..d9dfa7c0c79166156c6e166d721e804264d3c59c 100644
|
||||
index 7b493b28f57977c92c4a45049cedcb0cedbe8ae9..89a9a9738ae1a6b67fa3840000af496ebcff67da 100644
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1817,7 +1817,7 @@ public class ServerGamePacketListenerImpl
|
||||
@@ -1816,7 +1816,7 @@ public class ServerGamePacketListenerImpl
|
||||
}
|
||||
|
||||
public void internalTeleport(PositionMoveRotation posMoveRotation, Set<Relative> relatives) {
|
||||
@@ -20,7 +20,7 @@ index 002ec5f1ec14411ca48ae04b3379db0c70f81942..d2ca99f8b5ad46c59b663cd56f3ee2bd
|
||||
// Paper end - Affects Spawning API
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 660dff3fe7aacfe964dae22bb38b72aa36f0b8e3..4f7a5d6391f045693a6208ff5cd99e5e0b58b194 100644
|
||||
index ecdfadca31c5833e2a685163925540df4b72dc81..9c83f1406c0aaad36383a23cebf270b8dc6ced33 100644
|
||||
--- a/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -406,7 +406,7 @@ public class Zombie extends Monster {
|
||||
@@ -46,7 +46,7 @@ index 8de482367f3d9d91048b7c85cbaefcda9f9fbcdc..8c6f8cb08b247dcf497822ae991aa3af
|
||||
|
||||
public void clientTick(Level level, BlockPos pos) {
|
||||
diff --git a/net/minecraft/world/level/EntityGetter.java b/net/minecraft/world/level/EntityGetter.java
|
||||
index f41e41d01aa42f3578ffb3bc888416e74d17cd1d..9d3b5ea3f0cd8d662ffe99e70bf0af22f6ba0512 100644
|
||||
index 7719bc8ff1fbbc67cdf15e1fec28dc9233cea207..670860df81a3abfc1b8b53be505fce0ee32ee2c4 100644
|
||||
--- a/net/minecraft/world/level/EntityGetter.java
|
||||
+++ b/net/minecraft/world/level/EntityGetter.java
|
||||
@@ -112,6 +112,89 @@ public interface EntityGetter extends ca.spottedleaf.moonrise.patches.chunk_syst
|
||||
@@ -14,7 +14,7 @@ In non-strict testing, this can give ~20-40% improvement (54MSPT -> 44MSPT),
|
||||
under 625 villagers situation.
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
index b0c5e41fefc7c9adf1a61bd5b52861736657d37e..4898381d51cd9ea321ed75c5c253de96bdd46f7d 100644
|
||||
index b0c5e41fefc7c9adf1a61bd5b52861736657d37e..66374b79ade5cd10fa6e1d9187bf6b1112da4827 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
@@ -13,6 +13,21 @@ import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
|
||||
@@ -12,7 +12,7 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 6aa4153a5368645ad3f1a0b879428f9a60d8fbc6..4819ff258b3abffcbf8a443b157c3a28afd1c52a 100644
|
||||
index a7f87ba5a447be8bd1a4029da999aca34a583b5e..4c9c41b3d0f8752e6dc60c513a951b79945a4549 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2732,6 +2732,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -9,7 +9,7 @@ happen but the visual "refresh" of a world change is hidden. Depending on the de
|
||||
this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index d0c4c46c38eeb923b5352a0969e2e4ef8937d9f7..b4ca5d43401d03bf1e9580e95fd473b7c28916ac 100644
|
||||
index e1a1bddfc11da20f3a1b9a2773b19d4317fac914..01c30802a1d0127f2ed36efa7511c2ac6b2b5cfa 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1468,6 +1468,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -30,10 +30,10 @@ index d0c4c46c38eeb923b5352a0969e2e4ef8937d9f7..b4ca5d43401d03bf1e9580e95fd473b7
|
||||
level.addDuringTeleport(this);
|
||||
this.triggerDimensionChangeTriggers(serverLevel);
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 7fe5b9006de5c1a549aa3fc1a0947f3042b15c56..75e5540337706f1be213adfc778e6ebd32409f96 100644
|
||||
index 6327d508252b35fcbd2daebad078f00d44291c6e..e686d435dcca9dc74a0d569878e51f643210653c 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -954,11 +954,11 @@ public abstract class PlayerList {
|
||||
@@ -955,11 +955,11 @@ public abstract class PlayerList {
|
||||
byte b = (byte)(keepInventory ? 1 : 0);
|
||||
ServerLevel serverLevel = serverPlayer.serverLevel();
|
||||
LevelData levelData = serverLevel.getLevelData();
|
||||
@@ -76,7 +76,7 @@ index a8c6549f772208cd543607224fef2c2389b14f24..709631db548a16a969a373e26ebbcd69
|
||||
public boolean equals(Object other) {
|
||||
return this == other
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index ead6a4823d7681109bc0888d0a1fc0d73dad3c98..9a3b27457ff62dfb2ead9c114c287f55504f19f6 100644
|
||||
index 4c9c41b3d0f8752e6dc60c513a951b79945a4549..7d88bcb727b53217f10472d73726a96f54ebc31d 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -159,7 +159,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
@@ -1,22 +0,0 @@
|
||||
package org.dreeam.leaf.config.modules.gameplay;
|
||||
|
||||
import org.dreeam.leaf.config.ConfigModules;
|
||||
import org.dreeam.leaf.config.EnumConfigCategory;
|
||||
|
||||
public class DisableMovedWronglyThreshold extends ConfigModules {
|
||||
|
||||
public String getBasePath() {
|
||||
return EnumConfigCategory.GAMEPLAY.getBaseKeyName() + ".player";
|
||||
}
|
||||
|
||||
public static boolean enabled = false;
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".disable-moved-wrongly-threshold", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"Disable moved quickly/wrongly checks.",
|
||||
"关闭 moved wrongly/too quickly! 警告."
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.stats.ServerStatsCounter;
|
||||
import net.minecraft.stats.Stat;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -18,21 +19,18 @@ public class BotStatsCounter extends ServerStatsCounter {
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Stat<?> stat, int value) {
|
||||
|
||||
public void setValue(@NotNull Player player, @NotNull Stat<?> stat, int value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseLocal(DataFixer dataFixer, String json) {
|
||||
|
||||
public void parseLocal(@NotNull DataFixer dataFixer, @NotNull String json) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue(Stat<?> stat) {
|
||||
public int getValue(@NotNull Stat<?> stat) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ public class AppleSkinProtocol {
|
||||
}
|
||||
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation id(String path) {
|
||||
return new ResourceLocation(PROTOCOL_ID, path);
|
||||
public static ResourceLocation id(String path) {
|
||||
return ResourceLocation.tryBuild(PROTOCOL_ID, path);
|
||||
}
|
||||
|
||||
@ProtocolHandler.PlayerJoin
|
||||
|
||||
@@ -21,13 +21,13 @@ public class XaeroMapProtocol {
|
||||
}
|
||||
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation idMini(String path) {
|
||||
return new ResourceLocation(PROTOCOL_ID_MINI, path);
|
||||
public static ResourceLocation idMini(String path) {
|
||||
return ResourceLocation.tryBuild(PROTOCOL_ID_MINI, path);
|
||||
}
|
||||
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation idWorld(String path) {
|
||||
return new ResourceLocation(PROTOCOL_ID_WORLD, path);
|
||||
public static ResourceLocation idWorld(String path) {
|
||||
return ResourceLocation.tryBuild(PROTOCOL_ID_WORLD, path);
|
||||
}
|
||||
|
||||
public static void onSendWorldInfo(@NotNull ServerPlayer player) {
|
||||
|
||||
@@ -173,7 +173,7 @@ public class LeavesProtocolManager {
|
||||
if (receiver.sendFabricRegister() && !receiver.ignoreId()) {
|
||||
for (String payloadId : receiver.payloadId()) {
|
||||
for (String namespace : protocol.namespace()) {
|
||||
ALL_KNOWN_ID.add(new ResourceLocation(namespace, payloadId));
|
||||
ALL_KNOWN_ID.add(ResourceLocation.tryBuild(namespace, payloadId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,6 @@ public class LeavesProtocolManager {
|
||||
}
|
||||
|
||||
public record EmptyPayload(ResourceLocation id) implements LeavesCustomPayload<EmptyPayload> {
|
||||
|
||||
@New
|
||||
public EmptyPayload(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
this(location);
|
||||
@@ -336,7 +335,6 @@ public class LeavesProtocolManager {
|
||||
|
||||
public record LeavesPayload(FriendlyByteBuf data,
|
||||
ResourceLocation id) implements LeavesCustomPayload<LeavesPayload> {
|
||||
|
||||
@New
|
||||
public LeavesPayload(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
this(new FriendlyByteBuf(buf.readBytes(buf.readableBytes())), location);
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -11,6 +12,7 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.AgeableMob;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.animal.Chicken;
|
||||
import net.minecraft.world.entity.animal.allay.Allay;
|
||||
@@ -41,10 +43,11 @@ import org.leavesmc.leaves.protocol.core.ProtocolHandler;
|
||||
import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
import org.leavesmc.leaves.protocol.jade.accessor.BlockAccessor;
|
||||
import org.leavesmc.leaves.protocol.jade.accessor.EntityAccessor;
|
||||
import org.leavesmc.leaves.protocol.jade.payload.ClientHandshakePayload;
|
||||
import org.leavesmc.leaves.protocol.jade.payload.ReceiveDataPayload;
|
||||
import org.leavesmc.leaves.protocol.jade.payload.RequestBlockPayload;
|
||||
import org.leavesmc.leaves.protocol.jade.payload.RequestEntityPayload;
|
||||
import org.leavesmc.leaves.protocol.jade.payload.ServerPingPayload;
|
||||
import org.leavesmc.leaves.protocol.jade.payload.ServerHandshakePayload;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.IJadeProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.IServerDataProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.IServerExtensionProvider;
|
||||
@@ -66,6 +69,7 @@ import org.leavesmc.leaves.protocol.jade.provider.entity.AnimalOwnerProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.entity.MobBreedingProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.entity.MobGrowthProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.entity.NextEntityDropProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.entity.PetArmorProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.entity.StatusEffectsProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.entity.ZombieVillagerProvider;
|
||||
import org.leavesmc.leaves.protocol.jade.util.HierarchyLookup;
|
||||
@@ -75,7 +79,9 @@ import org.leavesmc.leaves.protocol.jade.util.PriorityStore;
|
||||
import org.leavesmc.leaves.protocol.jade.util.WrappedHierarchyLookup;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@LeavesProtocol(namespace = "jade")
|
||||
public class JadeProtocol {
|
||||
@@ -84,18 +90,20 @@ public class JadeProtocol {
|
||||
private static List<Block> shearableBlocks = null;
|
||||
|
||||
public static final String PROTOCOL_ID = "jade";
|
||||
public static final String PROTOCOL_VERSION = "7";
|
||||
|
||||
public static final HierarchyLookup<IServerDataProvider<EntityAccessor>> entityDataProviders = new HierarchyLookup<>(Entity.class);
|
||||
public static final PairHierarchyLookup<IServerDataProvider<BlockAccessor>> blockDataProviders = new PairHierarchyLookup<>(new HierarchyLookup<>(Block.class), new HierarchyLookup<>(BlockEntity.class));
|
||||
public static final WrappedHierarchyLookup<IServerExtensionProvider<ItemStack>> itemStorageProviders = WrappedHierarchyLookup.forAccessor();
|
||||
private static final Set<ServerPlayer> enabledPlayers = new HashSet<>();
|
||||
|
||||
public static boolean shouldEnable() {
|
||||
return org.dreeam.leaf.config.modules.network.ProtocolSupport.jadeProtocol;
|
||||
}
|
||||
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation id(String path) {
|
||||
return new ResourceLocation(PROTOCOL_ID, path);
|
||||
public static ResourceLocation id(String path) {
|
||||
return ResourceLocation.tryBuild(PROTOCOL_ID, path);
|
||||
}
|
||||
|
||||
@Contract("_ -> new")
|
||||
@@ -124,6 +132,7 @@ public class JadeProtocol {
|
||||
entityDataProviders.register(Tadpole.class, MobGrowthProvider.INSTANCE);
|
||||
entityDataProviders.register(Animal.class, MobBreedingProvider.INSTANCE);
|
||||
entityDataProviders.register(Allay.class, MobBreedingProvider.INSTANCE);
|
||||
entityDataProviders.register(Mob.class, PetArmorProvider.INSTANCE);
|
||||
|
||||
entityDataProviders.register(Chicken.class, NextEntityDropProvider.INSTANCE);
|
||||
entityDataProviders.register(Armadillo.class, NextEntityDropProvider.INSTANCE);
|
||||
@@ -152,20 +161,22 @@ public class JadeProtocol {
|
||||
entityDataProviders.loadComplete(priorities);
|
||||
itemStorageProviders.loadComplete(priorities);
|
||||
|
||||
try {
|
||||
shearableBlocks = Collections.unmodifiableList(LootTableMineableCollector.execute(
|
||||
MinecraftServer.getServer().reloadableRegistries().lookup().lookupOrThrow(Registries.LOOT_TABLE),
|
||||
Items.SHEARS.getDefaultInstance()
|
||||
));
|
||||
} catch (Throwable ignore) {
|
||||
shearableBlocks = List.of();
|
||||
LeavesLogger.LOGGER.severe("Failed to collect shearable blocks");
|
||||
}
|
||||
rebuildShearableBlocks();
|
||||
}
|
||||
|
||||
@ProtocolHandler.PlayerJoin
|
||||
public static void onPlayerJoin(ServerPlayer player) {
|
||||
sendPingPacket(player);
|
||||
@ProtocolHandler.PayloadReceiver(payload = ClientHandshakePayload.class, payloadId = "client_handshake")
|
||||
public static void clientHandshake(ServerPlayer player, ClientHandshakePayload payload) {
|
||||
if (!payload.protocolVersion().equals(PROTOCOL_VERSION)) {
|
||||
player.sendSystemMessage(Component.literal("You are using a different version of Jade than the server. Please update Jade or report to the server operator").withColor(0xff0000));
|
||||
return;
|
||||
}
|
||||
ProtocolUtils.sendPayloadPacket(player, new ServerHandshakePayload(Collections.emptyMap(), shearableBlocks, blockDataProviders.mappedIds(), entityDataProviders.mappedIds()));
|
||||
enabledPlayers.add(player);
|
||||
}
|
||||
|
||||
@ProtocolHandler.PlayerLeave
|
||||
public static void onPlayerLeave(ServerPlayer player) {
|
||||
enabledPlayers.remove(player);
|
||||
}
|
||||
|
||||
@ProtocolHandler.PayloadReceiver(payload = RequestEntityPayload.class, payloadId = "request_entity")
|
||||
@@ -255,17 +266,22 @@ public class JadeProtocol {
|
||||
@ProtocolHandler.ReloadServer
|
||||
public static void onServerReload() {
|
||||
if (org.dreeam.leaf.config.modules.network.ProtocolSupport.jadeProtocol) {
|
||||
enableAllPlayer();
|
||||
rebuildShearableBlocks();
|
||||
for (ServerPlayer player : enabledPlayers) {
|
||||
ProtocolUtils.sendPayloadPacket(player, new ServerHandshakePayload(Collections.emptyMap(), shearableBlocks, blockDataProviders.mappedIds(), entityDataProviders.mappedIds()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void enableAllPlayer() {
|
||||
for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().players) {
|
||||
sendPingPacket(player);
|
||||
private static void rebuildShearableBlocks() {
|
||||
try {
|
||||
shearableBlocks = Collections.unmodifiableList(LootTableMineableCollector.execute(
|
||||
MinecraftServer.getServer().reloadableRegistries().lookup().lookupOrThrow(Registries.LOOT_TABLE),
|
||||
Items.SHEARS.getDefaultInstance()
|
||||
));
|
||||
} catch (Throwable ignore) {
|
||||
shearableBlocks = List.of();
|
||||
LeavesLogger.LOGGER.severe("Failed to collect shearable blocks");
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPingPacket(ServerPlayer player) {
|
||||
ProtocolUtils.sendPayloadPacket(player, new ServerPingPayload(Collections.emptyMap(), shearableBlocks, blockDataProviders.mappedIds(), entityDataProviders.mappedIds()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package org.leavesmc.leaves.protocol.jade.accessor;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.nbt.ByteArrayTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
@@ -12,6 +8,9 @@ import net.minecraft.network.codec.StreamEncoder;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class AccessorImpl<T extends HitResult> implements Accessor<T> {
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.leavesmc.leaves.protocol.jade.payload;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||
import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||
|
||||
public record ClientHandshakePayload(String protocolVersion) implements LeavesCustomPayload<ClientHandshakePayload> {
|
||||
|
||||
private static final ResourceLocation PACKET_CLIENT_HANDSHAKE = JadeProtocol.id("client_handshake");
|
||||
|
||||
private static final StreamCodec<RegistryFriendlyByteBuf, ClientHandshakePayload> CODEC = StreamCodec.composite(
|
||||
ByteBufCodecs.STRING_UTF8,
|
||||
ClientHandshakePayload::protocolVersion,
|
||||
ClientHandshakePayload::new);
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
CODEC.encode(ProtocolUtils.decorate(buf), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation id() {
|
||||
return PACKET_CLIENT_HANDSHAKE;
|
||||
}
|
||||
|
||||
@New
|
||||
public static ClientHandshakePayload create(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
return CODEC.decode(ProtocolUtils.decorate(buf));
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||
import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||
import org.leavesmc.leaves.protocol.jade.accessor.BlockAccessor;
|
||||
import org.leavesmc.leaves.protocol.jade.accessor.BlockAccessorImpl;
|
||||
@@ -35,12 +35,12 @@ public record RequestBlockPayload(BlockAccessorImpl.SyncData data, List<@Nullabl
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
CODEC.encode(new RegistryFriendlyByteBuf(buf, MinecraftServer.getServer().registryAccess()), this);
|
||||
CODEC.encode(ProtocolUtils.decorate(buf), this);
|
||||
}
|
||||
|
||||
@New
|
||||
public static RequestBlockPayload create(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
return CODEC.decode(new RegistryFriendlyByteBuf(buf, MinecraftServer.getServer().registryAccess()));
|
||||
return CODEC.decode(ProtocolUtils.decorate(buf));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,10 +6,10 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||
import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||
import org.leavesmc.leaves.protocol.jade.accessor.EntityAccessor;
|
||||
import org.leavesmc.leaves.protocol.jade.accessor.EntityAccessorImpl;
|
||||
@@ -38,12 +38,12 @@ public record RequestEntityPayload(EntityAccessorImpl.SyncData data,
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
CODEC.encode(new RegistryFriendlyByteBuf(buf, MinecraftServer.getServer().registryAccess()), this);
|
||||
CODEC.encode(ProtocolUtils.decorate(buf), this);
|
||||
}
|
||||
|
||||
@New
|
||||
public static RequestEntityPayload create(ResourceLocation location, FriendlyByteBuf buf) {
|
||||
return CODEC.decode(new RegistryFriendlyByteBuf(buf, MinecraftServer.getServer().registryAccess()));
|
||||
return CODEC.decode(ProtocolUtils.decorate(buf));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,9 +8,9 @@ import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||
import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||
|
||||
import java.util.List;
|
||||
@@ -18,28 +18,25 @@ import java.util.Map;
|
||||
|
||||
import static org.leavesmc.leaves.protocol.jade.util.JadeCodec.PRIMITIVE_STREAM_CODEC;
|
||||
|
||||
public record ServerPingPayload(
|
||||
public record ServerHandshakePayload(Map<ResourceLocation, Object> serverConfig, List<Block> shearableBlocks,
|
||||
List<ResourceLocation> blockProviderIds,
|
||||
List<ResourceLocation> entityProviderIds) implements LeavesCustomPayload<ServerHandshakePayload> {
|
||||
|
||||
Map<ResourceLocation, Object> serverConfig,
|
||||
List<Block> shearableBlocks,
|
||||
List<ResourceLocation> blockProviderIds,
|
||||
List<ResourceLocation> entityProviderIds) implements LeavesCustomPayload<ServerPingPayload> {
|
||||
|
||||
private static final ResourceLocation PACKET_SERVER_HANDSHAKE = JadeProtocol.id("server_ping_v1");
|
||||
private static final StreamCodec<RegistryFriendlyByteBuf, ServerPingPayload> CODEC = StreamCodec.composite(
|
||||
private static final ResourceLocation PACKET_SERVER_HANDSHAKE = JadeProtocol.id("server_handshake");
|
||||
private static final StreamCodec<RegistryFriendlyByteBuf, ServerHandshakePayload> CODEC = StreamCodec.composite(
|
||||
ByteBufCodecs.map(Maps::newHashMapWithExpectedSize, ResourceLocation.STREAM_CODEC, PRIMITIVE_STREAM_CODEC),
|
||||
ServerPingPayload::serverConfig,
|
||||
ServerHandshakePayload::serverConfig,
|
||||
ByteBufCodecs.registry(Registries.BLOCK).apply(ByteBufCodecs.list()),
|
||||
ServerPingPayload::shearableBlocks,
|
||||
ServerHandshakePayload::shearableBlocks,
|
||||
ByteBufCodecs.<ByteBuf, ResourceLocation>list().apply(ResourceLocation.STREAM_CODEC),
|
||||
ServerPingPayload::blockProviderIds,
|
||||
ServerHandshakePayload::blockProviderIds,
|
||||
ByteBufCodecs.<ByteBuf, ResourceLocation>list().apply(ResourceLocation.STREAM_CODEC),
|
||||
ServerPingPayload::entityProviderIds,
|
||||
ServerPingPayload::new);
|
||||
ServerHandshakePayload::entityProviderIds,
|
||||
ServerHandshakePayload::new);
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
CODEC.encode(new RegistryFriendlyByteBuf(buf, MinecraftServer.getServer().registryAccess()), this);
|
||||
CODEC.encode(ProtocolUtils.decorate(buf), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.leavesmc.leaves.protocol.jade.provider.entity;
|
||||
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||
import org.leavesmc.leaves.protocol.jade.accessor.EntityAccessor;
|
||||
import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider;
|
||||
|
||||
public enum PetArmorProvider implements StreamServerDataProvider<EntityAccessor, ItemStack> {
|
||||
INSTANCE;
|
||||
|
||||
private static final ResourceLocation MC_PET_ARMOR = JadeProtocol.mc_id("pet_armor");
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack streamData(@NotNull EntityAccessor accessor) {
|
||||
ItemStack armor = ((Mob) accessor.getEntity()).getBodyArmorItem();
|
||||
return armor.isEmpty() ? null : armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamCodec<RegistryFriendlyByteBuf, ItemStack> streamCodec() {
|
||||
return ItemStack.OPTIONAL_STREAM_CODEC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
return MC_PET_ARMOR;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,6 @@ public enum PacketType {
|
||||
public final ResourceLocation identifier;
|
||||
|
||||
PacketType(final String id) {
|
||||
identifier = new ResourceLocation(SyncmaticaProtocol.PROTOCOL_ID, id);
|
||||
identifier = ResourceLocation.tryBuild(SyncmaticaProtocol.PROTOCOL_ID, id);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user