Skip to content

Commit

Permalink
Add option to teleport to spawn on nether ceiling damage
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyGalbreath committed Nov 13, 2022
1 parent 85bc4a4 commit b3d374f
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
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);

0 comments on commit b3d374f

Please sign in to comment.