Files
Purpur/patches/server/0058-FEAT-Allow-tridents-loyalty-to-work-in-the-void.patch
2021-09-16 15:17:30 -07:00

45 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 19 Mar 2020 19:39:34 -0500
Subject: [PATCH] |FEAT| Allow tridents' loyalty to work in the void
If a trident with loyalty gets throw into the void it will come back to you instead of die
$-----------------------------$
option:
default: 0.0
description: |-
The void height at which a trident with loyalty will return to it's thrower.
A value of 0.0 or higher disables this feature.
$-----------------------------$
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
index c95eef8596fe3e1ca83e620a6c54b164c797cbe1..1e6a5404d767318de29184b3e3a2bc41c1ee2602 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
@@ -61,7 +61,7 @@ public class ThrownTrident extends AbstractArrow {
Entity entity = this.getOwner();
byte b0 = (Byte) this.entityData.get(ThrownTrident.ID_LOYALTY);
- if (b0 > 0 && (this.dealtDamage || this.isNoPhysics()) && entity != null) {
+ if (b0 > 0 && (this.dealtDamage || this.isNoPhysics() || (level.purpurConfig.tridentLoyaltyVoidReturnHeight < 0.0D && getY() < level.purpurConfig.tridentLoyaltyVoidReturnHeight)) && entity != null) { // Purpur
if (!this.isAcceptibleReturnOwner()) {
if (!this.level.isClientSide && this.pickup == AbstractArrow.Pickup.ALLOWED) {
this.spawnAtLocation(this.getPickupItem(), 0.1F);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index ba2d49771e317d52b46868372572f59bf2fc3394..1ff4e926accf8029315d5d2ffd209f62b16fd729 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -217,9 +217,11 @@ public class PurpurWorldConfig {
public boolean disableDropsOnCrammingDeath = false;
public boolean milkCuresBadOmen = true;
+ public double tridentLoyaltyVoidReturnHeight = 0.0D;
private void miscGameplayMechanicsSettings() {
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
+ tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
}
public boolean farmlandGetsMoistFromBelow = false;