Fix FluidStorageUtil#moveWithSound Play Sound ()

* 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 <modmuss50@gmail.com>
This commit is contained in:
Phoupraw 2023-12-08 23:15:16 +08:00 committed by GitHub
parent bf75b395cb
commit 4944b5a5ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions
fabric-transfer-api-v1/src
main/java/net/fabricmc/fabric/api/transfer/v1/fluid
testmod/java/net/fabricmc/fabric/test/transfer/ingame

View file

@ -111,7 +111,7 @@ public final class FluidStorageUtil {
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;
}

View file

@ -65,14 +65,18 @@ public class FluidChuteBlock extends Block implements BlockEntityProvider {
@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;
}
}