From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath 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 b09cd5f750b6789ac21ed7d585d72ad393141a97..e081a02d6799d8d74db06ca84e224c395e95a308 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1144,6 +1144,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 4214dc49e2758be99ca204cb33f2dcc7b0109b65..a1cbeb306d5bcf619a3a338822209f6f68992b5a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2722,12 +2722,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n 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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 50f271ff9949241caec638d96caa782f945b7d52..b578c89ed02b093e329ba93775a3552e5a568883 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -296,6 +296,7 @@ public class PurpurWorldConfig { public int playerDeathExpDropMax = 100; public boolean teleportIfOutsideBorder = false; public boolean totemOfUndyingWorksInInventory = false; + public boolean playerFixStuckPortal = false; private void playerSettings() { idleTimeoutKick = getBoolean("gameplay-mechanics.player.idle-timeout.kick-if-idle", idleTimeoutKick); idleTimeoutTickNearbyEntities = getBoolean("gameplay-mechanics.player.idle-timeout.tick-nearby-entities", idleTimeoutTickNearbyEntities); @@ -308,6 +309,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;