取消攻击动作的摇手

This commit is contained in:
17146 2025-05-24 14:46:54 +08:00 committed by Light_Quanta
parent 8ad6966ed6
commit 833bb8a85e
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -8,7 +8,6 @@ import net.minecraft.core.UUIDUtil;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.neoforged.neoforge.network.handling.IPayloadContext;
@ -32,7 +31,6 @@ public record MeleeAttackMessage(UUID uuid) implements CustomPacketPayload {
if (lookingEntity != null) {
player.level().playSound(null, lookingEntity.getOnPos(), ModSounds.MELEE_HIT.get(), SoundSource.PLAYERS, 1, (float) ((2 * org.joml.Math.random() - 1) * 0.1f + 1.0f));
player.attack(lookingEntity);
player.swing(InteractionHand.MAIN_HAND, true);
}
}