Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FluidStorageUtil#moveWithSound Play Sound #3431

Merged

Conversation

Phoupraw
Copy link
Contributor

It plays sound to all players only once now.

@Technici4n Technici4n self-assigned this Nov 22, 2023
@modmuss50 modmuss50 added bug Something isn't working small change labels Dec 6, 2023
@@ -111,7 +111,7 @@ private static boolean moveWithSound(Storage<FluidVariant> from, Storage<FluidVa
if (!fill && handItem == Items.POTION) sound = SoundEvents.ITEM_BOTTLE_EMPTY;
}

player.playSound(sound, SoundCategory.BLOCKS, 1, 1);
player.getWorld().playSound(player, player.getX(), player.getEyeY(), player.getZ(), sound, SoundCategory.PLAYERS, 1, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been tested, I believe you need to pass null as the first param otherwise this is going to play for everyone BUT the player.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be called both on client and server. ClientWorld.playSound will play sound to the except, while ServerWorld.playSound will play sound to all players but the except. This usage is according to vanilla usage, such as FenceGateBlock#onUse.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm, I tested with the chute block in the FAPI test mods, they only call this on the server. I wonder if its worth wrappning this is a !world.isClient? Maybe @Technici4n would have some input on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it depends on which side modders are expected to call it. It's probably worth documenting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you were right, it makes sense to call this on both sides. I have gone ahead and updated the testmod, this now works as expected. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we indicate it needs to be called on both sides in the doc?

Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fixed and tested this myself, Thanks.

@modmuss50 modmuss50 added the merge me please Pull requests that are ready to merge label Dec 6, 2023
@modmuss50 modmuss50 merged commit 4944b5a into FabricMC:1.20.2 Dec 8, 2023
5 checks passed
modmuss50 pushed a commit that referenced this pull request Dec 8, 2023
* fix play sound

* Update fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java

* Fix chute testmod

---------

Co-authored-by: modmuss <[email protected]>
(cherry picked from commit 4944b5a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working merge me please Pull requests that are ready to merge small change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants