diff --git a/gradle.properties b/gradle.properties index 49c9e09..61d1ea6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 \ No newline at end of file +fabric_version=0.86.1+1.20.1 +modmenu_version=7.2.1 +cloth_version = 11.1.106 \ No newline at end of file diff --git a/src/main/java/net/sydokiddo/auditory/mixin/blocks/FallOnBlockMixin.java b/src/main/java/net/sydokiddo/auditory/mixin/blocks/FallOnBlockMixin.java index ebd0392..9c59e6a 100644 --- a/src/main/java/net/sydokiddo/auditory/mixin/blocks/FallOnBlockMixin.java +++ b/src/main/java/net/sydokiddo/auditory/mixin/blocks/FallOnBlockMixin.java @@ -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; @@ -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()); } diff --git a/src/main/java/net/sydokiddo/auditory/mixin/entities/ItemDropSoundMixin.java b/src/main/java/net/sydokiddo/auditory/mixin/entities/ItemDropSoundMixin.java index d2f131f..912dd05 100644 --- a/src/main/java/net/sydokiddo/auditory/mixin/entities/ItemDropSoundMixin.java +++ b/src/main/java/net/sydokiddo/auditory/mixin/entities/ItemDropSoundMixin.java @@ -31,7 +31,7 @@ protected ItemDropSoundMixin(EntityType 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 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); } } } diff --git a/src/main/java/net/sydokiddo/auditory/mixin/items/BowPullbackSound.java b/src/main/java/net/sydokiddo/auditory/mixin/items/BowPullbackSound.java index b684d90..52ab403 100644 --- a/src/main/java/net/sydokiddo/auditory/mixin/items/BowPullbackSound.java +++ b/src/main/java/net/sydokiddo/auditory/mixin/items/BowPullbackSound.java @@ -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> 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); } } } diff --git a/src/main/java/net/sydokiddo/auditory/mixin/items/LeadAttachSoundMixin.java b/src/main/java/net/sydokiddo/auditory/mixin/items/LeadAttachSoundMixin.java index 121a683..6523bf0 100644 --- a/src/main/java/net/sydokiddo/auditory/mixin/items/LeadAttachSoundMixin.java +++ b/src/main/java/net/sydokiddo/auditory/mixin/items/LeadAttachSoundMixin.java @@ -30,14 +30,14 @@ protected LeadAttachSoundMixin(EntityType 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 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); } } } diff --git a/src/main/java/net/sydokiddo/auditory/mixin/items/ShieldSoundsMixin.java b/src/main/java/net/sydokiddo/auditory/mixin/items/ShieldSoundsMixin.java index 006cfc5..0afaaa5 100644 --- a/src/main/java/net/sydokiddo/auditory/mixin/items/ShieldSoundsMixin.java +++ b/src/main/java/net/sydokiddo/auditory/mixin/items/ShieldSoundsMixin.java @@ -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; @@ -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> 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; } } diff --git a/src/main/java/net/sydokiddo/auditory/mixin/items/TridentPullbackSound.java b/src/main/java/net/sydokiddo/auditory/mixin/items/TridentPullbackSound.java index c75b32d..3137c5c 100644 --- a/src/main/java/net/sydokiddo/auditory/mixin/items/TridentPullbackSound.java +++ b/src/main/java/net/sydokiddo/auditory/mixin/items/TridentPullbackSound.java @@ -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> 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); } } } diff --git a/src/main/java/net/sydokiddo/auditory/mixin/items/WeaponSwingMixin.java b/src/main/java/net/sydokiddo/auditory/mixin/items/WeaponSwingMixin.java index 843bbb1..6b67fdf 100644 --- a/src/main/java/net/sydokiddo/auditory/mixin/items/WeaponSwingMixin.java +++ b/src/main/java/net/sydokiddo/auditory/mixin/items/WeaponSwingMixin.java @@ -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); } } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9c176c9..701912d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -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": {