From 7a67987798369a2d7fa8fb18a90a6c2e84da3c75 Mon Sep 17 00:00:00 2001 From: Phoupraw <467934387@qq.com> Date: Wed, 22 Nov 2023 02:53:34 +0800 Subject: [PATCH 1/3] fix play sound --- .../fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java index 393fd56c08..001a638350 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java @@ -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); return true; } From 06cf7f8a6fbd653cf352f65b6a26452516917259 Mon Sep 17 00:00:00 2001 From: modmuss <modmuss50@gmail.com> Date: Wed, 6 Dec 2023 11:51:13 +0000 Subject: [PATCH 2/3] Update fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java --- .../fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java index 001a638350..899d749d2c 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java @@ -111,7 +111,7 @@ private static boolean moveWithSound(Storage<FluidVariant> from, Storage<FluidVa if (!fill && handItem == Items.POTION) sound = SoundEvents.ITEM_BOTTLE_EMPTY; } - player.getWorld().playSound(player, player.getX(), player.getEyeY(), player.getZ(), sound, SoundCategory.PLAYERS, 1, 1); + player.getWorld().playSound(null, player.getX(), player.getEyeY(), player.getZ(), sound, SoundCategory.PLAYERS, 1, 1); return true; } From eae5d2312517e8eb2347cbbf0a2ae49c26567224 Mon Sep 17 00:00:00 2001 From: modmuss50 <modmuss50@gmail.com> Date: Wed, 6 Dec 2023 12:52:45 +0000 Subject: [PATCH 3/3] Fix chute testmod --- .../transfer/v1/fluid/FluidStorageUtil.java | 2 +- .../test/transfer/ingame/FluidChuteBlock.java | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java index 899d749d2c..001a638350 100644 --- a/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java +++ b/fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidStorageUtil.java @@ -111,7 +111,7 @@ private static boolean moveWithSound(Storage<FluidVariant> from, Storage<FluidVa if (!fill && handItem == Items.POTION) sound = SoundEvents.ITEM_BOTTLE_EMPTY; } - player.getWorld().playSound(null, player.getX(), player.getEyeY(), player.getZ(), sound, SoundCategory.PLAYERS, 1, 1); + player.getWorld().playSound(player, player.getX(), player.getEyeY(), player.getZ(), sound, SoundCategory.PLAYERS, 1, 1); return true; } diff --git a/fabric-transfer-api-v1/src/testmod/java/net/fabricmc/fabric/test/transfer/ingame/FluidChuteBlock.java b/fabric-transfer-api-v1/src/testmod/java/net/fabricmc/fabric/test/transfer/ingame/FluidChuteBlock.java index 996b4e4386..81fbf6ba9d 100644 --- a/fabric-transfer-api-v1/src/testmod/java/net/fabricmc/fabric/test/transfer/ingame/FluidChuteBlock.java +++ b/fabric-transfer-api-v1/src/testmod/java/net/fabricmc/fabric/test/transfer/ingame/FluidChuteBlock.java @@ -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; } }