Skip to content

Commit

Permalink
fix: add casting ability sound on channeled instant cast
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed May 5, 2022
1 parent e3e887e commit 7294e90
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.level.GameType;
import net.minecraftforge.network.NetworkEvent;

Expand Down Expand Up @@ -70,6 +71,9 @@ public static void handle(ServerAbilityChannelPacket msg, Supplier<NetworkEvent.
} else if(msg.status == ChannelStatus.MIN_ACTIVATE) {
if (ability instanceof Ability.Channeled channeled && channeled.canActivateBelowMinCharge()) {
if(ability.handleCost(player, ninjaData, 0)) {
if (ability.castingSound() != null) {
player.getLevel().playSound(null, player, ability.castingSound(), SoundSource.PLAYERS, 0.5f, 1.0f);
}
player.sendMessage(new TranslatableComponent("jutsu.cast", new TranslatableComponent(ability.getTranslationKey()).withStyle(ChatFormatting.YELLOW)).withStyle(ChatFormatting.GREEN), player.getUUID());
ability.performServer(player, ninjaData, 0);
}
Expand Down

0 comments on commit 7294e90

Please sign in to comment.