Skip to content

Commit

Permalink
Fix FluidStorageUtil#moveWithSound Play Sound (#3431)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
Phoupraw authored and modmuss50 committed Dec 8, 2023
1 parent b46767f commit 0e40ff4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,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);

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (!world.isClient() && world.getBlockEntity(pos) instanceof FluidChuteBlockEntity chute) {
if (world.getBlockEntity(pos) instanceof FluidChuteBlockEntity chute) {
if (!FluidStorageUtil.interactWithFluidStorage(chute.storage, player, hand)) {
player.sendMessage(
Text.literal("Fluid: ")
.append(FluidVariantAttributes.getName(chute.storage.variant))
.append(", amount: " + chute.storage.amount),
false
);
if (!world.isClient()) {
player.sendMessage(
Text.literal("Fluid: ")
.append(FluidVariantAttributes.getName(chute.storage.variant))
.append(", amount: " + chute.storage.amount),
false
);
}

return ActionResult.CONSUME;
}
}

Expand Down

0 comments on commit 0e40ff4

Please sign in to comment.