Purpur/patches/server/0048-Add-option-to-allow-loyalty-on-tridents-to-work-in-t.patch
2023-08-13 07:50:23 -07:00

36 lines
2.4 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] Add option to allow loyalty on tridents to work in the void
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 454dd67920826b8b62c2654abfd43fc08c2648e4..0ea182962d6647629fc98c9e7406f7b7ce012c5e 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
@@ -60,7 +60,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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 0549181f25cc9a31ea6ad9da8170c983667d6bb3..a7eee5311c4a697c1effcbb9a65f45529ab65c49 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -97,9 +97,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 double minecartMaxSpeed = 0.4D;