28 lines
1 KiB
Java
28 lines
1 KiB
Java
package net.minecraft.world.item;
|
|
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.entity.player.Player;
|
|
import net.minecraft.world.item.context.UseOnContext;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.ClipContext.Fluid;
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.phys.BlockHitResult;
|
|
|
|
public class PlaceOnWaterBlockItem extends BlockItem {
|
|
public PlaceOnWaterBlockItem(Block block, Item.Properties properties) {
|
|
super(block, properties);
|
|
}
|
|
|
|
@Override
|
|
public InteractionResult useOn(UseOnContext context) {
|
|
return InteractionResult.PASS;
|
|
}
|
|
|
|
@Override
|
|
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
|
BlockHitResult blockHitResult = getPlayerPOVHitResult(level, player, Fluid.SOURCE_ONLY);
|
|
BlockHitResult blockHitResult2 = blockHitResult.withPosition(blockHitResult.getBlockPos().above());
|
|
return super.useOn(new UseOnContext(player, hand, blockHitResult2));
|
|
}
|
|
}
|