@@ -497,15 +497,19 @@ public void usageTick(World world, LivingEntity user, ItemStack stack, int remai
497
497
}
498
498
499
499
for (Entity entity : entities ) {
500
+ if (entity .getCommandTags ().contains (PROJECTILE_MODIFIED .toString ())) {
501
+ return ;
502
+ }
503
+
500
504
// Setting the owner of the trident to someone else would lead to shenanigans, don't do that
501
- if (entity instanceof TridentEntity trident && ! trident . getCommandTags (). contains ( PROJECTILE_MODIFIED . toString ()) ) {
505
+ if (entity instanceof TridentEntity trident ) {
502
506
var bounceVec = trident .getVelocity ().multiply (-0.25 , -0.25 , -0.25 );
503
507
trident .setVelocity (bounceVec .x , bounceVec .y , bounceVec .z );
504
508
trident .returnTimer = 0 ;
505
509
trident .addCommandTag (PROJECTILE_MODIFIED .toString ());
506
510
}
507
511
// Special handling for ExplosiveProjectileEntities, like fireballs
508
- if (entity instanceof ExplosiveProjectileEntity projectile && ! projectile . getCommandTags (). contains ( PROJECTILE_MODIFIED . toString ()) ) {
512
+ if (entity instanceof ExplosiveProjectileEntity projectile ) {
509
513
var bounceVec = projectile .getVelocity ().multiply (-0.25 , -0.25 , -0.25 );
510
514
projectile .setVelocity (bounceVec .x , bounceVec .y , bounceVec .z , 1.05F , 0.5F );
511
515
// projectile.powerX = -projectile.powerX;
@@ -516,15 +520,15 @@ public void usageTick(World world, LivingEntity user, ItemStack stack, int remai
516
520
stack .damage (2 , user , EquipmentSlot .MAINHAND );
517
521
}
518
522
// Shulker bullet handling
519
- if (entity instanceof ShulkerBulletEntity projectile && ! projectile . getCommandTags (). contains ( PROJECTILE_MODIFIED . toString ()) ) {
523
+ if (entity instanceof ShulkerBulletEntity projectile ) {
520
524
projectile .damage (world .getDamageSources ().generic (), 1.0F );
521
525
}
522
526
// Default/Arrow handling
523
- else if (entity instanceof ProjectileEntity projectile && ! projectile . getCommandTags (). contains ( PROJECTILE_MODIFIED . toString ()) ) {
527
+ else if (entity instanceof ProjectileEntity projectile ) {
524
528
// Bounce the projectiles in the direction the player is looking
525
529
var bounceVec = projectile .getVelocity ().multiply (-0.25 , -0.25 , -0.25 );
526
530
projectile .setVelocity (bounceVec .x , bounceVec .y , bounceVec .z , 1.05F , 0.5F );
527
- projectile .getCommandTags (). add (PROJECTILE_MODIFIED .toString ());
531
+ projectile .addCommandTag (PROJECTILE_MODIFIED .toString ());
528
532
stack .damage (1 , user , EquipmentSlot .MAINHAND );
529
533
}
530
534
}
0 commit comments