Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
loader_version=0.14.19
minecraft_version=1.20.1
loader_version=0.14.22

# Mod Properties
mod_version = 0.0.6-1.19.4
mod_version = 0.0.6-1.20.1
maven_group = com.sydokiddo
archives_base_name = auditory

# Dependencies
fabric_version=0.77.0+1.19.4
modmenu_version=6.1.0-rc.4
cloth_version = 10.0.96
fabric_version=0.86.1+1.20.1
modmenu_version=7.2.1
cloth_version = 11.1.106
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.sydokiddo.auditory.Auditory;
Expand All @@ -24,7 +25,7 @@ public abstract class FallOnBlockMixin {
private void auditory_fallSound(Level level, BlockState blockState, BlockPos blockPos, Entity entity, float f, CallbackInfo ci) {
if (Auditory.getConfig().block_sounds.falling_in_place_sound) {
if (!entity.isCrouching() && entity instanceof LivingEntity && entity.getDeltaMovement().horizontalDistance() >= 0) {
if (!blockState.isAir() && !blockState.is(BlockTags.FIRE) && !blockState.is(BlockTags.PORTALS) && (!blockState.getMaterial().isLiquid())) {
if (!blockState.isAir() && !blockState.is(BlockTags.FIRE) && !blockState.is(BlockTags.PORTALS) && (!(blockState.getBlock() instanceof LiquidBlock))) {
SoundType soundType = blockState.getSoundType();
level.playSound(null, blockPos, soundType.getStepSound(), SoundSource.BLOCKS, soundType.getVolume() * 0.15F, soundType.getPitch());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected ItemDropSoundMixin(EntityType<? extends LivingEntity> entityType, Leve
@Inject(method = "drop(Lnet/minecraft/world/item/ItemStack;ZZ)Lnet/minecraft/world/entity/item/ItemEntity;", at = @At("TAIL"))
private void auditory_itemDropSound(ItemStack itemStack, boolean bl, boolean bl2, CallbackInfoReturnable<ItemEntity> cir) {
if (!this.isDeadOrDying() && !this.isRemoved() && Auditory.getConfig().misc_sounds.item_drop_sounds) {
this.playNotifySound(ModSoundEvents.ENTITY_PLAYER_DROP_ITEM, SoundSource.PLAYERS, 0.4F, 1.0F + level.random.nextFloat() * 0.4F);
this.playNotifySound(ModSoundEvents.ENTITY_PLAYER_DROP_ITEM, SoundSource.PLAYERS, 0.4F, 1.0F + level().random.nextFloat() * 0.4F);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class BowPullbackSound {
@Inject(method = "use", at = @At(value = "RETURN", target = "Lnet/minecraft/world/entity/player/Player;startUsingItem(Lnet/minecraft/world/InteractionHand;)V"))
private void auditory_pullbackSound(Level level, Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResultHolder<ItemStack>> cir) {
if (Auditory.getConfig().weapon_sounds.bow_pullback_sounds) {
level.playSound(null, player.getOnPos(), ModSoundEvents.ITEM_BOW_PULLING, SoundSource.PLAYERS, 0.3F, 0.8f + player.level.random.nextFloat() * 0.4F);
level.playSound(null, player.getOnPos(), ModSoundEvents.ITEM_BOW_PULLING, SoundSource.PLAYERS, 0.3F, 0.8f + player.level().random.nextFloat() * 0.4F);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ protected LeadAttachSoundMixin(EntityType<? extends LivingEntity> entityType, Le
@Inject(method = "setLeashedTo", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;broadcast(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/network/protocol/Packet;)V"))
private void auditory_leashSound(Entity entity, boolean bl, CallbackInfo ci) {
if (Auditory.getConfig().item_sounds.lead_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.LEASH_KNOT_PLACE, SoundSource.NEUTRAL, 0.5F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.LEASH_KNOT_PLACE, SoundSource.NEUTRAL, 0.5F, 0.8f + this.level().random.nextFloat() * 0.4F);
}
}

@Inject(method = "interact", at = @At(value = "INVOKE", target = "net/minecraft/world/entity/Mob.dropLeash(ZZ)V", shift = Shift.AFTER))
private void auditory_unleashSound(Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResult> cir) {
if (Auditory.getConfig().item_sounds.lead_sounds) {
level.playSound(player, this.getX(), this.getY(), this.getZ(), SoundEvents.LEASH_KNOT_BREAK, SoundSource.NEUTRAL, 0.5F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(player, this.getX(), this.getY(), this.getZ(), SoundEvents.LEASH_KNOT_BREAK, SoundSource.NEUTRAL, 0.5F, 0.8f + this.level().random.nextFloat() * 0.4F);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.world.level.Level;
import net.sydokiddo.auditory.Auditory;
import net.sydokiddo.auditory.sound.ModSoundEvents;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -29,14 +30,14 @@ public ShieldSoundsMixin(Properties properties) {
@Inject(at = @At("HEAD"), method = "use")
private void auditory_blockSound(Level level, Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResultHolder<ItemStack>> cir) {
if (Auditory.getConfig().weapon_sounds.shield_blocking_sounds) {
level.playSound(null, player.getX(), player.getY(), player.getZ(), ModSoundEvents.ITEM_SHIELD_RAISE, SoundSource.PLAYERS, 0.1F, 0.8f + player.level.random.nextFloat() * 0.4F);
level.playSound(null, player.getX(), player.getY(), player.getZ(), ModSoundEvents.ITEM_SHIELD_RAISE, SoundSource.PLAYERS, 0.1F, 0.8f + player.level().random.nextFloat() * 0.4F);
}
}

// Shields now have a unique equipping sound

@Override
public SoundEvent getEquipSound() {
public @NotNull SoundEvent getEquipSound() {
return ModSoundEvents.ITEM_SHIELD_EQUIP;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class TridentPullbackSound {
@Inject(method = "use", at = @At(value = "RETURN", target = "Lnet/minecraft/world/entity/player/Player;startUsingItem(Lnet/minecraft/world/InteractionHand;)V"))
private void auditory_pullbackSound(Level level, Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResultHolder<ItemStack>> cir) {
if (Auditory.getConfig().weapon_sounds.trident_pullback_sounds) {
level.playSound(null, player.getOnPos(), ModSoundEvents.ITEM_TRIDENT_PULLING, SoundSource.PLAYERS, 0.1F, 0.8f + player.level.random.nextFloat() * 0.4F);
level.playSound(null, player.getOnPos(), ModSoundEvents.ITEM_TRIDENT_PULLING, SoundSource.PLAYERS, 0.1F, 0.8f + player.level().random.nextFloat() * 0.4F);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,59 +29,58 @@ public WeaponSwingMixin(EntityType<?> entityType, Level level) {

@Inject(
at = @At(value = "NEW",
target = "net/minecraft/network/protocol/game/ClientboundAnimatePacket"),
target = "(Lnet/minecraft/world/entity/Entity;I)Lnet/minecraft/network/protocol/game/ClientboundAnimatePacket;"),
method = "swing(Lnet/minecraft/world/InteractionHand;Z)V"
)
private void auditory_swingSounds(InteractionHand interactionHand, boolean bl, CallbackInfo ci) {

ItemStack itemStack = this.getItemInHand(interactionHand);

// Sword Sounds

if ((itemStack.getItem() instanceof SwordItem || itemStack.is(ItemTags.SWORDS)) && Auditory.getConfig().weapon_sounds.sword_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_SWORD_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_SWORD_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}

// Axe Sounds

else if ((itemStack.getItem() instanceof AxeItem || itemStack.is(ItemTags.AXES)) && Auditory.getConfig().weapon_sounds.axe_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_AXE_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_AXE_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}

// Trident Sounds

else if (itemStack.getItem() instanceof TridentItem && Auditory.getConfig().weapon_sounds.trident_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_TRIDENT_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_TRIDENT_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}

// Pickaxe Sounds

else if ((itemStack.getItem() instanceof PickaxeItem || itemStack.is(ItemTags.PICKAXES)) && Auditory.getConfig().weapon_sounds.pickaxe_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_PICKAXE_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_PICKAXE_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}

// Shovel Sounds

else if ((itemStack.getItem() instanceof ShovelItem || itemStack.is(ItemTags.SHOVELS)) && Auditory.getConfig().weapon_sounds.shovel_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_SHOVEL_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_SHOVEL_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}

// Hoe Sounds

else if ((itemStack.getItem() instanceof HoeItem || itemStack.is(ItemTags.HOES)) && Auditory.getConfig().weapon_sounds.hoe_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_HOE_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_HOE_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}

// Shear Sounds

else if (itemStack.getItem() instanceof ShearsItem && Auditory.getConfig().weapon_sounds.shear_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_SHEARS_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ITEM_SHEARS_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}

// Empty Hand Sounds

else if (itemStack.isEmpty() && Auditory.getConfig().weapon_sounds.fist_swinging_sounds) {
level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ENTITY_PLAYER_EMPTY_HAND_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level.random.nextFloat() * 0.4F);
level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSoundEvents.ENTITY_PLAYER_EMPTY_HAND_SWING, SoundSource.PLAYERS, 0.1F, 0.8f + this.level().random.nextFloat() * 0.4F);
}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
],

"depends": {
"fabricloader": ">=0.14.19",
"fabricloader": ">=0.14.22",
"fabric": "*",
"minecraft": "1.19.4",
"minecraft": "1.20.1",
"java": ">=17"
},
"suggests": {
Expand Down