Add option to allow loyalty on tridents to work in the void

This commit is contained in:
William Blake Galbreath
2025-01-05 15:44:14 -08:00
committed by granny
parent 676b9dbb76
commit 97698faa02
3 changed files with 13 additions and 35 deletions

View File

@@ -1,35 +0,0 @@
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/net/minecraft/world/entity/projectile/ThrownTrident.java b/net/minecraft/world/entity/projectile/ThrownTrident.java
index 1e045397763e8233c2e8f9955468788374b80068..3573a6cf0632dfb6859f5a5e7ceffb947e9d3692 100644
--- a/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/net/minecraft/world/entity/projectile/ThrownTrident.java
@@ -70,7 +70,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()) {
Level world = this.level();
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 6daa99bb60723af0eb38b625ab0cd24d33d7552a..bdf391eda89bc061353c0fd72ab5a9c5fe85e55e 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -98,9 +98,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;

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/net/minecraft/world/entity/projectile/ThrownTrident.java
@@ -64,7 +_,7 @@
Entity owner = this.getOwner();
int i = this.entityData.get(ID_LOYALTY);
- if (i > 0 && (this.dealtDamage || this.isNoPhysics()) && owner != null) {
+ if (i > 0 && (this.dealtDamage || this.isNoPhysics() || (level().purpurConfig.tridentLoyaltyVoidReturnHeight < 0.0D && getY() < level().purpurConfig.tridentLoyaltyVoidReturnHeight)) && owner != null) { // Purpur - Add option to allow loyalty on tridents to work in the void
if (!this.isAcceptibleReturnOwner()) {
if (this.level() instanceof ServerLevel serverLevel && this.pickup == AbstractArrow.Pickup.ALLOWED) {
this.spawnAtLocation(serverLevel, this.getPickupItem(), 0.1F);

View File

@@ -86,9 +86,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;