mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
63 lines
3.3 KiB
Diff
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 f6d5d0ebc598d57a5476dbbd47b930d76d27cce7..ebe13267573fbf04d11143a6fcbed3d1a8b2ee5d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -2934,7 +2934,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
}
|
|
|
|
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 04bae5085756842ce88710646a17e9dc1aad5994..e7658fa9806701505e15cbf1d28ea3bd2ed6f113 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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 6d6b3105e8fe2f69ef8d8b94ee22b7f3bce4416f..dd632b6282eeded3941a9f55d543017d573d1b99 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -633,6 +633,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 mobsSpawnOnPackedIce = true;
|
|
public boolean mobsSpawnOnBlueIce = true;
|
|
private void iceSettings() {
|