Skip to content

Commit

Permalink
[Fix]: Fixes a bug where stopping a jukebox after pressing the play b…
Browse files Browse the repository at this point in the history
…utton twice was not possible
  • Loading branch information
Salandora committed Jan 1, 2025
1 parent c5f721f commit d5c7f4f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public JukeboxUpgradeContainer(Player player, int upgradeContainerId, JukeboxUpg
public void setChanged() {
super.setChanged();
if (upgradeWrapper.isPlaying()) {
upgradeWrapper.stop(player);
stop();
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ private void removeRenderData() {
}

public void stop(LivingEntity entity) {
if (!(entity.level() instanceof ServerLevel)) {
if (!(entity.level() instanceof ServerLevel serverLevel)) {
return;
}
storageWrapper.getContentsUuid().ifPresent(storageUuid ->
ServerStorageSoundHandler.stopPlayingDisc((ServerLevel) entity.level(), entity.position(), storageUuid)
ServerStorageSoundHandler.stopPlayingDisc(serverLevel, entity.position(), storageUuid)
);
setIsPlaying(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public static void stopPlayingDisc(ServerLevel serverWorld, Vec3 position, UUID
worldStorageSoundKeepAlive.get(dim).get(storageUuid).getSoundHandler().stop(serverWorld, position, storageUuid);
}
removeKeepAliveInfo(serverWorld, storageUuid);
sendStopMessage(serverWorld, position, storageUuid);
}

private static void removeKeepAliveInfo(ServerLevel serverWorld, UUID storageUuid) {
Expand Down

0 comments on commit d5c7f4f

Please sign in to comment.