9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Readd Leaves protocols

This commit is contained in:
Dreeam
2025-06-03 09:49:56 +08:00
parent da5610cdc4
commit 3d14e36fe8
307 changed files with 1764 additions and 1722 deletions

View File

@@ -28,5 +28,6 @@ public net.minecraft.world.level.chunk.storage.RegionFile write(Lnet/minecraft/w
public net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece LOGGER
public net.minecraft.world.level.material.FlowingFluid canHoldAnyFluid(Lnet/minecraft/world/level/block/state/BlockState;)Z
public net.minecraft.world.level.pathfinder.SwimNodeEvaluator allowBreaching
public-f net.minecraft.server.level.ServerPlayer gameMode
public-f net.minecraft.world.entity.EntityType dimensions
public-f net.minecraft.world.level.block.state.BlockBehaviour explosionResistance

View File

@@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Thu, 3 Aug 2023 20:36:38 +0800
Subject: [PATCH] Leaves: Replay Mod API
Co-authored-by: alazeprt <nono135246@126.com>
Original license: GPLv3
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 98cfd68226494dbb1a2eaa6680e23a76c2129a62..0f8a1b82dc9d3f4911a0aaa092ef06388ace5108 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -3202,4 +3202,10 @@ public final class Bukkit {
server.clearBlockHighlights();
}
// Purpur end - Debug Marker API
+
+ // Leaves start - Photographer API
+ public static @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager() {
+ return server.getPhotographerManager();
+ }
+ // Leaves end - Photographer API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 002c998368dea33872d65beb79eb4931ce1158d2..b11bd139e2ca7015207145c022b5822e184d8fd0 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2930,4 +2930,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
void clearBlockHighlights();
// Purpur end - Debug Marker API
+
+ // Leaves start - Photographer API
+ @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager();
+ // Leaves end - Photographer API
}

View File

@@ -0,0 +1,26 @@
package org.leavesmc.leaves.entity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
public interface Photographer extends Player {
@NotNull String getId();
void setRecordFile(@NotNull File file);
void stopRecording();
void stopRecording(boolean async);
void stopRecording(boolean async, boolean save);
void pauseRecording();
void resumeRecording();
void setFollowPlayer(@Nullable Player player);
}

View File

@@ -0,0 +1,27 @@
package org.leavesmc.leaves.entity;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.replay.BukkitRecorderOption;
import java.util.Collection;
import java.util.UUID;
public interface PhotographerManager {
@Nullable Photographer getPhotographer(@NotNull UUID uuid);
@Nullable Photographer getPhotographer(@NotNull String id);
@Nullable Photographer createPhotographer(@NotNull String id, @NotNull Location location);
@Nullable Photographer createPhotographer(@NotNull String id, @NotNull Location location, @NotNull BukkitRecorderOption recorderOption);
void removePhotographer(@NotNull String id);
void removePhotographer(@NotNull UUID uuid);
void removeAllPhotographers();
Collection<Photographer> getPhotographers();
}

View File

@@ -0,0 +1,18 @@
package org.leavesmc.leaves.replay;
public class BukkitRecorderOption {
// public int recordDistance = -1;
public String serverName = "Leaf";
public BukkitRecordWeather forceWeather = BukkitRecordWeather.NULL;
public int forceDayTime = -1;
public boolean ignoreChat = false;
// public boolean ignoreItem = false;
public enum BukkitRecordWeather {
CLEAR,
RAIN,
THUNDER,
NULL
}
}

View File

@@ -1,138 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Thu, 3 Aug 2023 20:36:38 +0800
Subject: [PATCH] Leaves: Replay Mod API
Co-authored-by: alazeprt <nono135246@126.com>
Original license: GPLv3
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 f4e1c330b6e23ac9edde5c5644a0a41bdfde81f9..917b7cbd7647fccd9bdd70544bb0e5b6532045a7 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -3191,4 +3191,10 @@ public final class Bukkit {
server.clearBlockHighlights();
}
// Purpur end - Debug Marker API
+
+ // Leaves start - Photographer API
+ public static @NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager() {
+ return server.getPhotographerManager();
+ }
+ // Leaves end - Photographer API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 50984d397d9ff98e82d02efc166aba61f645e491..a1b76899a416b997c6844bcaf837219ce0726496 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2902,4 +2902,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
void clearBlockHighlights();
// Purpur end - Debug Marker API
+
+ // Leaves start - Photographer API
+ @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
new file mode 100644
index 0000000000000000000000000000000000000000..5b564dfd8aa882d0dc8b1833a4b46e1bba699876
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/Photographer.java
@@ -0,0 +1,27 @@
+package org.leavesmc.leaves.entity;
+
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+
+public interface Photographer extends Player {
+
+ @NotNull
+ public String getId();
+
+ public void setRecordFile(@NotNull File file);
+
+ public void stopRecording();
+
+ public void stopRecording(boolean async);
+
+ public void stopRecording(boolean async, boolean save);
+
+ public void pauseRecording();
+
+ public void resumeRecording();
+
+ public void setFollowPlayer(@Nullable Player player);
+}
\ No newline at end of file
diff --git a/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java b/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..ccb19e75748803eb9ad356ffcd0ccfd5145ed776
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/entity/PhotographerManager.java
@@ -0,0 +1,32 @@
+package org.leavesmc.leaves.entity;
+
+import org.bukkit.Location;
+import org.bukkit.util.Consumer;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.leavesmc.leaves.replay.BukkitRecorderOption;
+
+import java.util.Collection;
+import java.util.UUID;
+
+public interface PhotographerManager {
+ @Nullable
+ public Photographer getPhotographer(@NotNull UUID uuid);
+
+ @Nullable
+ public Photographer getPhotographer(@NotNull String id);
+
+ @Nullable
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location);
+
+ @Nullable
+ public Photographer createPhotographer(@NotNull String id, @NotNull Location location, @NotNull BukkitRecorderOption recorderOption);
+
+ public void removePhotographer(@NotNull String id);
+
+ public void removePhotographer(@NotNull UUID uuid);
+
+ public void removeAllPhotographers();
+
+ public Collection<Photographer> getPhotographers();
+}
\ No newline at end of file
diff --git a/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java b/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java
new file mode 100644
index 0000000000000000000000000000000000000000..c985721bdf6be0b8a154e7abfd50e0168965a8d1
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/replay/BukkitRecorderOption.java
@@ -0,0 +1,18 @@
+package org.leavesmc.leaves.replay;
+
+public class BukkitRecorderOption {
+
+ // public int recordDistance = -1;
+ public String serverName = "Leaf";
+ public BukkitRecordWeather forceWeather = BukkitRecordWeather.NULL;
+ public int forceDayTime = -1;
+ public boolean ignoreChat = false;
+ // public boolean ignoreItem = false;
+
+ public enum BukkitRecordWeather {
+ CLEAR,
+ RAIN,
+ THUNDER,
+ NULL
+ }
+}
\ No newline at end of file

View File

@@ -1,100 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Tue, 26 Sep 2023 19:00:41 +0800
Subject: [PATCH] Leaves: Protocol Core
TODO: Check whether Leaves's Return-nether-portal-fix.patch improves performance
and change store way to sql maybe?
Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
Commit: 99b3aafce1f162c68a771fe56d77f33648636b7d
diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
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 {
@Override
public void encode(B buffer, CustomPacketPayload value) {
+ // Leaves start - protocol core
+ if (value instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload<?> payload) {
+ buffer.writeResourceLocation(payload.id());
+ payload.write(buffer);
+ return;
+ }
+ // Leaves end - protocol core
this.writeCap(buffer, value.type(), value);
}
@Override
public CustomPacketPayload decode(B buffer) {
ResourceLocation resourceLocation = buffer.readResourceLocation();
- return (CustomPacketPayload)this.findCodec(resourceLocation).decode(buffer);
+ // Leaves start - protocol core
+ 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/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 047a09cf4a2c32e714aacedeccb0928ef2c7dfa9..dddbb18992348fb7e8a6552423d134809cd7fdbc 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1747,6 +1747,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
GameTestTicker.SINGLETON.tick();
}
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol
+
for (int i = 0; i < this.tickables.size(); i++) {
this.tickables.get(i).run();
}
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 921ad69b699f693e3dfc8d912b0f1a05d8f81743..285af1576d6bef09f094b7e990b5bcd6eafda71f 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -151,6 +151,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
+ // Leaves start - protocol
+ if (packet.payload() instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload<?> leavesPayload) {
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePayload(player, leavesPayload);
+ }
+ // Leaves end - protocol
// Paper start
if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload(String brand)) {
this.player.clientBrandName = brand;
@@ -210,6 +215,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
final String channel = new String(data, from, length, java.nio.charset.StandardCharsets.US_ASCII);
if (register) {
this.getCraftPlayer().addChannel(channel);
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleMinecraftRegister(channel, player); // Leaves - protocol
} else {
this.getCraftPlayer().removeChannel(channel);
}
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 9a2f2dc1eb471776de6049590cb16e8a061aa24e..e0dbafdbf36ab8597827ac7a828981013ec16bde 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -341,6 +341,8 @@ public abstract class PlayerList {
player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
+
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
@@ -518,6 +520,7 @@ public abstract class PlayerList {
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())));
}
public net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
+ 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
ServerLevel serverLevel = player.serverLevel();

View File

@@ -1,29 +0,0 @@
package org.leavesmc.leaves.protocol.core;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
public interface LeavesCustomPayload<T extends LeavesCustomPayload<T>> extends CustomPacketPayload {
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.RUNTIME)
@interface New {
}
void write(FriendlyByteBuf buf);
ResourceLocation id();
@Override
@NotNull
default Type<T> type() {
return new CustomPacketPayload.Type<>(id());
}
}

View File

@@ -1,12 +0,0 @@
package org.leavesmc.leaves.protocol.core;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface LeavesProtocol {
String[] namespace();
}

View File

