Entities can use portals

This commit is contained in:
William Blake Galbreath
2025-01-09 15:07:17 -08:00
committed by granny
parent 40c7c807a3
commit b5517f87dc
3 changed files with 20 additions and 47 deletions

View File

@@ -1,47 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Mon, 17 Aug 2020 19:32:05 -0500
Subject: [PATCH] Entities can use portals
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 2cf83678a2a37ff9082eae1a8b6cbf5be60a065f..c0e8739f0dd9290550872839eddca4b0090b603b 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -3468,7 +3468,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void setAsInsidePortal(Portal portal, BlockPos pos) {
if (this.isOnPortalCooldown()) {
this.setPortalCooldown();
- } else {
+ } 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());
@@ -4191,7 +4191,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit end
public boolean canUsePortal(boolean allowVehicles) {
- return (allowVehicles || !this.isPassenger()) && this.isAlive();
+ return (allowVehicles || !this.isPassenger()) && this.isAlive() && (this.level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer); // Purpur - Entities can use portals
}
public boolean canTeleport(Level from, Level to) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index b04c1c2534bec8f2eee873b43969843f54644dca..a28548332baf610521a308a560a858b3fc737b60 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -101,12 +101,14 @@ public class PurpurWorldConfig {
public boolean disableDropsOnCrammingDeath = false;
public boolean milkCuresBadOmen = true;
public double tridentLoyaltyVoidReturnHeight = 0.0D;
+ public boolean entitiesCanUsePortals = true;
private void miscGameplayMechanicsSettings() {
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
+ entitiesCanUsePortals = getBoolean("gameplay-mechanics.entities-can-use-portals", entitiesCanUsePortals);
}
public int elytraDamagePerSecond = 1;