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

Paper Changes:
12dec20 Bump paerweight to 1.1.7
e33ed89 Get short commit ref using a more proper method
7d6147d Remove now unneeded patch due to paperweight 1.1.7
e72fa41 Update task dependency for includeMappings so the new task isn't skipped
0ad5526 Trim whitspace off of git hash (oops)

Tuinity Changes:
e878ba9 Update paper
2bd2849 Bring back fix codec spam patch
2021-06-27 00:42:39 -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 351a59c2e13f4180fc5eb3e77d9c239d0ae8b165..39f84df6f7a9272c14066dff9145b8ecdafb60db 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 31846035dbfd3320b8ad144e5f2737a0fa9e074c..1a94a68e206eef5f9d4c3e5af49ef03690ee13ea 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -624,6 +624,11 @@ public class PurpurWorldConfig {
furnaceInfiniteFuel = getBoolean("blocks.furnace.infinite-fuel", furnaceInfiniteFuel);
}
+ 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;