47 lines
2.5 KiB
Diff
47 lines
2.5 KiB
Diff
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 configuration
|
|
|
|
Original code by PurpurMC, licensed under MIT
|
|
You can find the original code on https://github.com/PurpurMC/Purpur
|
|
|
|
diff --git a/src/main/java/dev/etil/mirai/MiraiConfig.java b/src/main/java/dev/etil/mirai/MiraiConfig.java
|
|
index a907c023ec88011f2806a9c27bc27e129aa49980..8e720820a94cf5d39e59998700932bfbb5c15544 100644
|
|
--- a/src/main/java/dev/etil/mirai/MiraiConfig.java
|
|
+++ b/src/main/java/dev/etil/mirai/MiraiConfig.java
|
|
@@ -196,4 +196,10 @@ public class MiraiConfig {
|
|
"walking to another block in case they are stuck.");
|
|
}
|
|
|
|
+ public static boolean entitiesCanUsePortals;
|
|
+ private static void entitiesPortal() {
|
|
+ entitiesCanUsePortals = getBoolean("entities-can-use-portals", true,
|
|
+ "Whether or not entities should be able to use portals.");
|
|
+ }
|
|
+
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index e144637e995ed0b4bd336e2c444e2b30e083dc09..d13824eb725f32bdc01aa6d13436c2d1c3528fef 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -2880,7 +2880,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
if (this.isOnPortalCooldown()) {
|
|
if (!(dev.etil.mirai.MiraiConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(portalPos))) // Purpur
|
|
this.setPortalCooldown();
|
|
- } else {
|
|
+ } else if (dev.etil.mirai.MiraiConfig.entitiesCanUsePortals || this instanceof ServerPlayer) { // Purpur
|
|
if (!this.level.isClientSide && !pos.equals(this.portalEntrancePos)) {
|
|
this.portalEntrancePos = pos.immutable();
|
|
portalPos = BlockPos.ZERO; // Purpur
|
|
@@ -3553,7 +3553,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
}
|
|
|
|
public boolean canChangeDimensions() {
|
|
- return isAlive() && valid; // Paper
|
|
+ return isAlive() && valid && (dev.etil.mirai.MiraiConfig.entitiesCanUsePortals || this instanceof ServerPlayer); // Paper // Purpur
|
|
}
|
|
|
|
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
|