Files
Purpur/patches/server/0137-Fix-stuck-in-portals.patch
Ben Kerllenevich dc4a29b567 Updated Upstream (Paper & Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@2033dba Updated Upstream (CraftBukkit)
PaperMC/Paper@a3ad720 Remove ChatColor usages (#7543)
PaperMC/Paper@8fc0999 Fix some nullability things (#7275)
PaperMC/Paper@fd069dd Remove incorrect throws javadoc in Team (#7869)
PaperMC/Paper@bed5cb2 Limit resolved selectors when enabled
PaperMC/Paper@4d83ed0 [ci skip] Changing the order of the rebase with autosquash command in the contributing.md (#6974)
PaperMC/Paper@071a4a2 throw exception if worlds are created while being ticked (#7653)
PaperMC/Paper@5b6397a Make leave messages for kicks the same as for quitting (#7874)
PaperMC/Paper@5befb55 Updated Upstream (Bukkit/CraftBukkit) (#7875)
PaperMC/Paper@b3deb25 Move some methods to RegionAccessor (#7635)
PaperMC/Paper@d8ef841 [DataConverter] Fix generator options parsing
PaperMC/Paper@4b27254 Fix treasure maps discovered settings (#7627)
PaperMC/Paper@276d830 Fix campfire walker in V1920

Pufferfish Changes:
pufferfish-gg/Pufferfish@671d68b Add Entity TTLs
pufferfish-gg/Pufferfish@aaca13d Updated Upstream (Paper)
2022-06-07 13:09:12 -04:00

59 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 14 Jan 2021 16:48:10 -0600
Subject: [PATCH] Fix stuck in portals
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4b0a0f18708c887ea339f078aea4c988b222ce0c..49adcc516e880c9d1a4926115c0f6fc0f757d7e2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1176,6 +1176,7 @@ public class ServerPlayer extends Player {
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
+ this.portalPos = net.minecraft.server.MCUtil.toBlockPosition(exit); // Purpur
// CraftBukkit end
this.setLevel(worldserver);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d94e28c53df16ca969ac128886cdb60cfd712145..1c996ff06017c178064877c5dd6bff591fa170f3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2782,12 +2782,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return Vec3.directionFromRotation(this.getRotationVector());
}
+ public BlockPos portalPos = BlockPos.ZERO; // Purpur
public void handleInsidePortal(BlockPos pos) {
if (this.isOnPortalCooldown()) {
+ if (!(level.purpurConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(portalPos))) // Purpur
this.setPortalCooldown();
} else if (level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer) { // Purpur
if (!this.level.isClientSide && !pos.equals(this.portalEntrancePos)) {
this.portalEntrancePos = pos.immutable();
+ portalPos = BlockPos.ZERO; // Purpur
}
this.isInsidePortal = true;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 178bb27f204760e4ca3ad919024b4bae74244cbd..3fdcd6f04bd03fb65637b261e390ced9914c4bb1 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -329,6 +329,7 @@ public class PurpurWorldConfig {
public int playerDeathExpDropMax = 100;
public boolean teleportIfOutsideBorder = false;
public boolean totemOfUndyingWorksInInventory = false;
+ public boolean playerFixStuckPortal = false;
private void playerSettings() {
if (PurpurConfig.version < 19) {
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
@@ -346,6 +347,7 @@ public class PurpurWorldConfig {
playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory);
+ playerFixStuckPortal = getBoolean("gameplay-mechanics.player.fix-stuck-in-portal", playerFixStuckPortal);
}
public int snowballDamage = -1;