mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Fix stuck in portals
This commit is contained in:
committed by
granny
parent
de8dffe5f2
commit
fafdf0f8a7
@@ -1,60 +0,0 @@
|
||||
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/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 303c9b2c6f1a62e40c5657248b727c14bb9c613a..92c0a7609e45a8cdb809ad7579f1713fc15675cf 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1678,6 +1678,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
// CraftBukkit end
|
||||
+ this.portalPos = io.papermc.paper.util.MCUtil.toBlockPosition(exit); // Purpur - Fix stuck in portals
|
||||
this.setServerLevel(worldserver);
|
||||
this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index cfe26c762b2affa5050c175f6ab0306af6cfbe71..f15a8c14417b83b237dc7b9a11490116314cd4c6 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -3465,14 +3465,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return Vec3.directionFromRotation(this.getRotationVector());
|
||||
}
|
||||
|
||||
+ public BlockPos portalPos = BlockPos.ZERO; // Purpur
|
||||
public void setAsInsidePortal(Portal portal, BlockPos pos) {
|
||||
if (this.isOnPortalCooldown()) {
|
||||
+ if (!(level().purpurConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(this.portalPos))) // Purpur - Fix stuck in portals
|
||||
this.setPortalCooldown();
|
||||
} else if (this.level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer) { // Purpur - Entities can use portals
|
||||
if (this.portalProcess != null && this.portalProcess.isSamePortal(portal)) {
|
||||
if (!this.portalProcess.isInsidePortalThisTick()) {
|
||||
this.portalProcess.updateEntryPosition(pos.immutable());
|
||||
this.portalProcess.setAsInsidePortalThisTick(true);
|
||||
+ this.portalPos = BlockPos.ZERO; // Purpur - Fix stuck in portals
|
||||
}
|
||||
} else {
|
||||
this.portalProcess = new PortalProcessor(portal, pos.immutable());
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 86b27b11f178be0cc05842ccb3ffe4ef14196855..126d2689166579785735cf250ddf0838512ce81b 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -327,6 +327,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);
|
||||
@@ -342,6 +343,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 boolean silkTouchEnabled = false;
|
||||
Reference in New Issue
Block a user