@@ -1,379 +0,0 @@
package org.leavesmc.leaves.protocol.core;
import com.google.common.collect.ImmutableSet;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.event.player.PlayerKickEvent;
import org.jetbrains.annotations.NotNull;
import org.leavesmc.leaves.LeavesLogger;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class LeavesProtocolManager {
private static final Class<?>[] PAYLOAD_PARAMETER_TYPES = {ResourceLocation.class, FriendlyByteBuf.class};
private static final LeavesLogger LOGGER = LeavesLogger.LOGGER;
private static final Map<LeavesProtocol, Map<ProtocolHandler.PayloadReceiver, Executable>> KNOWN_TYPES = new HashMap<>();
private static final Map<LeavesProtocol, Map<ProtocolHandler.PayloadReceiver, Method>> KNOW_RECEIVERS = new HashMap<>();
private static Set<ResourceLocation> ALL_KNOWN_ID = new HashSet<>();
private static final List<Method> TICKERS = new ArrayList<>();
private static final List<Method> PLAYER_JOIN = new ArrayList<>();
private static final List<Method> PLAYER_LEAVE = new ArrayList<>();
private static final List<Method> RELOAD_SERVER = new ArrayList<>();
private static final Map<LeavesProtocol, Map<ProtocolHandler.MinecraftRegister, Method>> MINECRAFT_REGISTER = new HashMap<>();
public static void reload() {
handleServerReload();
cleanProtocols(); // Do cleanup
init();
}
public static void init() {
boolean shouldEnable;
for (Class<?> clazz : org.dreeam.leaf.config.LeafConfig.getClasses("org.leavesmc.leaves.protocol")) {
final LeavesProtocol protocol = clazz.getAnnotation(LeavesProtocol.class);
if (protocol != null) {
Set<Method> methods;
try {
Method[] publicMethods = clazz.getMethods();
Method[] privateMethods = clazz.getDeclaredMethods();
methods = new HashSet<>(publicMethods.length + privateMethods.length, 1.0f);
Collections.addAll(methods, publicMethods);
Collections.addAll(methods, privateMethods);
Object instance = clazz.getConstructor().newInstance();
Method method = clazz.getMethod("shouldEnable");
shouldEnable = (boolean) method.invoke(instance);
} catch (NoClassDefFoundError | InvocationTargetException | InstantiationException |
IllegalAccessException | NoSuchMethodException error) {
LOGGER.severe("Failed to load class " + clazz.getName() + " due to missing dependencies, " + error.getCause() + ": " + error.getMessage());
return;
}
Map<ProtocolHandler.PayloadReceiver, Executable> map = KNOWN_TYPES.getOrDefault(protocol, new HashMap<>());
for (final Method method : methods) {
if (method.isBridge() || method.isSynthetic() || !Modifier.isStatic(method.getModifiers())) {
continue;
}
method.setAccessible(true);
final ProtocolHandler.ReloadServer reloadServer = method.getAnnotation(ProtocolHandler.ReloadServer.class);
if (reloadServer != null) {
RELOAD_SERVER.add(method);
continue;
}
if (!shouldEnable) {
continue;
}
final ProtocolHandler.Init init = method.getAnnotation(ProtocolHandler.Init.class);
if (init != null) {
try {
method.invoke(null);
} catch (InvocationTargetException | IllegalAccessException exception) {
LOGGER.severe("Failed to invoke init method " + method.getName() + " in " + clazz.getName() + ", " + exception.getCause() + ": " + exception.getMessage());
}
continue;
}
final ProtocolHandler.PayloadReceiver receiver = method.getAnnotation(ProtocolHandler.PayloadReceiver.class);
if (receiver != null) {
try {
boolean found = false;
for (Method payloadMethod : receiver.payload().getDeclaredMethods()) {
if (payloadMethod.isAnnotationPresent(LeavesCustomPayload.New.class)) {
if (Arrays.equals(payloadMethod.getParameterTypes(), PAYLOAD_PARAMETER_TYPES) && payloadMethod.getReturnType() == receiver.payload() && Modifier.isStatic(payloadMethod.getModifiers())) {
payloadMethod.setAccessible(true);
map.put(receiver, payloadMethod);
found = true;
break;
}
}
}
if (!found) {
Constructor<? extends LeavesCustomPayload<?>> constructor = receiver.payload().getConstructor(PAYLOAD_PARAMETER_TYPES);
if (constructor.isAnnotationPresent(LeavesCustomPayload.New.class)) {
constructor.setAccessible(true);
map.put(receiver, constructor);
} else {
throw new NoSuchMethodException();
}
}
} catch (NoSuchMethodException exception) {
LOGGER.severe("Failed to find constructor for " + receiver.payload().getName() + ", " + exception.getCause() + ": " + exception.getMessage());
continue;
}
if (!KNOW_RECEIVERS.containsKey(protocol)) {
KNOW_RECEIVERS.put(protocol, new HashMap<>());
}
KNOW_RECEIVERS.get(protocol).put(receiver, method);
continue;
}
final ProtocolHandler.Ticker ticker = method.getAnnotation(ProtocolHandler.Ticker.class);
if (ticker != null) {
TICKERS.add(method);
continue;
}
final ProtocolHandler.PlayerJoin playerJoin = method.getAnnotation(ProtocolHandler.PlayerJoin.class);
if (playerJoin != null) {
PLAYER_JOIN.add(method);
continue;
}
final ProtocolHandler.PlayerLeave playerLeave = method.getAnnotation(ProtocolHandler.PlayerLeave.class);
if (playerLeave != null) {
PLAYER_LEAVE.add(method);
continue;
}
final ProtocolHandler.MinecraftRegister minecraftRegister = method.getAnnotation(ProtocolHandler.MinecraftRegister.class);
if (minecraftRegister != null) {
if (!MINECRAFT_REGISTER.containsKey(protocol)) {
MINECRAFT_REGISTER.put(protocol, new HashMap<>());
}
MINECRAFT_REGISTER.get(protocol).put(minecraftRegister, method);
}
}
KNOWN_TYPES.put(protocol, map);
}
}
for (LeavesProtocol protocol : KNOWN_TYPES.keySet()) {
Map<ProtocolHandler.PayloadReceiver, Executable> map = KNOWN_TYPES.get(protocol);
for (ProtocolHandler.PayloadReceiver receiver : map.keySet()) {
if (receiver.sendFabricRegister() && !receiver.ignoreId()) {
for (String payloadId : receiver.payloadId()) {
for (String namespace : protocol.namespace()) {
ALL_KNOWN_ID.add(ResourceLocation.tryBuild(namespace, payloadId));
}
}
}
}
}
ALL_KNOWN_ID = ImmutableSet.copyOf(ALL_KNOWN_ID);
}
private static void cleanProtocols() {
KNOWN_TYPES.clear();
KNOW_RECEIVERS.clear();
//ALL_KNOWN_ID.clear(); // No need
TICKERS.clear();
PLAYER_JOIN.clear();
PLAYER_LEAVE.clear();
//RELOAD_SERVER.clear(); // No need
MINECRAFT_REGISTER.clear();
}
public static LeavesCustomPayload<?> decode(ResourceLocation id, FriendlyByteBuf buf) {
for (LeavesProtocol protocol : KNOWN_TYPES.keySet()) {
if (!ArrayUtils.contains(protocol.namespace(), id.getNamespace())) {
continue;
}
Map<ProtocolHandler.PayloadReceiver, Executable> map = KNOWN_TYPES.get(protocol);
for (ProtocolHandler.PayloadReceiver receiver : map.keySet()) {
if (receiver.ignoreId() || ArrayUtils.contains(receiver.payloadId(), id.getPath())) {
try {
if (map.get(receiver) instanceof Constructor<?> constructor) {
return (LeavesCustomPayload<?>) constructor.newInstance(id, buf);
} else if (map.get(receiver) instanceof Method method) {
return (LeavesCustomPayload<?>) method.invoke(null, id, buf);
}
} catch (InvocationTargetException | InstantiationException | IllegalAccessException exception) {
LOGGER.warning("Failed to create payload for " + id + " in " + ArrayUtils.toString(protocol.namespace()) + ", " + exception.getCause() + ": " + exception.getMessage());
buf.readBytes(buf.readableBytes());
return new ErrorPayload(id, protocol.namespace(), receiver.payloadId());
}
}
}
}
return null;
}
public static void handlePayload(ServerPlayer player, LeavesCustomPayload<?> payload) {
if (payload instanceof ErrorPayload errorPayload) {
player.connection.disconnect(Component.literal("Payload " + Arrays.toString(errorPayload.packetID) + " from " + Arrays.toString(errorPayload.protocolID) + " error"), PlayerKickEvent.Cause.INVALID_PAYLOAD);
return;
}
for (LeavesProtocol protocol : KNOW_RECEIVERS.keySet()) {
if (!ArrayUtils.contains(protocol.namespace(), payload.type().id().getNamespace())) {
continue;
}
Map<ProtocolHandler.PayloadReceiver, Method> map = KNOW_RECEIVERS.get(protocol);
for (ProtocolHandler.PayloadReceiver receiver : map.keySet()) {
if (payload.getClass() == receiver.payload()) {
if (receiver.ignoreId() || ArrayUtils.contains(receiver.payloadId(), payload.type().id().getPath())) {
try {
map.get(receiver).invoke(null, player, payload);
} catch (InvocationTargetException | IllegalAccessException exception) {
LOGGER.warning("Failed to handle payload " + payload.type().id() + " in " + ArrayUtils.toString(protocol.namespace()) + ", " + exception.getCause() + ": " + exception.getMessage());
}
}
}
}
}
}
public static void handleTick() {
if (!TICKERS.isEmpty()) {
try {
for (Method method : TICKERS) {
method.invoke(null);
}
} catch (InvocationTargetException | IllegalAccessException exception) {
LOGGER.warning("Failed to tick, " + exception.getCause() + ": " + exception.getMessage());
}
}
}
public static void handlePlayerJoin(ServerPlayer player) {
if (!PLAYER_JOIN.isEmpty()) {
try {
for (Method method : PLAYER_JOIN) {
method.invoke(null, player);
}
} catch (InvocationTargetException | IllegalAccessException exception) {
LOGGER.warning("Failed to handle player join, " + exception.getCause() + ": " + exception.getMessage());
}
}
ProtocolUtils.sendPayloadPacket(player, new FabricRegisterPayload(ALL_KNOWN_ID));
}
public static void handlePlayerLeave(ServerPlayer player) {
if (!PLAYER_LEAVE.isEmpty()) {
try {
for (Method method : PLAYER_LEAVE) {
method.invoke(null, player);
}
} catch (InvocationTargetException | IllegalAccessException exception) {
LOGGER.warning("Failed to handle player leave, " + exception.getCause() + ": " + exception.getMessage());
}
}
}
public static void handleServerReload() {
if (!RELOAD_SERVER.isEmpty()) {
try {
for (Method method : RELOAD_SERVER) {
method.invoke(null);
}
} catch (InvocationTargetException | IllegalAccessException exception) {
LOGGER.warning("Failed to handle server reload, " + exception.getCause() + ": " + exception.getMessage());
}
}
}
public static void handleMinecraftRegister(String channelId, ServerPlayer player) {
for (LeavesProtocol protocol : MINECRAFT_REGISTER.keySet()) {
String[] channel = channelId.split(":");
if (!ArrayUtils.contains(protocol.namespace(), channel[0])) {
continue;
}
Map<ProtocolHandler.MinecraftRegister, Method> map = MINECRAFT_REGISTER.get(protocol);
for (ProtocolHandler.MinecraftRegister register : map.keySet()) {
if (register.ignoreId() || ArrayUtils.contains(register.channelId(), channel[1])) {
try {
map.get(register).invoke(null, player, channel[1]);
} catch (InvocationTargetException | IllegalAccessException exception) {
LOGGER.warning("Failed to handle minecraft register, " + exception.getCause() + ": " + exception.getMessage());
}
}
}
}
}
public record ErrorPayload(ResourceLocation id, String[] protocolID,
String[] packetID) implements LeavesCustomPayload<ErrorPayload> {
@Override
public void write(@NotNull FriendlyByteBuf buf) {
}
}
public record EmptyPayload(ResourceLocation id) implements LeavesCustomPayload<EmptyPayload> {
@New
public EmptyPayload(ResourceLocation location, FriendlyByteBuf buf) {
this(location);
}
@Override
public void write(@NotNull FriendlyByteBuf buf) {
}
}
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);
}
@Override
public void write(FriendlyByteBuf buf) {
buf.writeBytes(data);
}
}
public record FabricRegisterPayload(
Set<ResourceLocation> channels) implements LeavesCustomPayload<FabricRegisterPayload> {
public static final ResourceLocation CHANNEL = ResourceLocation.withDefaultNamespace("register");
@New
public FabricRegisterPayload(ResourceLocation location, FriendlyByteBuf buf) {
this(buf.readCollection(HashSet::new, FriendlyByteBuf::readResourceLocation));
}
@Override
public void write(FriendlyByteBuf buf) {
boolean first = true;
ResourceLocation channel;
for (Iterator<ResourceLocation> var3 = this.channels.iterator(); var3.hasNext(); buf.writeBytes(channel.toString().getBytes(StandardCharsets.US_ASCII))) {
channel = var3.next();
if (first) {
first = false;
} else {
buf.writeByte(0);
}
}
}
@Override
public ResourceLocation id() {
return CHANNEL;
}
}
}

