Files
Shiroha/shiroha-server/minecraft-patches/features/0038-Add-config-for-unsafe-teleportation.patch
T

46 lines
3.1 KiB
Diff
Raw Normal View History

2026-07-09 00:03:09 +08:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bacteriawa <A3167717663@hotmail.com>
Date: Tue, 21 Apr 2026 01:47:51 +0800
Subject: [PATCH] Add config for unsafe teleportation
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
2026-07-14 15:09:17 +08:00
index 480b6b2405706fd4d7158d0e160adafd84099887..51ccfda1d7579cb4109d78e3cc3942d02a5d9d29 100644
2026-07-09 00:03:09 +08:00
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -70,7 +70,7 @@ public class FallingBlockEntity extends Entity {
public int fallDamageMax = 40;
public float fallDamagePerDistance = 0.0F;
public @Nullable CompoundTag blockData;
- public boolean forceTickAfterTeleportToDuplicate;
2026-07-14 12:22:17 +08:00
+ public boolean forceTickAfterTeleportToDuplicate = io.nanachiyo0721.shiroha.config.modules.fixes.UnsafeTeleportationConfig.enabled; // Shiroha - Add config for unsafe teleportation
2026-07-09 00:03:09 +08:00
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
public boolean autoExpire = true; // Paper - Expand FallingBlock API
@@ -384,7 +384,7 @@ public class FallingBlockEntity extends Entity {
ResourceKey<Level> oldDimension = this.level().dimension();
boolean fromOrToEnd = (oldDimension == Level.END || newDimension == Level.END) && oldDimension != newDimension;
Entity newEntity = super.teleport(transition);
- this.forceTickAfterTeleportToDuplicate = newEntity != null && fromOrToEnd && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation; // Paper
2026-07-14 12:22:17 +08:00
+ this.forceTickAfterTeleportToDuplicate = newEntity != null && fromOrToEnd && (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation || io.nanachiyo0721.shiroha.config.modules.fixes.UnsafeTeleportationConfig.enabled); // Paper // Shiroha - Add config for unsafe teleportation
2026-07-09 00:03:09 +08:00
return newEntity;
}
}
diff --git a/net/minecraft/world/level/block/EndPortalBlock.java b/net/minecraft/world/level/block/EndPortalBlock.java
2026-07-27 20:47:44 +08:00
index 123df098fa987030fe3789f36ff95aeee2979834..4c92fee3fbb3d739a9ed962d39395a118db853fa 100644
2026-07-09 00:03:09 +08:00
--- a/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/net/minecraft/world/level/block/EndPortalBlock.java
@@ -76,6 +76,12 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
if (level.paperConfig().misc.disableEndCredits) {player.seenCredits = true; return;} // Paper - Option to disable end credits
player.showEndCredits();
} else {
2026-07-14 11:32:51 +08:00
+ // Shiroha start - Add config for unsafe teleportation
2026-07-14 12:22:17 +08:00
+ if (io.nanachiyo0721.shiroha.config.modules.fixes.UnsafeTeleportationConfig.enabled && !(entity instanceof net.minecraft.world.entity.player.Player)) {
2026-07-09 00:03:09 +08:00
+ entity.endPortalLogicAsync(pos);
+ return;
+ }
2026-07-14 11:32:51 +08:00
+ // Shiroha end
2026-07-09 00:03:09 +08:00
entity.setAsInsidePortal(this, pos);
}
}