--- a/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/net/minecraft/world/entity/projectile/ThrownTrident.java
@@ -13,6 +13,7 @@
 import net.minecraft.world.damagesource.DamageSource;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.EquipmentSlot;
 import net.minecraft.world.entity.LivingEntity;
 import net.minecraft.world.entity.player.Player;
 import net.minecraft.world.item.ItemStack;
@@ -22,8 +23,12 @@
 import net.minecraft.world.phys.BlockHitResult;
 import net.minecraft.world.phys.EntityHitResult;
 import net.minecraft.world.phys.Vec3;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRemoveEvent;
+// CraftBukkit end
 
 public class ThrownTrident extends AbstractArrow {
+
     private static final EntityDataAccessor<Byte> ID_LOYALTY = SynchedEntityData.defineId(ThrownTrident.class, EntityDataSerializers.BYTE);
     private static final EntityDataAccessor<Boolean> ID_FOIL = SynchedEntityData.defineId(ThrownTrident.class, EntityDataSerializers.BOOLEAN);
     public boolean dealtDamage;
@@ -31,25 +36,28 @@
 
     public ThrownTrident(EntityType<? extends ThrownTrident> 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, null);
-        this.entityData.set(ID_LOYALTY, this.getLoyaltyFromItem(stack));
-        this.entityData.set(ID_FOIL, stack.hasFoil());
+        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.entityData.set(ID_LOYALTY, this.getLoyaltyFromItem(stack));
-        this.entityData.set(ID_FOIL, stack.hasFoil());
+        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());
     }
 
     @Override
     protected void defineSynchedData(SynchedEntityData.Builder builder) {
         super.defineSynchedData(builder);
-        builder.define(ID_LOYALTY, (byte)0);
-        builder.define(ID_FOIL, false);
+        builder.define(ThrownTrident.ID_LOYALTY, (byte) 0);
+        builder.define(ThrownTrident.ID_FOIL, false);
     }
 
     @Override
@@ -59,29 +67,32 @@
         }
 
         Entity entity = this.getOwner();
-        int i = this.entityData.get(ID_LOYALTY);
-        if (i > 0 && (this.dealtDamage || this.isNoPhysics()) && entity != null) {
+        byte b0 = (Byte) this.entityData.get(ThrownTrident.ID_LOYALTY);
+
+        if (b0 > 0 && (this.dealtDamage || this.isNoPhysics()) && entity != null) {
             if (!this.isAcceptibleReturnOwner()) {
                 if (!this.level().isClientSide && this.pickup == AbstractArrow.Pickup.ALLOWED) {
                     this.spawnAtLocation(this.getPickupItem(), 0.1F);
                 }
 
-                this.discard();
+                this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause
             } else {
                 this.setNoPhysics(true);
-                Vec3 vec3 = entity.getEyePosition().subtract(this.position());
-                this.setPosRaw(this.getX(), this.getY() + vec3.y * 0.015 * (double)i, this.getZ());
+                Vec3 vec3d = entity.getEyePosition().subtract(this.position());
+
+                this.setPosRaw(this.getX(), this.getY() + vec3d.y * 0.015D * (double) b0, this.getZ());
                 if (this.level().isClientSide) {
                     this.yOld = this.getY();
                 }
 
-                double d = 0.05 * (double)i;
-                this.setDeltaMovement(this.getDeltaMovement().scale(0.95).add(vec3.normalize().scale(d)));
+                double d0 = 0.05D * (double) b0;
+
+                this.setDeltaMovement(this.getDeltaMovement().scale(0.95D).add(vec3d.normalize().scale(d0)));
                 if (this.clientSideReturnTridentTickCount == 0) {
                     this.playSound(SoundEvents.TRIDENT_RETURN, 10.0F, 1.0F);
                 }
 
-                this.clientSideReturnTridentTickCount++;
+                ++this.clientSideReturnTridentTickCount;
             }
         }
 
@@ -90,13 +101,28 @@
 
     private boolean isAcceptibleReturnOwner() {
         Entity entity = this.getOwner();
-        return entity != null && entity.isAlive() && (!(entity instanceof ServerPlayer) || !entity.isSpectator());
+
+        return entity != null && entity.isAlive() ? !(entity instanceof ServerPlayer) || !entity.isSpectator() : false;
     }
 
     public boolean isFoil() {
-        return this.entityData.get(ID_FOIL);
+        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);
+    }
+
+    public void setLoyalty(byte loyalty) {
+        this.entityData.set(ThrownTrident.ID_LOYALTY, loyalty);
+    }
+    // Paper end
+
     @Nullable
     @Override
     protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