View File

@@ -1,35 +0,0 @@
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));
}
}

View File

@@ -1,63 +0,0 @@
package org.leavesmc.leaves.protocol.jade.provider.block;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentSerialization;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.Nameable;
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.block.state.properties.ChestType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
import org.leavesmc.leaves.protocol.jade.accessor.BlockAccessor;
import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider;
public abstract class ObjectNameProvider implements StreamServerDataProvider<BlockAccessor, Component> {
private static final ResourceLocation CORE_OBJECT_NAME = JadeProtocol.id("object_name");
public static class ForBlock extends ObjectNameProvider implements StreamServerDataProvider<BlockAccessor, Component> {
public static final ForBlock INSTANCE = new ForBlock();
@Override
@Nullable
public Component streamData(@NotNull BlockAccessor accessor) {
if (!(accessor.getBlockEntity() instanceof Nameable nameable)) {
return null;
}
if (nameable instanceof ChestBlockEntity && accessor.getBlock() instanceof ChestBlock && accessor.getBlockState().getValue(ChestBlock.TYPE) != ChestType.SINGLE) {
MenuProvider menuProvider = accessor.getBlockState().getMenuProvider(accessor.getLevel(), accessor.getPosition());
if (menuProvider != null) {
Component name = menuProvider.getDisplayName();
if (!(name.getContents() instanceof TranslatableContents contents) || !"container.chestDouble".equals(contents.getKey())) {
return name;
}
}
} else if (nameable.hasCustomName()) {
return nameable.getDisplayName();
}
return accessor.getBlockEntity().components().get(DataComponents.ITEM_NAME);
}
@Override
public StreamCodec<RegistryFriendlyByteBuf, Component> streamCodec() {
return ComponentSerialization.STREAM_CODEC;
}
}
@Override
public ResourceLocation getUid() {
return CORE_OBJECT_NAME;
}
@Override
public int getDefaultPriority() {
return -10100;
}
}

View File

@@ -1,32 +0,0 @@
package org.leavesmc.leaves.protocol.jade.tool;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
import java.util.List;
public class ShearsToolHandler extends SimpleToolHandler {
private static final ShearsToolHandler INSTANCE = new ShearsToolHandler();
public static ShearsToolHandler getInstance() {
return INSTANCE;
}
public ShearsToolHandler() {
super(JadeProtocol.id("shears"), List.of(Items.SHEARS.getDefaultInstance()), true);
}
@Override
public ItemStack test(BlockState state, Level world, BlockPos pos) {
if (state.is(Blocks.TRIPWIRE)) {
return tools.getFirst();
}
return super.test(state, world, pos);
}
}

View File

@@ -1,71 +0,0 @@
package org.leavesmc.leaves.protocol.jade.tool;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import net.minecraft.core.BlockPos;
import net.minecraft.core.component.DataComponents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.component.Tool;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class SimpleToolHandler implements ToolHandler {
protected final List<ItemStack> tools = Lists.newArrayList();
private final ResourceLocation uid;
private final boolean skipInstaBreakingBlock;
protected SimpleToolHandler(ResourceLocation uid, @NotNull List<ItemStack> tools, boolean skipInstaBreakingBlock) {
this.uid = uid;
Preconditions.checkArgument(!tools.isEmpty(), "tools cannot be empty");
this.tools.addAll(tools);
this.skipInstaBreakingBlock = skipInstaBreakingBlock;
}
@Contract("_, _ -> new")
public static @NotNull SimpleToolHandler create(ResourceLocation uid, List<Item> tools) {
return create(uid, tools, true);
}
@Contract("_, _, _ -> new")
public static @NotNull SimpleToolHandler create(ResourceLocation uid, List<Item> tools, boolean skipInstaBreakingBlock) {
return new SimpleToolHandler(uid, Lists.transform(tools, Item::getDefaultInstance), skipInstaBreakingBlock);
}
@Override
public ItemStack test(BlockState state, Level world, BlockPos pos) {
if (skipInstaBreakingBlock && !state.requiresCorrectToolForDrops() && state.getDestroySpeed(world, pos) == 0) {
return ItemStack.EMPTY;
}
return test(state);
}
public ItemStack test(BlockState state) {
for (ItemStack toolItem : tools) {
if (toolItem.isCorrectToolForDrops(state)) {
return toolItem;
}
Tool tool = toolItem.get(DataComponents.TOOL);
if (tool != null && tool.getMiningSpeed(state) > tool.defaultMiningSpeed()) {
return toolItem;
}
}
return ItemStack.EMPTY;
}
@Override
public List<ItemStack> getTools() {
return tools;
}
@Override
public ResourceLocation getUid() {
return uid;
}
}

View File

@@ -1,17 +0,0 @@
package org.leavesmc.leaves.protocol.jade.tool;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import org.leavesmc.leaves.protocol.jade.provider.IJadeProvider;
import java.util.List;
public interface ToolHandler extends IJadeProvider {
ItemStack test(BlockState state, Level world, BlockPos pos);
List<ItemStack> getTools();
}

View File

@@ -1,27 +0,0 @@
package org.leavesmc.leaves.protocol.syncmatica;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
public record SyncmaticaPayload(ResourceLocation packetType,
FriendlyByteBuf data) implements LeavesCustomPayload<SyncmaticaPayload> {
private static final ResourceLocation NETWORK_ID = ResourceLocation.tryBuild(SyncmaticaProtocol.PROTOCOL_ID, "main");
@New
public static SyncmaticaPayload decode(ResourceLocation location, FriendlyByteBuf buf) {
return new SyncmaticaPayload(buf.readResourceLocation(), new FriendlyByteBuf(buf.readBytes(buf.readableBytes())));
}
@Override
public void write(FriendlyByteBuf buf) {
buf.writeResourceLocation(this.packetType);
buf.writeBytes(this.data.readBytes(this.data.readableBytes()));
}
@Override
public ResourceLocation id() {
return NETWORK_ID;
}
}

View File

