From e9583f82db056b0dea44c8857279e77edf943dc3 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Tue, 12 Jul 2022 18:01:14 +0200 Subject: [PATCH] Allow trident custom damage --- .../projectile/ThrownTrident.java.patch | 45 ++++++++++++++++--- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownTrident.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownTrident.java.patch index f459f09f46..fff7300b9e 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownTrident.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ThrownTrident.java.patch @@ -10,7 +10,27 @@ public class ThrownTrident extends AbstractArrow { -@@ -76,10 +79,10 @@ +@@ -34,16 +37,19 @@ + + public ThrownTrident(EntityType type, Level world) { + super(type, world); ++ this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage + } + + public ThrownTrident(Level world, LivingEntity owner, ItemStack stack) { + super(EntityType.TRIDENT, owner, world, stack, (ItemStack) null); ++ this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage + this.entityData.set(ThrownTrident.ID_LOYALTY, this.getLoyaltyFromItem(stack)); + this.entityData.set(ThrownTrident.ID_FOIL, stack.hasFoil()); + } + + public ThrownTrident(Level world, double x, double y, double z, ItemStack stack) { + super(EntityType.TRIDENT, x, y, z, world, stack, stack); ++ this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage + this.entityData.set(ThrownTrident.ID_LOYALTY, this.getLoyaltyFromItem(stack)); + this.entityData.set(ThrownTrident.ID_FOIL, stack.hasFoil()); + } +@@ -76,10 +82,10 @@ } } @@ -23,15 +43,17 @@ return; } -@@ -111,6 +114,20 @@ - return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL); - } +@@ -109,8 +115,22 @@ + public boolean isFoil() { + return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL); ++ } ++ + // Paper start + public void setFoil(boolean foil) { + this.entityData.set(ThrownTrident.ID_FOIL, foil); -+ } -+ + } + + public int getLoyalty() { + return this.entityData.get(ThrownTrident.ID_LOYALTY); + } @@ -44,7 +66,16 @@ @Nullable @Override protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) { -@@ -137,7 +154,7 @@ +@@ -120,7 +140,7 @@ + @Override + protected void onHitEntity(EntityHitResult entityHitResult) { + Entity entity = entityHitResult.getEntity(); +- float f = 8.0F; ++ float f = (float) this.getBaseDamage(); // Paper - Allow trident custom damage + Entity entity1 = this.getOwner(); + DamageSource damagesource = this.damageSources().trident(this, (Entity) (entity1 == null ? this : entity1)); + Level world = this.level(); +@@ -137,7 +157,7 @@ world = this.level(); if (world instanceof ServerLevel) {