47 lines
1.6 KiB
Java
47 lines
1.6 KiB
Java
package net.minecraft.world.level.block;
|
|
|
|
import net.minecraft.world.level.material.FluidState;
|
|
import net.minecraft.world.level.material.Material;
|
|
import net.minecraft.world.level.material.Fluids;
|
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
|
import net.minecraft.world.level.BlockGetter;
|
|
import net.minecraft.core.Vec3i;
|
|
import net.minecraft.world.entity.vehicle.Boat;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
public class WaterlilyBlock extends BushBlock {
|
|
protected static final VoxelShape AABB;
|
|
|
|
protected WaterlilyBlock(final Properties c) {
|
|
super(c);
|
|
}
|
|
|
|
@Override
|
|
public void entityInside(final BlockState byg, final Level bjt, final BlockPos fk, final Entity akn) {
|
|
super.entityInside(byg, bjt, fk, akn);
|
|
if (bjt instanceof ServerLevel && akn instanceof Boat) {
|
|
bjt.destroyBlock(new BlockPos(fk), true, akn);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public VoxelShape getShape(final BlockState byg, final BlockGetter bjd, final BlockPos fk, final CollisionContext cvn) {
|
|
return WaterlilyBlock.AABB;
|
|
}
|
|
|
|
@Override
|
|
protected boolean mayPlaceOn(final BlockState byg, final BlockGetter bjd, final BlockPos fk) {
|
|
final FluidState cog5 = bjd.getFluidState(fk);
|
|
return cog5.getType() == Fluids.WATER || byg.getMaterial() == Material.ICE;
|
|
}
|
|
|
|
static {
|
|
AABB = Block.box(1.0, 0.0, 1.0, 15.0, 1.5, 15.0);
|
|
}
|
|
}
|