|
11 | 11 | public class TridentMixin { |
12 | 12 | // Forge doesn't support the @ModityArgs annotation, so we have to chain multiple @ModifyArg |
13 | 13 | @ModifyArg(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;addVelocity(DDD)V"), index = 0) |
14 | | - private double modifyVelocity0(double velocity) { return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.INSTANCE.getTridentSpeed() : velocity; } |
| 14 | + private double modifyVelocity0(double velocity) { |
| 15 | + return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.getTridentSpeed() : velocity; |
| 16 | + } |
15 | 17 |
|
16 | 18 | @ModifyArg(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;addVelocity(DDD)V"), index = 1) |
17 | | - private double modifyVelocity1(double velocity) { return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.INSTANCE.getTridentSpeed() : velocity; } |
| 19 | + private double modifyVelocity1(double velocity) { |
| 20 | + return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.getTridentSpeed() : velocity; |
| 21 | + } |
18 | 22 |
|
19 | 23 | @ModifyArg(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;addVelocity(DDD)V"), index = 2) |
20 | | - private double modifyVelocity2(double velocity) { return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.INSTANCE.getTridentSpeed() : velocity; } |
| 24 | + private double modifyVelocity2(double velocity) { |
| 25 | + return TridentBoost.INSTANCE.isEnabled() ? velocity * TridentBoost.getTridentSpeed() : velocity; |
| 26 | + } |
21 | 27 |
|
22 | 28 | @ModifyExpressionValue(method = {"onStoppedUsing", "use"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isTouchingWaterOrRain()Z")) |
23 | | - private boolean modifyIsTouchingWaterOrRain(boolean original) { return TridentBoost.INSTANCE.isEnabled() ? TridentBoost.INSTANCE.getForceUse() : original; } |
| 29 | + private boolean modifyIsTouchingWaterOrRain(boolean original) { |
| 30 | + return TridentBoost.INSTANCE.isEnabled() && TridentBoost.getForceUse() || original; |
| 31 | + } |
| 32 | + |
| 33 | + @ModifyArg(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;useRiptide(I)V")) |
| 34 | + private int modifyRiptide(int riptide) { |
| 35 | + return TridentBoost.INSTANCE.isEnabled() ? TridentBoost.getDelay() : riptide; |
| 36 | + } |
24 | 37 | } |
0 commit comments