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
3 changes: 1 addition & 2 deletions src/main/java/net/sydokiddo/auditory/AuditoryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public void onInitializeClient() {

KeyBindingHelper.registerKeyBinding(reloadKey);
ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (reloadKey.isDown()) {
assert client.player != null;
if (reloadKey.isDown() && client.player != null) {
Minecraft.getInstance().getSoundManager().reload();
Minecraft mc = Minecraft.getInstance();
mc.gui.getChat().addMessage(Component.translatable("auditory.sound_reload_message"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.JukeboxSong;
import net.minecraft.world.level.block.entity.BlockEntity;
Expand All @@ -16,7 +15,6 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Optional;

Expand Down Expand Up @@ -46,9 +44,8 @@ private void auditory_ejectDiscSound(ItemStack itemStack, CallbackInfo ci) {

@Inject(method = "setTheItem", at = @At("HEAD"))
private void auditory_insertDiscSound(ItemStack itemStack, CallbackInfo ci) {
if (Auditory.getConfig().block_sounds.jukebox_sounds) {
if (Auditory.getConfig().block_sounds.jukebox_sounds && this.level != null) {
boolean bl = !itemStack.isEmpty();
assert this.level != null;
Optional<Holder<JukeboxSong>> optional = JukeboxSong.fromStack(this.level.registryAccess(), itemStack);
if (bl && optional.isPresent()) {
this.level.playSound(null, this.getBlockPos(), ModSoundEvents.BLOCK_JUKEBOX_USE, SoundSource.BLOCKS, 1.0F, 1.0F);
Expand Down