@@ -0,0 +1,154 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Tue, 26 Sep 2023 19:00:41 +0800
Subject: [PATCH] Leaves: Protocol Core
TODO: Check whether Leaves's Return-nether-portal-fix.patch improves performance
and change store way to sql maybe?
Original license: GPLv3
Original project: https://github.com/LeavesMC/Leaves
Commit: 358d3d232c88d0d089e2bcd2de9f814384572b8b
diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..56fd1ed7ccaf96e7eedea60fbdbf7f934939d563 100644
--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
+++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
@@ -40,13 +40,22 @@ public interface CustomPacketPayload {
@Override
public void encode(B buffer, CustomPacketPayload value) {
+ // Leaves start - protocol core
+ if (value instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload payload) {
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.encode(buffer, payload);
+ return;
+ }
+ // Leaves end - protocol core
this.writeCap(buffer, value.type(), value);
}
@Override
public CustomPacketPayload decode(B buffer) {
ResourceLocation resourceLocation = buffer.readResourceLocation();
- return (CustomPacketPayload)this.findCodec(resourceLocation).decode(buffer);
+ // Leaves start - protocol core
+ 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/network/protocol/common/custom/DiscardedPayload.java b/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
index 62b9d9486c15a1ec6527f786df4e9fc483390bcb..5384bbc6bb3dbe5481f9d8cb10282551a0f78ec1 100644
--- a/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
+++ b/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
@@ -4,12 +4,12 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;
-public record DiscardedPayload(ResourceLocation id, byte[] data) implements CustomPacketPayload { // Paper - store data
+public record DiscardedPayload(ResourceLocation id, byte @org.jetbrains.annotations.Nullable [] data) implements CustomPacketPayload { // Paper - store data // Leaves - nullable
public static <T extends FriendlyByteBuf> StreamCodec<T, DiscardedPayload> codec(ResourceLocation id, int maxSize) {
return CustomPacketPayload.codec((value, output) -> {
// Paper start
// Always write data
- output.writeBytes(value.data);
+ if (value.data != null) output.writeBytes(value.data); // Leaves - nullable
}, buffer -> {
int i = buffer.readableBytes();
if (i >= 0 && i <= maxSize) {
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 3190ed2171b0de32aeb8761aa3e510c968c45448..58c52eabba725be9fa5fde06be5cf69d0281ce5b 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1735,6 +1735,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
GameTestTicker.SINGLETON.tick();
}
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(tickCount); // Leaves - protocol
+
for (int i = 0; i < this.tickables.size(); i++) {
this.tickables.get(i).run();
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 5775a39220bb5f48e2ce01c51402ac8b194a8d9d..f3fb661e2cbf8119264d113a06bcb7bb5150be91 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -429,6 +429,8 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder viewDistanceHolder = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder();
+ public net.minecraft.network.Connection internalConnection; // Leaves - protocol core
+
@Override
public final boolean moonrise$isRealPlayer() {
return this.isRealPlayer;
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index d2e8adccf33c6b842fac615006b782b09cfa7a1a..4d48ffeecba7fc4b53dad5f0a4d9c1bb8eac50c1 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -151,6 +151,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
+ // Leaves start - protocol
+ if (packet.payload() instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload leavesPayload) {
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePayload(player, leavesPayload);
+ return;
+ }
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.DiscardedPayload(net.minecraft.resources.ResourceLocation id, byte[] data)) {
+ if (org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleBytebuf(player, id, io.netty.buffer.Unpooled.wrappedBuffer(data))) {
+ return;
+ }
+ }
+ // Leaves end - protocol
+
// Paper start
if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload(String brand)) {
this.player.clientBrandName = brand;
@@ -210,6 +222,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
final String channel = new String(data, from, length, java.nio.charset.StandardCharsets.US_ASCII);
if (register) {
this.getCraftPlayer().addChannel(channel);
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleMinecraftRegister(channel, player); // Leaves - protocol
} else {
this.getCraftPlayer().removeChannel(channel);
}
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index d7d68dbdd39ff6e61531d2edeafdd923f0573c89..5cdfd7b0170ad1dff67802cd7b4d59753b7067b8 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -345,6 +345,8 @@ public abstract class PlayerList {
player.didPlayerJoinEvent = true; // Gale - EMC - do not process chat/commands before player has joined
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
+
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
@@ -522,6 +524,7 @@ public abstract class PlayerList {
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())));
}
public @Nullable net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
+ 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
ServerLevel serverLevel = player.serverLevel();
@@ -648,6 +651,7 @@ public abstract class PlayerList {
SocketAddress socketAddress = loginlistener.connection.getRemoteAddress();
ServerPlayer entity = new ServerPlayer(this.server, this.server.getLevel(Level.OVERWORLD), gameProfile, ClientInformation.createDefault());
+ entity.internalConnection = loginlistener.connection; // Leaves - protocol core
entity.transferCookieConnection = loginlistener;
org.bukkit.entity.Player player = entity.getBukkitEntity();
org.bukkit.event.player.PlayerLoginEvent event = new org.bukkit.event.player.PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketAddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());
@@ -1527,6 +1531,7 @@ public abstract class PlayerList {
serverPlayer.connection.send(clientboundUpdateRecipesPacket);
serverPlayer.getRecipeBook().sendInitialRecipeBook(serverPlayer);
}
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleDataPackReload(); // Leaves - protocol core
}
public boolean isAllowCommandsForAllPlayers() {

View File

@@ -9,10 +9,10 @@ Original project: https://github.com/LeavesMC/Leaves
This patch is Powered by Jade (https://github.com/Snownee/Jade)
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
index a24ed1747fb8836927ac41b822dc666862701516..d840577023d42dc986e2b811382dfc433083ffb3 100644
index aea96e036846c66d411fdea55fbbf0efb60d467d..fb8a56d0ee80b0d397f2acd3af1f52fc26676b62 100644
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -59,7 +59,7 @@ public class Armadillo extends Animal {
@@ -60,7 +60,7 @@ public class Armadillo extends Animal {
public final AnimationState rollOutAnimationState = new AnimationState();
public final AnimationState rollUpAnimationState = new AnimationState();
public final AnimationState peekAnimationState = new AnimationState();
@@ -22,10 +22,10 @@ index a24ed1747fb8836927ac41b822dc666862701516..d840577023d42dc986e2b811382dfc43
public Armadillo(EntityType<? extends Animal> entityType, Level level) {
diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java
index ec9db1c12426db80dbf02d704e6c7ec867d59f6f..0fdda6b24aee95170e54079e53125b4aed19ac0b 100644
index 7a3bfa91ffc5c7c6b04eef7b1b1d3c04c5a6d856..07fd03f1a8e72a5b39e5f9fd13f401dbfdb45280 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -285,7 +285,7 @@ public class Tadpole extends AbstractFish {
@@ -284,7 +284,7 @@ public class Tadpole extends AbstractFish {
}
}
@@ -48,11 +48,11 @@ index 29ad43245a310756c4227acd7532e905f7f8b8ee..ad422817593449b8e914628b51d760e7
private final Predicate<LootContext> compositeCondition;
private final List<LootItemFunction> functions;
diff --git a/net/minecraft/world/level/storage/loot/LootTable.java b/net/minecraft/world/level/storage/loot/LootTable.java
index dd646b11ef0a40e7f782742e62ccccfa9bcfd235..c9820777342124524c046d910085b1bf89c12488 100644
index 7a8eb1e8b07647e1124594f78652d34731e4fda6..6cfe7ef8c81f506bce9c971b597cc4e902bcabbe 100644
--- a/net/minecraft/world/level/storage/loot/LootTable.java
+++ b/net/minecraft/world/level/storage/loot/LootTable.java
@@ -45,7 +45,7 @@ public class LootTable {
public static final Codec<Holder<LootTable>> CODEC = RegistryFileCodec.create(Registries.LOOT_TABLE, DIRECT_CODEC);
@@ -49,7 +49,7 @@ public class LootTable {
public static final LootTable EMPTY = new LootTable(LootContextParamSets.EMPTY, Optional.empty(), List.of(), List.of());
private final ContextKeySet paramSet;
private final Optional<ResourceLocation> randomSequence;
- private final List<LootPool> pools;
@@ -87,10 +87,10 @@ index e0e933245e038b7229eeddbda272b081161ab603..c5e3834fa970ac909cefea4342037839
protected LootPoolEntryContainer(List<LootItemCondition> conditions) {
diff --git a/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java b/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java
index d5e697a0cf6091a7f37c68e3c2a52851535735b1..a8a5a872a8647896e80f91cb5a89adead4005cf7 100644
index f7b647e81ca99040bae8161a2bc0dcacf5bd537f..069df530b1db72bd4a2b1b80b2570dca545dfd20 100644
--- a/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java
+++ b/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java
@@ -25,7 +25,7 @@ public class NestedLootTable extends LootPoolSingletonContainer {
@@ -22,7 +22,7 @@ public class NestedLootTable extends LootPoolSingletonContainer {
.and(singletonFields(instance))
.apply(instance, NestedLootTable::new)
);

View File

@@ -9,10 +9,10 @@ Original project: https://github.com/LeavesMC/Leaves
This patch is Powered by Xaero Map
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 924faf76763588fb41b8aee53236ccb05b1239b1..e3d09d5f4efb32bb276e001e5ee747a775b502ee 100644
index 5cdfd7b0170ad1dff67802cd7b4d59753b7067b8..b7c1d4c66d3ea23288e9e6ba9cb20122730f8869 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -1222,6 +1222,7 @@ public abstract class PlayerList {
@@ -1238,6 +1238,7 @@ public abstract class PlayerList {
player.connection.send(new ClientboundInitializeBorderPacket(worldBorder));
player.connection.send(new ClientboundSetTimePacket(level.getGameTime(), level.getDayTime(), level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(level.getSharedSpawnPos(), level.getSharedSpawnAngle()));

View File

@@ -9,23 +9,18 @@ Original project: https://github.com/LeavesMC/Leaves
This patch is Powered by Syncmatica (https://github.com/End-Tech/syncmatica)
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 61bf3bfb41392d38c7e796f56cc0cce870e12631..543e7e278bb94c0bc996c377f8778df8a0b0440b 100644
index 44e96e867d8a4403a7c88f772d2aa60cbe9f516b..0bf9ead58e256dccd3c1e89bd08ebae9d630b49e 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -326,6 +326,7 @@ public class ServerGamePacketListenerImpl
@@ -319,8 +319,11 @@ public class ServerGamePacketListenerImpl
this.signedMessageDecoder = SignedMessageChain.Decoder.unsigned(player.getUUID(), server::enforceSecureProfile);
this.chatMessageChain = new FutureChain(server.chatExecutor); // CraftBukkit - async chat
this.tickEndEvent = new io.papermc.paper.event.packet.ClientTickEndEvent(player.getBukkitEntity()); // Paper - add client tick end event
+ this.exchangeTarget = new org.leavesmc.leaves.protocol.syncmatica.exchange.ExchangeTarget(this); // Leaves - Syncmatica Protocol
}
// Purpur start - AFK API
@@ -342,6 +343,8 @@ public class ServerGamePacketListenerImpl
);
// Purpur end - AFK API
+ public final org.leavesmc.leaves.protocol.syncmatica.exchange.ExchangeTarget exchangeTarget; // Leaves - Syncmatica Protocol
+
@Override
public void tick() {
if (this.ackBlockChangesUpTo > -1) {
// Purpur start - AFK API
private final com.google.common.cache.LoadingCache<org.bukkit.craftbukkit.entity.CraftPlayer, Boolean> kickPermissionCache = com.google.common.cache.CacheBuilder.newBuilder()
.maximumSize(1000)

View File

@@ -11,10 +11,10 @@ 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..e654387167cf3e9a88f0e62be940fe398387cffa 100644
index 4d06587cd55af988eecdda5186577ab72ca3d533..6d1096d6cdf0ae23ab4cacabe4dbe531fea455a7 100644
--- a/net/minecraft/commands/CommandSourceStack.java
+++ b/net/minecraft/commands/CommandSourceStack.java
@@ -626,7 +626,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@@ -625,7 +625,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@Override
public Collection<String> getOnlinePlayerNames() {
@@ -24,7 +24,7 @@ index 59c70c567051bc7dba0d308387352d1b15f3c842..e654387167cf3e9a88f0e62be940fe39
@Override
diff --git a/net/minecraft/commands/arguments/selector/EntitySelector.java b/net/minecraft/commands/arguments/selector/EntitySelector.java
index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..c9b4f00d5ccde83898ecf69efdbfee7a3f91b96d 100644
index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..853933618e67d7597c23b3099ea7a7a105c0483e 100644
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -128,11 +128,12 @@ public class EntitySelector {
@@ -37,7 +37,7 @@ index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..c9b4f00d5ccde83898ecf69efdbfee7a
for (ServerLevel serverLevel : source.getServer().getAllLevels()) {
Entity entity = serverLevel.getEntity(this.entityUUID);
- if (entity != null) {
+ if (entity != null && !(entity instanceof org.leavesmc.leaves.replay.ServerPhotographer)) { // Leaves - skip photographer
+ if (entity != null && !(entity instanceof org.leavesmc.leaves.replay.ServerPhotographer)) {
if (entity.getType().isEnabled(source.enabledFeatures())) {
return List.of(entity);
}
@@ -58,7 +58,7 @@ index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..c9b4f00d5ccde83898ecf69efdbfee7a
return this.sortAndLimit(vec3, list);
}
@@ -192,27 +194,30 @@ public class EntitySelector {
@@ -192,9 +194,11 @@ public class EntitySelector {
this.checkPermissions(source);
if (this.playerName != null) {
ServerPlayer playerByName = source.getServer().getPlayerList().getPlayerByName(this.playerName);
@@ -70,32 +70,27 @@ index b305ba9bab617bf4e52d0e6ddf160bacc5751a94..c9b4f00d5ccde83898ecf69efdbfee7a
return playerByName == null || !canSee(source, playerByName) ? List.of() : List.of(playerByName); // Purpur - Hide hidden players from entity selector
} else {
Vec3 vec3 = this.position.apply(source.getPosition());
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) && !(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 {
@@ -206,13 +210,13 @@ public class EntitySelector {
int resultLimit = this.getResultLimit();
List<ServerPlayer> players;
if (this.isWorldLimited()) {
players = source.getLevel().getPlayers(predicate, resultLimit);
- players.removeIf(entityplayer3 -> !canSee(source, entityplayer3)); // Purpur - Hide hidden players from entity selector
+ players.removeIf(entityplayer3 -> entityplayer3 instanceof org.leavesmc.leaves.replay.ServerPhotographer || !canSee(source, entityplayer3)); // Purpur - Hide hidden players from entity selector // Leaves - skip photographer
- players = source.getLevel().getPlayers(predicate, resultLimit);
+ players = source.getLevel().getPlayers((player -> !(player instanceof org.leavesmc.leaves.replay.ServerPhotographer) && predicate.test(player)), resultLimit); // Leaves - skip photographer
players.removeIf(entityplayer3 -> !canSee(source, entityplayer3)); // Purpur - Hide hidden players from entity selector
} else {
players = new ObjectArrayList<>();
for (ServerPlayer serverPlayer1 : source.getServer().getPlayerList().getPlayers()) {
- if (predicate.test(serverPlayer1) && canSee(source, serverPlayer1)) { // Purpur - Hide hidden players from entity selector
+ if (!(serverPlayer1 instanceof org.leavesmc.leaves.replay.ServerPhotographer) && predicate.test(serverPlayer1) && canSee(source, serverPlayer1)) { // Purpur - Hide hidden players from entity selector // Leaves - skip photographer
+ if (predicate.test(serverPlayer1) && canSee(source, serverPlayer1) && !(serverPlayer1 instanceof org.leavesmc.leaves.replay.ServerPhotographer)) { // Purpur - Hide hidden players from entity selector // Leaves - skip photographer
players.add(serverPlayer1);
if (players.size() >= resultLimit) {
return players;
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index dddbb18992348fb7e8a6552423d134809cd7fdbc..0e6e71030e3fd1335fff796b861524a48cb0a507 100644
index 58c52eabba725be9fa5fde06be5cf69d0281ce5b..83cbf865d83edcb4caea59a1a2b4932a915414be 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1650,7 +1650,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1638,7 +1638,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
private ServerStatus.Players buildPlayerStatus() {
@@ -105,7 +100,7 @@ index dddbb18992348fb7e8a6552423d134809cd7fdbc..0e6e71030e3fd1335fff796b861524a4
if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(maxPlayers, players.size(), List.of());
diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java
index abccabb8a0a1a9730b7df070dd25f3ca215af362..0a4bcc4c44fed2ededafaf0641315e072b7ba771 100644
index edf115439c630a4471460db02109bbce7868de81..c7e92f0122823d9e1aa471c5c0e995d1e1d90184 100644
--- a/net/minecraft/server/PlayerAdvancements.java
+++ b/net/minecraft/server/PlayerAdvancements.java
@@ -168,6 +168,11 @@ public class PlayerAdvancements {
@@ -121,7 +116,7 @@ index abccabb8a0a1a9730b7df070dd25f3ca215af362..0a4bcc4c44fed2ededafaf0641315e07
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..cd153db93f709c3142942fac88ae3ca2226a65b3 100644
index 814bb2981ab32b216b7953e9b14fe09e96cc7c89..45f884bf598b38ec45baf423b84f52931cb019da 100644
--- a/net/minecraft/server/commands/OpCommand.java
+++ b/net/minecraft/server/commands/OpCommand.java
@@ -25,7 +25,7 @@ public class OpCommand {
@@ -134,18 +129,18 @@ index 5c0a04db38821dbb0cba2bb6f0787f113d167efd..cd153db93f709c3142942fac88ae3ca2
.filter(player -> !playerList.isOp(player.getGameProfile()))
.map(player -> player.getGameProfile().getName()),
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index b49dd636e730f0c5b609df68ee51bcd12efc1eaa..5e971bca365c692d4ce0c58693592002ce01471c 100644
index e6730996dfd4c2422b6c13f10309fc58af4ac595..9b193bf81cf7f9f45dfa207a826043e083c2f8ba 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -216,6 +216,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -212,6 +212,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
public boolean hasRidableMoveEvent = false; // Purpur - Ridables
+ final List<ServerPlayer> realPlayers; // Leaves - skip
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
@@ -700,6 +701,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public @Nullable LevelChunk getChunkIfLoaded(int x, int z) {
@@ -690,6 +691,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Paper end - rewrite chunk system
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle
@@ -153,7 +148,7 @@ index b49dd636e730f0c5b609df68ee51bcd12efc1eaa..5e971bca365c692d4ce0c58693592002
}
// Paper start
@@ -2698,6 +2700,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2690,6 +2692,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// ServerLevel.this.getChunkSource().addEntity(entity); // Paper - ignore and warn about illegal addEntity calls instead of crashing server; moved down below valid=true
if (entity instanceof ServerPlayer serverPlayer) {
ServerLevel.this.players.add(serverPlayer);
@@ -165,7 +160,7 @@ index b49dd636e730f0c5b609df68ee51bcd12efc1eaa..5e971bca365c692d4ce0c58693592002
ServerLevel.this.updateSleepingPlayerList();
}
@@ -2768,6 +2775,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2760,6 +2767,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
ServerLevel.this.getChunkSource().removeEntity(entity);
if (entity instanceof ServerPlayer serverPlayer) {
ServerLevel.this.players.remove(serverPlayer);
@@ -177,21 +172,8 @@ index b49dd636e730f0c5b609df68ee51bcd12efc1eaa..5e971bca365c692d4ce0c58693592002
ServerLevel.this.updateSleepingPlayerList();
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index d44c3baa2ef30d5cd4c46e491ff9198fa558513c..f89d28595fa9ca12e414f7b3cc86085ff0769e72 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -195,7 +195,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
);
public ServerGamePacketListenerImpl connection;
public final MinecraftServer server;
- public final ServerPlayerGameMode gameMode;
+ public ServerPlayerGameMode gameMode; // Leaves - final -> null
private final PlayerAdvancements advancements;
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 c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694aa71e20e3 100644
index b7c1d4c66d3ea23288e9e6ba9cb20122730f8869..f6bfd246571f9f7b25e4bdff66253a99a2e5a77f 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -132,6 +132,7 @@ public abstract class PlayerList {
@@ -230,7 +212,7 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
+ player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
+ playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
+ playerconnection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities()));
+ playerconnection.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected));
+ playerconnection.send(new ClientboundSetHeldSlotPacket(player.getInventory().getSelectedSlot()));
+ RecipeManager craftingmanager = this.server.getRecipeManager();
+ playerconnection.send(new ClientboundUpdateRecipesPacket(craftingmanager.getSynchronizedItemProperties(), craftingmanager.getSynchronizedStonecutterRecipes()));
+
@@ -279,7 +261,7 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
+
+ player.sentListPacket = true;
+ player.supressTrackerForLogin = false;
+ ((ServerLevel) player.level()).getChunkSource().chunkMap.addEntity(player);
+ ((ServerLevel)player.level()).getChunkSource().chunkMap.addEntity(player);
+
+ this.sendLevelInfo(player, worldserver1);
+
@@ -289,7 +271,7 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
+ }
+
+ worldserver1 = player.serverLevel();
+ java.util.Iterator<MobEffectInstance> iterator = player.getActiveEffects().iterator();
+ java.util.Iterator<net.minecraft.world.effect.MobEffectInstance> iterator = player.getActiveEffects().iterator();
+ while (iterator.hasNext()) {
+ MobEffectInstance mobeffect = iterator.next();
+ playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect, false));
@@ -297,10 +279,10 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
+
+ if (player.isDeadOrDying()) {
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> plains = worldserver1.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME)
+ .getOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS);
+ .getOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS);
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket(
+ new net.minecraft.world.level.chunk.EmptyLevelChunk(worldserver1, player.chunkPosition(), plains),
+ worldserver1.getLightEngine(), null, null, false)
+ new net.minecraft.world.level.chunk.EmptyLevelChunk(worldserver1, player.chunkPosition(), plains),
+ worldserver1.getLightEngine(), null, null, false)
+ );
+ }
+ }
@@ -309,7 +291,7 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie cookie) {
player.isRealPlayer = true; // Paper
player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
@@ -315,6 +416,7 @@ public abstract class PlayerList {
@@ -317,6 +418,7 @@ public abstract class PlayerList {
// player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below
this.players.add(player);
@@ -317,7 +299,7 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
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 +476,12 @@ public abstract class PlayerList {
@@ -378,6 +480,12 @@ public abstract class PlayerList {
continue;
}
@@ -330,7 +312,7 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
onlinePlayers.add(entityplayer1); // Paper - Use single player info update packet on join
}
// Paper start - Use single player info update packet on join
@@ -515,6 +623,43 @@ public abstract class PlayerList {
@@ -519,6 +627,43 @@ public abstract class PlayerList {
}
}
@@ -371,10 +353,10 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
+ }
+ // Leaves stop - replay mod api
+
public net.kyori.adventure.text.Component remove(ServerPlayer player) { // CraftBukkit - return string // Paper - return Component
public @Nullable 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 +736,7 @@ public abstract class PlayerList {
@@ -595,6 +740,7 @@ public abstract class PlayerList {
player.retireScheduler(); // Paper - Folia schedulers
player.getAdvancements().stopListening();
this.players.remove(player);
@@ -382,7 +364,7 @@ index c26bf04abe86b566e7f5cd29191a0a853f9808f8..4c172e2aee3e48d42009cd39b28f694a
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 +834,7 @@ public abstract class PlayerList {
@@ -687,7 +833,7 @@ public abstract class PlayerList {
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
// ? Component.translatable("multiplayer.disconnect.server_full")
// : null;

View File

@@ -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 3b814983b91165ecee1a15d24cc0352247316a9f..453d4babc78f5676cb9534a5d80967a6f8c5a263 100644
index a94f6eb93a4271d8b50cbb55dce04affd1ac4a13..9ac2ecb78f6214616376b0e3badef21dc3f72114 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -987,17 +987,19 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl

View File

@@ -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 40ab67a6930242553ed7acc9d6cc474a36e23888..ab7bdbce80046df43e4889c20c4d3d9fb1d2e2c4 100644
index ed15b5f29658d799a36dcbd196a8fcb107be4bda..09aa0b344aff0c48eec9a296d47c0704bd0fdc5c 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1387,7 +1387,8 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@@ -10,7 +10,7 @@ Add Pufferfish DAB support for Camel, Sniffer
https://github.com/pufferfish-gg/Pufferfish/issues/83
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
index aea96e036846c66d411fdea55fbbf0efb60d467d..3b1a40226e903119503108ea72bd0880c164e0e0 100644
index fb8a56d0ee80b0d397f2acd3af1f52fc26676b62..5d93eb5e56e45d485c0718db9e3d8754e97b691c 100644
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -162,8 +162,10 @@ public class Armadillo extends Animal {

View File

@@ -92,7 +92,7 @@ index 50f9a11f8cb53fd1fa34017598ff3fe828b3ca25..9f9abbd3272cba17f79dc4da6cf2cd4d
protected Brain.Provider<Frog> brainProvider() {
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java
index 7a3bfa91ffc5c7c6b04eef7b1b1d3c04c5a6d856..649d0fd34fc807ee0c87577490c77b71d5d76ecf 100644
index 07fd03f1a8e72a5b39e5f9fd13f401dbfdb45280..daa315bfbedb0ec21a684d9141fb41ad40ce45b1 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -106,6 +106,23 @@ public class Tadpole extends AbstractFish {

View File

@@ -13,7 +13,7 @@ To avoid the hefty ArrayDeque's size() call, we check if we *really* need to exe
Most entities won't have any scheduled tasks, so this is a nice performance bonus. These optimizations, however, wouldn't work in a Folia environment, but because in SparklyPaper executeTick is always executed on the main thread, it ain't an issue for us (yay).
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 3190ed2171b0de32aeb8761aa3e510c968c45448..b8b1bcac05917fa985210bcd5c6e226ed188b0ff 100644
index 83cbf865d83edcb4caea59a1a2b4932a915414be..3a86960729e23c7a5028dd64538d08428afd2b01 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -289,6 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@@ -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 d7d68dbdd39ff6e61531d2edeafdd923f0573c89..536fea9622cdec212aa61adbb627704c59a8999f 100644
index f6bfd246571f9f7b25e4bdff66253a99a2e5a77f..5966b45ec8c385539535139885e5ff522c998141 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -1426,6 +1426,8 @@ public abstract class PlayerList {
@@ -1577,6 +1577,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 d7d68dbdd39ff6e61531d2edeafdd923f0573c89..536fea9622cdec212aa61adbb627704c
if (!file1.exists()) {
File file2 = new File(file, displayName + ".json"); // CraftBukkit
Path path = file2.toPath();
@@ -1433,6 +1435,8 @@ public abstract class PlayerList {
@@ -1584,6 +1586,8 @@ public abstract class PlayerList {
file2.renameTo(file1);
}
}

View File

@@ -19,10 +19,10 @@ index eb600398e4802bb47231bbc0c55fb24ce24a6efb..54cc28bb1693be2077cb30d1dc85f9ae
org.purpurmc.purpur.command.DemoCommand.register(this.dispatcher); // Purpur - Add demo command
org.purpurmc.purpur.command.PingCommand.register(this.dispatcher); // Purpur - Add ping command
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index a05cd22bfe3a2c25a5e37c973766a162ce8e7244..602a087122a6baa3cb33e1bf5e6c4d98e500fa05 100644
index f3fb661e2cbf8119264d113a06bcb7bb5150be91..034a946cd545d775188a4375a87c90d253ebdb08 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -2385,6 +2385,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2387,6 +2387,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
// Purpur start - AFK API
private boolean isAfk = false;
@@ -33,7 +33,7 @@ index a05cd22bfe3a2c25a5e37c973766a162ce8e7244..602a087122a6baa3cb33e1bf5e6c4d98
@Override
public void setAfk(boolean afk) {
@@ -2422,6 +2426,18 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2424,6 +2428,18 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
String prefix = (split.length > 0 ? split[0] : "").replace(org.purpurmc.purpur.PurpurConfig.afkTabListPrefix, "");
String suffix = (split.length > 1 ? split[1] : "").replace(org.purpurmc.purpur.PurpurConfig.afkTabListSuffix, "");
if (afk) {
@@ -53,10 +53,10 @@ index a05cd22bfe3a2c25a5e37c973766a162ce8e7244..602a087122a6baa3cb33e1bf5e6c4d98
} else {
getBukkitEntity().setPlayerListName(prefix + scoreboardName + suffix, true);
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 470660998d3df511f00936bcaa210142ab8ba7b2..220dd097aa1d912feb6699dccd1b68523c14cdf6 100644
index 0bf9ead58e256dccd3c1e89bd08ebae9d630b49e..3c14d32ec9caf3dba9d99afe86a3ca053de70958 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2324,6 +2324,7 @@ public class ServerGamePacketListenerImpl
@@ -2327,6 +2327,7 @@ public class ServerGamePacketListenerImpl
@Override
public void handleChatCommand(ServerboundChatCommandPacket packet) {
@@ -64,7 +64,7 @@ index 470660998d3df511f00936bcaa210142ab8ba7b2..220dd097aa1d912feb6699dccd1b6852
this.tryHandleChat(packet.command(), () -> {
// CraftBukkit start - SPIGOT-7346: Prevent disconnected players from executing commands
if (this.player.hasDisconnected()) {
@@ -2332,7 +2333,7 @@ public class ServerGamePacketListenerImpl
@@ -2335,7 +2336,7 @@ public class ServerGamePacketListenerImpl
// CraftBukkit end
this.performUnsignedChatCommand(packet.command());
this.detectRateSpam("/" + packet.command()); // Spigot
@@ -73,7 +73,7 @@ index 470660998d3df511f00936bcaa210142ab8ba7b2..220dd097aa1d912feb6699dccd1b6852
}
private void performUnsignedChatCommand(String command) {
@@ -2365,6 +2366,7 @@ public class ServerGamePacketListenerImpl
@@ -2368,6 +2369,7 @@ public class ServerGamePacketListenerImpl
public void handleSignedChatCommand(ServerboundChatCommandSignedPacket packet) {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packet.lastSeenMessages());
if (!optional.isEmpty()) {
@@ -81,7 +81,7 @@ index 470660998d3df511f00936bcaa210142ab8ba7b2..220dd097aa1d912feb6699dccd1b6852
this.tryHandleChat(packet.command(), () -> {
// CraftBukkit start - SPIGOT-7346: Prevent disconnected players from executing commands
if (this.player.hasDisconnected()) {
@@ -2373,7 +2375,7 @@ public class ServerGamePacketListenerImpl
@@ -2376,7 +2378,7 @@ public class ServerGamePacketListenerImpl
// CraftBukkit end
this.performSignedChatCommand(packet, optional.get());
this.detectRateSpam("/" + packet.command()); // Spigot
@@ -90,7 +90,7 @@ index 470660998d3df511f00936bcaa210142ab8ba7b2..220dd097aa1d912feb6699dccd1b6852
}
}
@@ -2480,12 +2482,17 @@ public class ServerGamePacketListenerImpl
@@ -2483,12 +2485,17 @@ public class ServerGamePacketListenerImpl
return dispatcher.parse(command, this.player.createCommandSourceStack());
}
@@ -110,7 +110,7 @@ index 470660998d3df511f00936bcaa210142ab8ba7b2..220dd097aa1d912feb6699dccd1b6852
this.player.resetLastActionTime();
// CraftBukkit start
if (sync) {
@@ -2497,6 +2504,40 @@ public class ServerGamePacketListenerImpl
@@ -2500,6 +2507,40 @@ public class ServerGamePacketListenerImpl
}
}
@@ -152,11 +152,11 @@ index 470660998d3df511f00936bcaa210142ab8ba7b2..220dd097aa1d912feb6699dccd1b6852
synchronized (this.lastSeenMessages) {
Optional var10000;
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 536fea9622cdec212aa61adbb627704c59a8999f..37ba75bd50f785da11a0127fb40d86ee8b988c17 100644
index 5966b45ec8c385539535139885e5ff522c998141..e9529dfb98bf025fbdd59bbd2c61ea8169907fb6 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -524,6 +524,7 @@ public abstract class PlayerList {
public @Nullable net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
@@ -672,6 +672,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
+ net.minecraft.server.network.ServerGamePacketListenerImpl.afkCooldown.remove(player.getBukkitEntity().getUniqueId()); // Leaf - Improve Purpur AFK system

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Virtual thread for chat executor
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index b8b1bcac05917fa985210bcd5c6e226ed188b0ff..49cd06c0b71c6aa643b692c21ecbc01266291770 100644
index 3a86960729e23c7a5028dd64538d08428afd2b01..3ca7405318a4076000250203be4b91dbde95191b 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -2660,7 +2660,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2662,7 +2662,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public final java.util.concurrent.ExecutorService chatExecutor = java.util.concurrent.Executors.newCachedThreadPool(

View File

@@ -103,10 +103,10 @@ index cdfb9004dd4f4ea1bbb77895b7fc020d628c485d..54910c2e1d6e6bb556e536fda060bd09
// Paper start - Add setting for proxy online mode status
return properties.enforceSecureProfile
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index d2e8adccf33c6b842fac615006b782b09cfa7a1a..434be9d08d8e816e2dea1e9d23fa26d21b9f35f6 100644
index 4d48ffeecba7fc4b53dad5f0a4d9c1bb8eac50c1..18f0d486c478087f404d8bb6cd840079e2c8d239 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -315,10 +315,30 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -328,10 +328,30 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
public void send(Packet<?> packet) {
@@ -138,10 +138,10 @@ index d2e8adccf33c6b842fac615006b782b09cfa7a1a..434be9d08d8e816e2dea1e9d23fa26d2
if (packet == null || this.processedDisconnect) { // Spigot
return;
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 37ba75bd50f785da11a0127fb40d86ee8b988c17..a3fdc328399c5d4806c6f361ba83515cf2094336 100644
index e9529dfb98bf025fbdd59bbd2c61ea8169907fb6..3bc0469173330b50b488fb8eaf5f0c1b98e33fc4 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -1386,7 +1386,7 @@ public abstract class PlayerList {
@@ -1537,7 +1537,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 37ba75bd50f785da11a0127fb40d86ee8b988c17..a3fdc328399c5d4806c6f361ba83515c
OutgoingChatMessage outgoingChatMessage = OutgoingChatMessage.create(message);
boolean flag1 = false;
@@ -1411,6 +1411,7 @@ public abstract class PlayerList {
@@ -1562,6 +1562,7 @@ public abstract class PlayerList {
}
public boolean verifyChatTrusted(PlayerChatMessage message) {

View File

@@ -48,10 +48,10 @@ index 229e115447b06db3e3b440ee8ea0505979656846..a9acfc3ba6c3447b4632d32fe24e9a09
}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 0f09a2b0cbc17f1d64638f677f2518617f906576..7d8efad091cbf9f1177e7c0751c8e534bd665e0a 100644
index 9b193bf81cf7f9f45dfa207a826043e083c2f8ba..11e8738b7cf388e0742bfe5e6136365f6ac066f9 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -624,6 +624,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -625,6 +625,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
chunkGenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkGenerator, gen);
}
// CraftBukkit end
@@ -60,7 +60,7 @@ index 0f09a2b0cbc17f1d64638f677f2518617f906576..7d8efad091cbf9f1177e7c0751c8e534
DataFixer fixerUpper = server.getFixerUpper();
// Paper - rewrite chunk system
diff --git a/net/minecraft/world/entity/monster/Slime.java b/net/minecraft/world/entity/monster/Slime.java
index 7b6db084a483b4a9c2f292c5ed6e4c7550344c50..471d61cfd26ab1724432afc99dfe335a09a5ba48 100644
index 9a157a2bdbbeab89dbfcd23be8bdc62c8de4548c..c257a19ff6b15ee6a83e9c946e2b20309ada9b51 100644
--- a/net/minecraft/world/entity/monster/Slime.java
+++ b/net/minecraft/world/entity/monster/Slime.java
@@ -412,7 +412,11 @@ public class Slime extends Mob implements Enemy {

View File

@@ -27,10 +27,10 @@ index a9acfc3ba6c3447b4632d32fe24e9a09d55ba1e2..0f9d18dd29e210ad656da211a3cb1cb2
final ServerLevel world = this.level;
final int randomTickSpeed = world.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 7d8efad091cbf9f1177e7c0751c8e534bd665e0a..d23ed8dbda5132337c8c96c67cf924e438ea9f4b 100644
index 11e8738b7cf388e0742bfe5e6136365f6ac066f9..16cafa0acb7b2972ce08ab56921e73eb44eff6fa 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -889,7 +889,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -891,7 +891,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) {
final LevelChunkSection[] sections = chunk.getSections();
final int minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection((ServerLevel)(Object)this);
@@ -39,7 +39,7 @@ index 7d8efad091cbf9f1177e7c0751c8e534bd665e0a..d23ed8dbda5132337c8c96c67cf924e4
final boolean doubleTickFluids = !ca.spottedleaf.moonrise.common.PlatformHooks.get().configFixMC224294();
final ChunkPos cpos = chunk.getPos();
@@ -938,7 +938,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -940,7 +940,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.simpleRandom.nextInt(16); } // Gale - Airplane - optimize random calls in chunk ticking
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
@@ -97,7 +97,7 @@ index 8516d47b0ba79d91638837199e7ae0fb6cb44a79..4f4b55dd099dd2c2fea118b18b535881
RandomSource fork();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 109ec179bd7e960cb09a98e1ec6179a60b2cba57..1f439c158f58fac08d17a262c01a1202ff3eb8e0 100644
index 4e3b73bee5dae2b5921db86cc53b4cd9ebbd06f8..fa44ddaeac193a686211a9ede5993674626b8e25 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -149,7 +149,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -110,7 +110,7 @@ index 109ec179bd7e960cb09a98e1ec6179a60b2cba57..1f439c158f58fac08d17a262c01a1202
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 453d4babc78f5676cb9534a5d80967a6f8c5a263..5fe79a471b5a5f1474a1fcb305b323d2e3a0de87 100644
index 9ac2ecb78f6214616376b0e3badef21dc3f72114..f145453f70a219c1be33b241309ae2ab22a8004b 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -117,7 +117,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -189,7 +189,7 @@ index 426692d9627f46d708f551bd22ce3c52b2a23b37..8a19fd2b816b07a7374cb9dc96896a12
if (!org.dreeam.leaf.config.modules.misc.SecureSeed.enabled) {
// Paper start - Add missing structure set seed configs
diff --git a/net/minecraft/world/level/levelgen/DensityFunctions.java b/net/minecraft/world/level/levelgen/DensityFunctions.java
index 04527a5c65ad630f794fed9071d485aedd02257a..15fc39f9c77fdd03a0ca4a39d173c851b9454f08 100644
index 77731406cb3dc417aa2fe1cb4352f3d2d7d498aa..1420dac658c4b27d25882a6d7dd3efb2c5b7e720 100644
--- a/net/minecraft/world/level/levelgen/DensityFunctions.java
+++ b/net/minecraft/world/level/levelgen/DensityFunctions.java
@@ -518,7 +518,7 @@ public final class DensityFunctions {

View File

@@ -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 a3fdc328399c5d4806c6f361ba83515cf2094336..9f2dcbbd82c5f077f058b64a61cc31d76b34b471 100644
index 3bc0469173330b50b488fb8eaf5f0c1b98e33fc4..fae3c65d7411cd2c279dde27f8b8eafd45b657cf 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -336,7 +336,7 @@ public abstract class PlayerList {
@@ -438,7 +438,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 a3fdc328399c5d4806c6f361ba83515cf2094336..9f2dcbbd82c5f077f058b64a61cc31d7
this.cserver.getPluginManager().callEvent(playerJoinEvent);
if (!player.connection.isAcceptingMessages()) {
@@ -347,7 +347,7 @@ public abstract class PlayerList {
@@ -451,7 +451,7 @@ public abstract class PlayerList {
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
@@ -26,7 +26,7 @@ index a3fdc328399c5d4806c6f361ba83515cf2094336..9f2dcbbd82c5f077f058b64a61cc31d7
joinMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(jm); // Paper - Adventure
this.server.getPlayerList().broadcastSystemMessage(joinMessage, false); // Paper - Adventure
}
@@ -533,7 +533,7 @@ public abstract class PlayerList {
@@ -681,7 +681,7 @@ public abstract class PlayerList {
player.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - Inventory close reason
}
@@ -35,7 +35,7 @@ index a3fdc328399c5d4806c6f361ba83515cf2094336..9f2dcbbd82c5f077f058b64a61cc31d7
this.cserver.getPluginManager().callEvent(playerQuitEvent);
player.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
@@ -1538,4 +1538,40 @@ public abstract class PlayerList {
@@ -1690,4 +1690,40 @@ public abstract class PlayerList {
public boolean isAllowCommandsForAllPlayers() {
return this.allowCommandsForAllPlayers;
}

View File

@@ -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 ab7bdbce80046df43e4889c20c4d3d9fb1d2e2c4..916a964263a9b71d20007c29302341dd50c94b85 100644
index 09aa0b344aff0c48eec9a296d47c0704bd0fdc5c..fdbe3d4d71ba30c8330760555e97ff436643a7a9 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 {

View File

@@ -46,7 +46,7 @@ index 6c7edbbf3935c40ccb78bee680ea75431718b9bd..a1b4dc70d555cce5e06c0298736d8b89
public String toString() {
return "Reference{" + this.key + "=" + this.value + "}";
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 1f439c158f58fac08d17a262c01a1202ff3eb8e0..753515c65a2b49db15ef6616cc7caf276fdbbeb1 100644
index fa44ddaeac193a686211a9ede5993674626b8e25..c3d4cdfece32a05acd03b892cd5b343f0d230e64 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1976,7 +1976,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in entity mountedOrDismounted changes update
diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
index 27e8c6a61cfa30b4e5bcc8ac30b0023940d9f310..dca939778d637ee293dc14f55edde7b1a97a2617 100644
index b3fe9ea70148cdbefbdb617abaf81fe48ee26685..d6b261f8d3fbeee771208528b3e0bd5fcd94878b 100644
--- a/net/minecraft/server/level/ServerEntity.java
+++ b/net/minecraft/server/level/ServerEntity.java
@@ -118,7 +118,19 @@ public class ServerEntity {

View File

@@ -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 916a964263a9b71d20007c29302341dd50c94b85..fe201ffb28df1171bc22f7ed40cd729b9f3f1017 100644
index fdbe3d4d71ba30c8330760555e97ff436643a7a9..ba6d9a5df71e9aae9defedf5bbe12f49599123cb 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -196,6 +196,10 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Replace criterion map with optimized collection
diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java
index edf115439c630a4471460db02109bbce7868de81..6dc728625de0f323322c34104e1c55b17aa0b712 100644
index c7e92f0122823d9e1aa471c5c0e995d1e1d90184..10ac7393d20a0857be2bfdd856dda448699b3eff 100644
--- a/net/minecraft/server/PlayerAdvancements.java
+++ b/net/minecraft/server/PlayerAdvancements.java
@@ -60,7 +60,7 @@ public class PlayerAdvancements {

View File

@@ -6,11 +6,11 @@ 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 4287bb927a25206016298be2cc659d5920b3c414..5e693808b54efd77a40ccf0bafdf5a2aa7245da3 100644
index 3c14d32ec9caf3dba9d99afe86a3ca053de70958..155e2047659111f68e27d3517e5178afa233dfe4 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -322,17 +322,12 @@ public class ServerGamePacketListenerImpl
}
@@ -325,17 +325,12 @@ public class ServerGamePacketListenerImpl
public final org.leavesmc.leaves.protocol.syncmatica.exchange.ExchangeTarget exchangeTarget; // Leaves - Syncmatica Protocol
// Purpur start - AFK API
- private final com.google.common.cache.LoadingCache<org.bukkit.craftbukkit.entity.CraftPlayer, Boolean> kickPermissionCache = com.google.common.cache.CacheBuilder.newBuilder()
@@ -31,7 +31,7 @@ index 4287bb927a25206016298be2cc659d5920b3c414..5e693808b54efd77a40ccf0bafdf5a2a
// Purpur end - AFK API
@Override
@@ -395,7 +390,7 @@ public class ServerGamePacketListenerImpl
@@ -398,7 +393,7 @@ public class ServerGamePacketListenerImpl
&& Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits
// Purpur start - AFK API
this.player.setAfk(true);

View File

@@ -6,15 +6,15 @@ 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 a289c3247ef6e1b7ae76fdc86c286e7b426731b4..7f12288fc361f780171026beb52c07b20ae17324 100644
index fae3c65d7411cd2c279dde27f8b8eafd45b657cf..34c5c2e3d6b0706cb91ec0171969cf81e94741a4 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -241,6 +241,13 @@ public abstract class PlayerList {
@@ -342,6 +342,13 @@ public abstract class PlayerList {
return;
}
// Gale end - MultiPaper - do not place player in world if kicked before being spawned in
+ // Leaf start - Do not place player if the server is full - copied from canPlayerLogin
+ if (org.dreeam.leaf.config.modules.fixes.DontPlacePlayerIfFull.enabled && this.players.size() >= this.maxPlayers && !(player.getBukkitEntity().hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameProfile))) { // Purpur - Allow player join full server by permission
+ if (org.dreeam.leaf.config.modules.fixes.DontPlacePlayerIfFull.enabled && this.realPlayers.size() >= this.maxPlayers && !(player.getBukkitEntity().hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameProfile))) { // Purpur - Allow player join full server by permission
+ connection.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)));
+ //playerconnection.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT);
+ return;
@@ -23,12 +23,12 @@ index a289c3247ef6e1b7ae76fdc86c286e7b426731b4..7f12288fc361f780171026beb52c07b2
org.bukkit.Location loc = ev.getSpawnLocation();
serverLevel = ((org.bukkit.craftbukkit.CraftWorld) loc.getWorld()).getHandle();
@@ -684,7 +691,7 @@ public abstract class PlayerList {
@@ -834,7 +841,7 @@ public abstract class PlayerList {
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
// ? Component.translatable("multiplayer.disconnect.server_full")
// : null;
- if (this.players.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameProfile))) { // Purpur - Allow player join full server by permission
+ if (this.players.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameProfile))) { // Purpur - Allow player join full server by permission // Leaf - Do not place player if the server is full - diff on change
- if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameProfile))) { // Purpur - Allow player join full server by permission // Leaves - only real player
+ if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameProfile))) { // Purpur - Allow player join full server by permission // Leaves - only real player // Leaf - Do not place player if the server is full - diff on change
event.disallow(org.bukkit.event.player.PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
}
}

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Fix MC-119417
Related MC issue: https://bugs.mojang.com/browse/MC/issues/MC-119417
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 602a087122a6baa3cb33e1bf5e6c4d98e500fa05..f898961de04ad0b224d0405e2cd43d61665cc1b1 100644
index 034a946cd545d775188a4375a87c90d253ebdb08..18125ed336c3425f123232b405a8af9ee3a2ba7d 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -2189,6 +2189,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -2191,6 +2191,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, gameMode.getId()));
if (gameMode == GameType.SPECTATOR) {
this.removeEntitiesOnShoulder();

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Configurable player knockback zombie
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index fe201ffb28df1171bc22f7ed40cd729b9f3f1017..f36af61d7620f57f396d879d669161b8b1a30875 100644
index ba6d9a5df71e9aae9defedf5bbe12f49599123cb..4c3eadc2d8480b2a2c2c08e58620544d403d3adc 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2079,6 +2079,8 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@@ -8,7 +8,7 @@ Original project: https://github.com/PaperMC/Paper
Paper pull request: https://github.com/PaperMC/Paper/pull/10990
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index e9ebf23b0b1af85e3738a70acc0eaa3e8980261f..d473c09e98eb5d3ef7b3e096197c7bf9a6219c56 100644
index cf136bc3d0d285ebde23c6e31c002933564fdcb2..c15b6e32bd00650366dc4ecba2abeb6bfb98d638 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -207,6 +207,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab

View File

@@ -9,7 +9,7 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
index dca939778d637ee293dc14f55edde7b1a97a2617..44d87997e1ce9b846ebed541634a4478334c920c 100644
index d6b261f8d3fbeee771208528b3e0bd5fcd94878b..1a9601aee097b6c10cf2ae1c52fddf45da85f60f 100644
--- a/net/minecraft/server/level/ServerEntity.java
+++ b/net/minecraft/server/level/ServerEntity.java
@@ -221,6 +221,8 @@ public class ServerEntity {

View File

@@ -353,10 +353,10 @@ index 1a9601aee097b6c10cf2ae1c52fddf45da85f60f..16b2ca8c96e9561aa57e0903d1e98e64
}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 42f56bd6a9f449df23f7e7f00b3efa114a003449..0471b04833fbca5dfc0cc6575692cdefb83edbed 100644
index 16cafa0acb7b2972ce08ab56921e73eb44eff6fa..bbccf0c8aef3792bb7b7cb0070e48bca4c274a2c 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -2503,7 +2503,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2505,7 +2505,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public LevelEntityGetter<Entity> getEntities() {
@@ -365,7 +365,7 @@ index 42f56bd6a9f449df23f7e7f00b3efa114a003449..0471b04833fbca5dfc0cc6575692cdef
return this.moonrise$getEntityLookup(); // Paper - rewrite chunk system
}
@@ -2739,7 +2739,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2746,7 +2746,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
map.carriedByPlayers.remove(player);
@@ -375,10 +375,10 @@ index 42f56bd6a9f449df23f7e7f00b3efa114a003449..0471b04833fbca5dfc0cc6575692cdef
}
}
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index be803fd0a79850254bd4a7f64534142cd5b4ec98..6992a53abdcff6299bedf33ba0b1bc6386a1ea74 100644
index 155e2047659111f68e27d3517e5178afa233dfe4..c91348eea1350728d8f6de7b8c3613cb44b5cdec 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1878,7 +1878,7 @@ public class ServerGamePacketListenerImpl
@@ -1881,7 +1881,7 @@ public class ServerGamePacketListenerImpl
}
public void internalTeleport(PositionMoveRotation posMoveRotation, Set<Relative> relatives) {

View File

@@ -7,7 +7,7 @@ Original license: GPL v3
Original project: https://github.com/Gensokyo-Reimagined/Nitori
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 17d3a8a2cc3c86ed6aae9c20ed9f281dc9715cf5..354823def23167feb1e7b35cd9db5ef1584e7e8c 100644
index 3ca7405318a4076000250203be4b91dbde95191b..2aed6f594c73bea5e8919e65cf04bc7eb6775c3e 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1067,6 +1067,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@@ -7,7 +7,7 @@ Original license: AGPL-3.0
Original project: https://github.com/snackbag/TT20
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index d2e7ca050c236b17206738e5e5f8d4936afedd45..508f3c7c1e806576f1faea7975ac9bbe73b1024b 100644
index 2aed6f594c73bea5e8919e65cf04bc7eb6775c3e..bbd2b327c658b56a1fcf30c8b77cab987d688fcc 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1544,6 +1544,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@@ -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 f36af61d7620f57f396d879d669161b8b1a30875..eb40f810d4eb8d6a8cc130719b637a473f19cc82 100644
index 68241d1d488bc2848e3c0d167270c1788e573c37..b3e9ad0669bb4b91d5d991f106b225e914a4e68f 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2796,6 +2796,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@@ -9,10 +9,10 @@ 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 f898961de04ad0b224d0405e2cd43d61665cc1b1..afbac4f2da3aa58da82b9a06d656851f12756f32 100644
index 18125ed336c3425f123232b405a8af9ee3a2ba7d..e97a93c97e1822f969dce2d30dd915db5d3d14cf 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1417,6 +1417,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1419,6 +1419,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
LevelData worlddata = level.getLevelData();
this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(level), (byte) 3));
@@ -20,7 +20,7 @@ index f898961de04ad0b224d0405e2cd43d61665cc1b1..afbac4f2da3aa58da82b9a06d656851f
this.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
PlayerList playerList = this.server.getPlayerList();
@@ -1426,7 +1427,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1428,7 +1429,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
// CraftBukkit end
this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(exit); // Purpur - Fix stuck in portals
this.setServerLevel(level);
@@ -30,10 +30,10 @@ index f898961de04ad0b224d0405e2cd43d61665cc1b1..afbac4f2da3aa58da82b9a06d656851f
level.addDuringTeleport(this);
this.triggerDimensionChangeTriggers(serverLevel);
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 8e2161a2ff45b8f29fa4744b0cdd429d0f9a6c41..07dafa0e12fd51e4b9e968e22b20f000d04f6dbc 100644
index 34c5c2e3d6b0706cb91ec0171969cf81e94741a4..8b1652805a2ac9ebae9c99dd77e81c7a484a7abb 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -806,11 +806,11 @@ public abstract class PlayerList {
@@ -956,11 +956,11 @@ public abstract class PlayerList {
byte b = (byte)(keepInventory ? 1 : 0);
ServerLevel serverLevel = serverPlayer.serverLevel();
LevelData levelData = serverLevel.getLevelData();

View File

@@ -241,7 +241,7 @@ index 90814ad07a2686c5a274860395f5aca29cc3bf13..369f0176a636def905fb2a2df1a0e2ca
+ }
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 7e9ace691bb2662afd2c0fc504007a6d22a8aec0..dabd49c7b9e689be4b476c16b28cbb8edcd3306b 100644
index b3e9ad0669bb4b91d5d991f106b225e914a4e68f..a927e8a7d9149f5b7abaae50ba8d4fdc6ec87b55 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -417,7 +417,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

Some files were not shown because too many files have changed in this diff Show More