/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.jspecify.annotations.Nullable */ package net.minecraft.world.level.block; import java.util.Optional; import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.BucketPickup; import net.minecraft.world.level.block.LiquidBlockContainer; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; import org.jspecify.annotations.Nullable; public interface SimpleWaterloggedBlock extends BucketPickup, LiquidBlockContainer { @Override default public boolean canPlaceLiquid(@Nullable LivingEntity user, BlockGetter level, BlockPos pos, BlockState state, Fluid type) { return type == Fluids.WATER; } @Override default public boolean placeLiquid(LevelAccessor level, BlockPos pos, BlockState state, FluidState fluidState) { if (!state.getValue(BlockStateProperties.WATERLOGGED).booleanValue() && fluidState.getType() == Fluids.WATER) { if (!level.isClientSide()) { level.setBlock(pos, (BlockState)state.setValue(BlockStateProperties.WATERLOGGED, true), 3); level.scheduleTick(pos, fluidState.getType(), fluidState.getType().getTickDelay(level)); } return true; } return false; } @Override default public ItemStack pickupBlock(@Nullable LivingEntity user, LevelAccessor level, BlockPos pos, BlockState state) { if (state.getValue(BlockStateProperties.WATERLOGGED).booleanValue()) { level.setBlock(pos, (BlockState)state.setValue(BlockStateProperties.WATERLOGGED, false), 3); if (!state.canSurvive(level, pos)) { level.destroyBlock(pos, true); } return new ItemStack(Items.WATER_BUCKET); } return ItemStack.EMPTY; } @Override default public Optional getPickupSound() { return Fluids.WATER.getPickupSound(); } }