63 lines
3.1 KiB
Diff
63 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <novau233@163.com>
|
|
Date: Wed, 7 Feb 2024 00:53:03 +0000
|
|
Subject: [PATCH] Add config for unsafe teleportation
|
|
|
|
|
|
diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..ea10d8d38ecdb791b7b2a748496791c04eff5997
|
|
--- /dev/null
|
|
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java
|
|
@@ -0,0 +1,20 @@
|
|
+package me.earthme.luminol.config.modules.fixes;
|
|
+
|
|
+import me.earthme.luminol.config.ConfigInfo;
|
|
+import me.earthme.luminol.config.EnumConfigCategory;
|
|
+import me.earthme.luminol.config.IConfigModule;
|
|
+
|
|
+public class UnsafeTeleportationConfig implements IConfigModule {
|
|
+ @ConfigInfo(baseName = "enabled")
|
|
+ public static boolean enabled = false;
|
|
+
|
|
+ @Override
|
|
+ public EnumConfigCategory getCategory() {
|
|
+ return EnumConfigCategory.FIXES;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public String getBaseName() {
|
|
+ return "unsafe_teleportation";
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index eade31ea668c171dceafee958e265041a439c54b..6b560754382936d4889e5729613077a3401d8740 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4043,6 +4043,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
|
|
protected boolean tryEndPortal() {
|
|
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
|
|
+ if (me.earthme.luminol.config.modules.fixes.UnsafeTeleportationConfig.enabled && !(this instanceof Player)) return false; //Luminol - Unsafe teleportation
|
|
BlockPos pos = this.portalBlock;
|
|
ServerLevel world = this.portalWorld;
|
|
this.portalBlock = null;
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
index a0c1db8cfebaa0344012cc0af18d6231cdcdcbb8..cb174f06f9701cc4f0ff479649f39ee9aa63a97a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
@@ -61,6 +61,13 @@ public class EndPortalBlock extends BaseEntityBlock {
|
|
// return; // CraftBukkit - always fire event in case plugins wish to change it
|
|
}
|
|
|
|
+ //Luminol start - Unsafe teleportation
|
|
+ if (me.earthme.luminol.config.modules.fixes.UnsafeTeleportationConfig.enabled && !(entity instanceof net.minecraft.world.entity.player.Player)){
|
|
+ entity.endPortalLogicAsync();
|
|
+ return;
|
|
+ }
|
|
+ //Luminol end - Unsafe teleportation
|
|
+
|
|
// Paper start - move all of this logic into portal tick
|
|
entity.portalWorld = ((ServerLevel)world);
|
|
entity.portalBlock = pos.immutable();
|