2021-06-21 01:05:56 +08:00
|
|
|
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
|
2023-08-13 18:30:27 +08:00
|
|
|
index acee9e7e636d2e65a3bf32bbf5aae5170687f4a4..c8c51b8365e5b0129c7cd925f759e4cefc11d021 100644
|
2021-06-21 01:05:56 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
2023-06-09 10:58:32 +08:00
|
|
|
@@ -1271,6 +1271,7 @@ public class ServerPlayer extends Player {
|
2021-06-21 01:05:56 +08:00
|
|
|
playerlist.sendPlayerPermissionLevel(this);
|
|
|
|
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
|
|
|
this.unsetRemoved();
|
2022-10-25 16:05:30 +08:00
|
|
|
+ this.portalPos = io.papermc.paper.util.MCUtil.toBlockPosition(exit); // Purpur
|
2021-06-21 01:05:56 +08:00
|
|
|
|
|
|
|
// CraftBukkit end
|
2023-06-09 06:38:51 +08:00
|
|
|
this.setServerLevel(worldserver);
|
2021-06-21 01:05:56 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2023-08-13 18:30:27 +08:00
|
|
|
index d9a206106cc25be50d7d34cbe7031139a0d5ab83..1dbbfd63d25597830146e40570051dfabe956901 100644
|
2021-06-21 01:05:56 +08:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2023-07-27 03:43:35 +08:00
|
|
|
@@ -3058,12 +3058,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
2021-06-21 01:05:56 +08:00
|
|
|
return Vec3.directionFromRotation(this.getRotationVector());
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public BlockPos portalPos = BlockPos.ZERO; // Purpur
|
|
|
|
public void handleInsidePortal(BlockPos pos) {
|
|
|
|
if (this.isOnPortalCooldown()) {
|
2023-06-09 12:01:03 +08:00
|
|
|
+ if (!(level().purpurConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(portalPos))) // Purpur
|
2021-06-21 01:05:56 +08:00
|
|
|
this.setPortalCooldown();
|
2023-06-09 12:01:03 +08:00
|
|
|
} else if (level().purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer) { // Purpur
|
2023-06-09 06:38:51 +08:00
|
|
|
if (!this.level().isClientSide && !pos.equals(this.portalEntrancePos)) {
|
2021-06-21 01:05:56 +08:00
|
|
|
this.portalEntrancePos = pos.immutable();
|
|
|
|
+ portalPos = BlockPos.ZERO; // Purpur
|
|
|
|
}
|
|
|
|
|
|
|
|
this.isInsidePortal = true;
|
2021-11-29 21:30:53 +08:00
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
2023-08-13 22:48:40 +08:00
|
|
|
index 14e708b579fc8cbb648fc01d96439a05a6abe239..c72af60345ac9704118ff9d19295d1a663a1e985 100644
|
2021-11-29 21:30:53 +08:00
|
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
2023-08-13 22:48:40 +08:00
|
|
|
@@ -335,6 +335,7 @@ public class PurpurWorldConfig {
|
2021-06-21 01:05:56 +08:00
|
|
|
public int playerDeathExpDropMax = 100;
|
|
|
|
public boolean teleportIfOutsideBorder = false;
|
|
|
|
public boolean totemOfUndyingWorksInInventory = false;
|
|
|
|
+ public boolean playerFixStuckPortal = false;
|
|
|
|
private void playerSettings() {
|
2021-08-23 04:23:16 +08:00
|
|
|
if (PurpurConfig.version < 19) {
|
|
|
|
boolean oldVal = getBoolean("gameplay-mechanics.player.idle-timeout.mods-target", idleTimeoutTargetPlayer);
|
2023-08-13 22:48:40 +08:00
|
|
|
@@ -352,6 +353,7 @@ public class PurpurWorldConfig {
|
2021-06-21 01:05:56 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2022-06-13 23:46:27 +08:00
|
|
|
private static boolean projectileDespawnRateSettingsMigrated = false;
|