Fixed shoot pattern overrides not working in mods

This commit is contained in:
Anuken
2023-04-08 21:37:33 -04:00
parent 34b22f292c
commit b692c071ba
2 changed files with 6 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ public class ShootMulti extends ShootPattern{
if(move != null) move.move(b); if(move != null) move.move(b);
if(mover != null) mover.move(b); if(mover != null) mover.move(b);
}); });
}); }, null);
} }
}, barrelIncrementer); }, barrelIncrementer);
} }

View File

@@ -14,14 +14,15 @@ public class ShootPattern implements Cloneable{
/** Called on a single "trigger pull". This function should call the handler with any bullets that result. */ /** Called on a single "trigger pull". This function should call the handler with any bullets that result. */
public void shoot(int totalShots, BulletHandler handler, @Nullable Runnable barrelIncrementer){ public void shoot(int totalShots, BulletHandler handler, @Nullable Runnable barrelIncrementer){
for(int i = 0; i < shots; i++){ //the default implementation calls the "soft deprecated" variant for mod compatibility, so overrides from older mods can function properly
handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i); shoot(totalShots, handler);
}
} }
/** Called on a single "trigger pull". This function should call the handler with any bullets that result. */ /** Called on a single "trigger pull". This function should call the handler with any bullets that result. */
public void shoot(int totalShots, BulletHandler handler){ public void shoot(int totalShots, BulletHandler handler){
shoot(totalShots, handler, null); for(int i = 0; i < shots; i++){
handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i);
}
} }
/** Subclasses should override this to flip its sides. */ /** Subclasses should override this to flip its sides. */