Files
Purpur/patches/server/0210-Add-toggle-for-end-portal-safe-teleporting.patch
William Blake Galbreath 31306b4b0e Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
b79bc31 Fix MerchantOffer BuyB Only AssertionError (#6206)
d6c81c8 Don't apply cramming damage to players (#5903)
12942dc Add rate options and timings for sensors and behaviors (#6027)
fc47872 Use mapped names for sensor and behavior timings/config (#6228)
c75a837 Don't expose ASM in API (#6229)
c225bf9 Fix book title and author being improperly serialized as components (#6190)
f25facb Update email & name (DenWav)
44516b1 [ci skip] Put mappings util in a separate class to the stacktrace deobfuscator
2021-07-21 10:49:20 -05:00

63 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Wed, 9 Jun 2021 11:03:40 -0500
Subject: [PATCH] Add toggle for end portal safe teleporting
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 010a47813b2b3dbc0739c203e4186d14cc780579..d209a7b09d8429573c93af3d6159f30e6bc877ec 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2749,7 +2749,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
this.processPortalCooldown();
- this.tickEndPortal(); // Paper - make end portalling safe
+ if (this.level.purpurConfig.endPortalSafeTeleporting) this.tickEndPortal(); // Paper - make end portalling safe // Purpur
}
}
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 197482e1ace23c3de002242097a68c6cc297cd3f..428875a6a99a619d337e2a7bbd2cb1828ca11d04 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,22 @@ public class EndPortalBlock extends BaseEntityBlock {
// return; // CraftBukkit - always fire event in case plugins wish to change it
}
+ // Purpur start
+ if (!world.purpurConfig.endPortalSafeTeleporting) {
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (entity instanceof ServerPlayer) {
+ ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ return;
+ }
+ // CraftBukkit end
+ entity.changeDimension(worldserver);
+ return;
+ }
+ // Purpur end
+
// Paper start - move all of this logic into portal tick
entity.portalWorld = ((ServerLevel)world);
entity.portalBlock = pos.immutable();
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 0a267f30625462badeec3a4da290f2dbc1260805..762ede20fe7076da8b7c69707fbe779b7c5f7956 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -642,6 +642,11 @@ public class PurpurWorldConfig {
furnaceUseLavaFromUnderneath = getBoolean("blocks.furnace.use-lava-from-underneath", furnaceUseLavaFromUnderneath);
}
+ public boolean endPortalSafeTeleporting = true;
+ private void endPortalSettings() {
+ endPortalSafeTeleporting = getBoolean("blocks.end_portal.safe-teleporting", endPortalSafeTeleporting);
+ }
+
public boolean snowOnBlueIce = true;
public boolean mobsSpawnOnPackedIce = true;
public boolean mobsSpawnOnBlueIce = true;