From b3d374f819851f79d1e8eebb496ec66a9bcd2c68 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 13 Nov 2022 05:06:06 -0600 Subject: [PATCH] Add option to teleport to spawn on nether ceiling damage --- ...leport-to-spawn-on-nether-ceiling-da.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 patches/server/0313-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch diff --git a/patches/server/0313-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch b/patches/server/0313-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch new file mode 100644 index 0000000000..0a70c78218 --- /dev/null +++ b/patches/server/0313-Add-option-to-teleport-to-spawn-on-nether-ceiling-da.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 13 Nov 2022 05:05:34 -0600 +Subject: [PATCH] Add option to teleport to spawn on nether ceiling damage + + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 9f3a065a24d2e8cc2ea7ae307545af013fdbbf1b..193b6621d6506a04bc1f9f23571aeb2e635d562c 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -419,7 +419,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + public int activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; // golf score + public final BlockPos.MutableBlockPos cachedBlockPos = new BlockPos.MutableBlockPos(); // used where needed + // Pufferfish end +- ++ + public float getBukkitYaw() { + return this.yRot; + } +@@ -896,6 +896,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) + && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { + // Paper end ++ if (level.purpurConfig.teleportOnNetherCeilingDamage && this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER) ((ServerPlayer) this).teleport(MCUtil.toLocation(level, level.getSharedSpawnPos())); else // Purpur + this.outOfWorld(); + } + +diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +index 3409480d4e01db19e3e54474c9e122232043e4b0..bb352ed86e4047e38ad27900f72fc0ddb741bf71 100644 +--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java ++++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +@@ -418,6 +418,7 @@ public class PurpurWorldConfig { + public String playerDeathExpDropEquation = "expLevel * 7"; + public int playerDeathExpDropMax = 100; + public boolean teleportIfOutsideBorder = false; ++ public boolean teleportOnNetherCeilingDamage = false; + public boolean totemOfUndyingWorksInInventory = false; + public boolean playerFixStuckPortal = false; + public boolean creativeOnePunch = false; +@@ -449,6 +450,7 @@ public class PurpurWorldConfig { + playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation); + playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax); + teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder); ++ teleportOnNetherCeilingDamage = getBoolean("gameplay-mechanics.player.teleport-on-nether-ceiling-damage", teleportOnNetherCeilingDamage); + totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory); + playerFixStuckPortal = getBoolean("gameplay-mechanics.player.fix-stuck-in-portal", playerFixStuckPortal); + creativeOnePunch = getBoolean("gameplay-mechanics.player.one-punch-in-creative", creativeOnePunch);