mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
ec53bd41e7
When enabled, ender pearls will not load chunks and will save to the world instead of the player. Also changes the exploit config to be default false, as it only makes sense when legacy behavior is enabled.
62 lines
3.8 KiB
Diff
62 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
Date: Sun, 27 Oct 2024 12:36:53 -0700
|
|
Subject: [PATCH] Allow using old ender pearl behavior
|
|
|
|
When enabled, ender pearls will not load chunks and will save to the world instead of the player.
|
|
|
|
== AT ==
|
|
public net.minecraft.world.entity.projectile.Projectile cachedOwner
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
|
|
|
while (iterator.hasNext()) {
|
|
ThrownEnderpearl entityenderpearl = (ThrownEnderpearl) iterator.next();
|
|
+ if (entityenderpearl.level().paperConfig().misc.legacyEnderPearlBehavior) continue; // Paper - Allow using old ender pearl behavior
|
|
|
|
if (entityenderpearl.isRemoved()) {
|
|
ServerPlayer.LOGGER.warn("Trying to save removed ender pearl, skipping");
|
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
|
}
|
|
|
|
public static long placeEnderPearlTicket(ServerLevel world, ChunkPos chunkPos) {
|
|
- world.getChunkSource().addRegionTicket(TicketType.ENDER_PEARL, chunkPos, 2, chunkPos);
|
|
+ if (!world.paperConfig().misc.legacyEnderPearlBehavior) world.getChunkSource().addRegionTicket(TicketType.ENDER_PEARL, chunkPos, 2, chunkPos); // Paper - Allow using old ender pearl behavior
|
|
return TicketType.ENDER_PEARL.timeout();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
|
while (iterator.hasNext()) {
|
|
ThrownEnderpearl entityenderpearl = (ThrownEnderpearl) iterator.next();
|
|
|
|
+ // Paper start - Allow using old ender pearl behavior
|
|
+ if (!entityenderpearl.level().paperConfig().misc.legacyEnderPearlBehavior) {
|
|
entityenderpearl.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER, EntityRemoveEvent.Cause.PLAYER_QUIT); // CraftBukkit - add Bukkit remove cause
|
|
+ } else {
|
|
+ entityenderpearl.cachedOwner = null;
|
|
+ }
|
|
+ // Paper end - Allow using old ender pearl behavior
|
|
}
|
|
|
|
worldserver.removePlayerImmediately(entityplayer, Entity.RemovalReason.UNLOADED_WITH_PLAYER);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
|
|
@@ -0,0 +0,0 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
|
|
Entity entity = super.teleport(teleportTarget);
|
|
|
|
if (entity != null) {
|
|
- entity.placePortalTicket(BlockPos.containing(entity.position()));
|
|
+ if (!this.level().paperConfig().misc.legacyEnderPearlBehavior) entity.placePortalTicket(BlockPos.containing(entity.position())); // Paper - Allow using old ender pearl behavior
|
|
}
|
|
|
|
return entity;
|