mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Add option to teleport to spawn if outside world border
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 13 Jul 2020 11:40:00 -0500
|
||||
Subject: [PATCH] Add option to teleport to spawn if outside world border
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 22b13896d0..3a2a45a659 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -277,6 +277,7 @@ public abstract class EntityLiving extends Entity {
|
||||
double d1 = this.world.getWorldBorder().getDamageAmount();
|
||||
|
||||
if (d1 > 0.0D) {
|
||||
+ if (world.purpurConfig.teleportIfOutsideBorder && this instanceof EntityPlayer) teleportTo((WorldServer) world, world.getSpawn()); else // Purpur
|
||||
this.damageEntity(DamageSource.STUCK, (float) Math.max(1, MathHelper.floor(-d0 * d1)));
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 87b8630315..63d4cf5c44 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -180,6 +180,11 @@ public class PurpurWorldConfig {
|
||||
playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack);
|
||||
}
|
||||
|
||||
+ public boolean teleportIfOutsideBorder = false;
|
||||
+ private void teleportIfOutsideBorder() {
|
||||
+ teleportIfOutsideBorder = getBoolean("gameplay-mechanics.player.teleport-if-outside-border", teleportIfOutsideBorder);
|
||||
+ }
|
||||
+
|
||||
public boolean silkTouchEnabled = false;
|
||||
public List<Item> silkTouchTools = new ArrayList<>();
|
||||
private void silkTouchSettings() {
|
||||
Reference in New Issue
Block a user