@@ -106,46 +132,54 @@
     @Override
     protected void onHitEntity(EntityHitResult entityHitResult) {
         Entity entity = entityHitResult.getEntity();
-        float f = 8.0F;
-        Entity entity2 = this.getOwner();
-        DamageSource damageSource = this.damageSources().trident(this, (Entity)(entity2 == null ? this : entity2));
-        if (this.level() instanceof ServerLevel serverLevel) {
-            f = EnchantmentHelper.modifyDamage(serverLevel, this.getWeaponItem(), entity, damageSource, f);
+        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();
+
+        if (world instanceof ServerLevel worldserver) {
+            f = EnchantmentHelper.modifyDamage(worldserver, this.getWeaponItem(), entity, damagesource, f);
         }
 
         this.dealtDamage = true;
-        if (entity.hurt(damageSource, f)) {
+        if (entity.hurt(damagesource, f)) {
             if (entity.getType() == EntityType.ENDERMAN) {
                 return;
             }
 
-            if (this.level() instanceof ServerLevel serverLevel2) {
-                EnchantmentHelper.doPostAttackEffectsWithItemSource(serverLevel2, entity, damageSource, this.getWeaponItem());
+            world = this.level();
+            if (world instanceof ServerLevel) {
+                ServerLevel worldserver = (ServerLevel) world; // CraftBukkit - decompile error
+                EnchantmentHelper.doPostAttackEffectsWithItemSource(worldserver, entity, damagesource, this.getWeaponItem());
             }
 
-            if (entity instanceof LivingEntity livingEntity) {
-                this.doKnockback(livingEntity, damageSource);
-                this.doPostHurtEffects(livingEntity);
+            if (entity instanceof LivingEntity) {
+                LivingEntity entityliving = (LivingEntity) entity;
+
+                this.doKnockback(entityliving, damagesource);
+                this.doPostHurtEffects(entityliving);
             }
         }
 
-        this.setDeltaMovement(this.getDeltaMovement().multiply(-0.01, -0.1, -0.01));
+        this.setDeltaMovement(this.getDeltaMovement().multiply(-0.01D, -0.1D, -0.01D));
         this.playSound(SoundEvents.TRIDENT_HIT, 1.0F, 1.0F);
     }
 
     @Override
     protected void hitBlockEnchantmentEffects(ServerLevel world, BlockHitResult blockHitResult, ItemStack weaponStack) {
-        Vec3 vec3 = blockHitResult.getBlockPos().clampLocationWithin(blockHitResult.getLocation());
-        EnchantmentHelper.onHitBlock(
-            world,
-            weaponStack,
-            this.getOwner() instanceof LivingEntity livingEntity ? livingEntity : null,
-            this,
-            null,
-            vec3,
-            world.getBlockState(blockHitResult.getBlockPos()),
-            item -> this.kill()
-        );
+        Vec3 vec3d = blockHitResult.getBlockPos().clampLocationWithin(blockHitResult.getLocation());
+        Entity entity = this.getOwner();
+        LivingEntity entityliving;
+
+        if (entity instanceof LivingEntity entityliving1) {
+            entityliving = entityliving1;
+        } else {
+            entityliving = null;
+        }
+
+        EnchantmentHelper.onHitBlock(world, weaponStack, entityliving, this, (EquipmentSlot) null, vec3d, world.getBlockState(blockHitResult.getBlockPos()), (item) -> {
+            this.kill();
+        });
     }
 
     @Override
@@ -173,13 +207,14 @@
         if (this.ownedBy(player) || this.getOwner() == null) {
             super.playerTouch(player);
         }
+
     }
 
     @Override
     public void readAdditionalSaveData(CompoundTag nbt) {
         super.readAdditionalSaveData(nbt);
         this.dealtDamage = nbt.getBoolean("DealtDamage");
-        this.entityData.set(ID_LOYALTY, this.getLoyaltyFromItem(this.getPickupItemStackOrigin()));
+        this.entityData.set(ThrownTrident.ID_LOYALTY, this.getLoyaltyFromItem(this.getPickupItemStackOrigin()));
     }
 
     @Override
@@ -189,17 +224,23 @@
     }
 
     private byte getLoyaltyFromItem(ItemStack stack) {
-        return this.level() instanceof ServerLevel serverLevel
-            ? (byte)Mth.clamp(EnchantmentHelper.getTridentReturnToOwnerAcceleration(serverLevel, stack, this), 0, 127)
-            : 0;
+        Level world = this.level();
+
+        if (world instanceof ServerLevel worldserver) {
+            return (byte) Mth.clamp(EnchantmentHelper.getTridentReturnToOwnerAcceleration(worldserver, stack, this), 0, 127);
+        } else {
+            return 0;
+        }
     }
 
     @Override
     public void tickDespawn() {
-        int i = this.entityData.get(ID_LOYALTY);
-        if (this.pickup != AbstractArrow.Pickup.ALLOWED || i <= 0) {
+        byte b0 = (Byte) this.entityData.get(ThrownTrident.ID_LOYALTY);
+
+        if (this.pickup != AbstractArrow.Pickup.ALLOWED || b0 <= 0) {
             super.tickDespawn();
         }
+
     }
 
     @Override
