74 lines
4.2 KiB
Diff
74 lines
4.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <wangxyper@163.com>
|
|
Date: Sat, 30 Nov 2024 11:26:36 +0800
|
|
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..865ffe0051d84ac9018ab54a54894c2fe8fd573e
|
|
--- /dev/null
|
|
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/UnsafeTeleportationConfig.java
|
|
@@ -0,0 +1,22 @@
|
|
+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", comments = "Allow non player entities enter end portals if enabled.\n" +
|
|
+ "If you want to use sand duping,please turn on this.\n" +
|
|
+ "Warning: This would cause some unsafe issues, you could learn more on : https://github.com/PaperMC/Folia/issues/297")
|
|
+ public static boolean enabled = false;
|
|
+
|
|
+ @Override
|
|
+ public EnumConfigCategory getCategory() {
|
|
+ return EnumConfigCategory.FIXES;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public String getBaseName() {
|
|
+ return "allow_unsafe_teleportation";
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
index a498cdbe42df3161c35b2a1652dfa63693366bd6..76e8eca1229430742c6c2557d481fb98c570a8bc 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
@@ -69,7 +69,7 @@ public class FallingBlockEntity extends Entity {
|
|
public float fallDamagePerDistance;
|
|
@Nullable
|
|
public CompoundTag blockData;
|
|
- public boolean forceTickAfterTeleportToDuplicate;
|
|
+ public boolean forceTickAfterTeleportToDuplicate = me.earthme.luminol.config.modules.fixes.UnsafeTeleportationConfig.enabled; // Luminol - Unsafe teleportation
|
|
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
|
|
public boolean autoExpire = true; // Paper - Expand FallingBlock API
|
|
|
|
@@ -430,7 +430,7 @@ public class FallingBlockEntity extends Entity {
|
|
boolean flag = (resourcekey1 == Level.END || resourcekey == Level.END) && resourcekey1 != resourcekey;
|
|
Entity entity = super.teleport(teleportTarget);
|
|
|
|
- this.forceTickAfterTeleportToDuplicate = entity != null && flag && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation; // Paper
|
|
+ this.forceTickAfterTeleportToDuplicate = entity != null && flag && (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation || me.earthme.luminol.config.modules.fixes.UnsafeTeleportationConfig.enabled); // Paper // Luminol - Unsafe teleportation
|
|
return entity;
|
|
}
|
|
}
|
|
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 45b8ac1418864ea32bd625b0d57fcec288ea5b0c..96dfc7062c2b0d371717c2042bf7c8e8b32e8716 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
@@ -76,7 +76,11 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
|
|
if (event.isCancelled()) return; // Paper - make cancellable
|
|
// CraftBukkit end
|
|
// Folia - region threading - do not show credits
|
|
-
|
|
+ // Luminol start - unsafe teleportation
|
|
+ if (me.earthme.luminol.config.modules.fixes.UnsafeTeleportationConfig.enabled && !(entity instanceof net.minecraft.world.entity.player.Player)) {
|
|
+ entity.endPortalLogicAsync(pos);
|
|
+ }
|
|
+ // Luminol end
|
|
entity.setAsInsidePortal(this, pos);
|
|
}
|
|
|