mirror of
https://github.com/FabricMC/fabric.git
synced 2025-03-24 22:11:18 -04:00
Fix FluidStorageUtil#moveWithSound
Play Sound (#3431)
* 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:
parent
bf75b395cb
commit
4944b5a5ee
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
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue