Files
Purpur/patches/server/0135-Fix-stuck-in-portals.patch
BillyGalbreath 28167fbd60 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@bcb4220 Correctly handle interactions with items on cooldown (#8008)
PaperMC/Paper@60c973e Exempt players in creative/spectator from nether ceiling damage (#8427)
PaperMC/Paper@77a50b9 Add Unmodifiable annotations to getDrops methods (#8440)
2022-10-08 18:20:48 -05:00

59 lines
3.6 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 ca7199452cbfc7d18203eae17c417c829c3b39bf..743a5cf750cc56856477cf2b4d75ceb241ef1eb6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1169,6 +1169,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 a4db0e61e82981b527a84812fc11bee8182bdde2..be3272b08eafebf077ce10d2723d4a0cc997a6d8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2891,12 +2891,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 97143ad57276e7f62b50578096972c7581a6158b..4e996becabad942aaaa5ccb097707b0e2fd83adb 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -338,6 +338,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);
@@ -355,6 +356,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);
}
private static boolean projectileDespawnRateSettingsMigrated = false;