mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-17 13:00:04 +08:00
59 lines
3.6 KiB
Diff
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 7d7fc0bc857d39cd447f9669d1bd780e64846645..5d10e3f3990de7b3667de02cb515039bfbb6d815 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1185,6 +1185,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 f5d9fe446de93e3b2c99198c6959280a1cf8443e..aa477068e28a4070a26aa08e09d614bbf6fd01ab 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -2879,12 +2879,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 01950a7b0b6a6f0959a72f8dcebae71e8e837195..bb1127f369de525430687ec1dc46cc56b5df7fc7 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -337,6 +337,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);
|
|
@@ -354,6 +355,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;
|