1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
--- a/net/minecraft/world/level/block/WaterlilyBlock.java
+++ b/net/minecraft/world/level/block/WaterlilyBlock.java
@@ -8,19 +8,23 @@
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
public class WaterlilyBlock extends BushBlock {
+
public static final MapCodec<WaterlilyBlock> CODEC = simpleCodec(WaterlilyBlock::new);
- protected static final VoxelShape AABB = Block.box(1.0, 0.0, 1.0, 15.0, 1.5, 15.0);
+ protected static final VoxelShape AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 1.5D, 15.0D);
@Override
public MapCodec<WaterlilyBlock> codec() {
- return CODEC;
+ return WaterlilyBlock.CODEC;
}
protected WaterlilyBlock(BlockBehaviour.Properties properties) {
@@ -28,22 +32,29 @@
}
@Override
- public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
+ public void entityInside(IBlockData state, Level level, BlockPos pos, Entity entity) {
super.entityInside(state, level, pos, entity);
if (level instanceof ServerLevel && entity instanceof Boat) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
level.destroyBlock(new BlockPos(pos), true, entity);
}
+
}
@Override
- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
- return AABB;
+ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
+ return WaterlilyBlock.AABB;
}
@Override
- protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) {
- FluidState fluidState = level.getFluidState(pos);
- FluidState fluidState1 = level.getFluidState(pos.above());
- return (fluidState.getType() == Fluids.WATER || state.getBlock() instanceof IceBlock) && fluidState1.getType() == Fluids.EMPTY;
+ protected boolean mayPlaceOn(IBlockData state, BlockGetter level, BlockPos pos) {
+ FluidState fluid = level.getFluidState(pos);
+ FluidState fluid1 = level.getFluidState(pos.above());
+
+ return (fluid.getType() == Fluids.WATER || state.getBlock() instanceof IceBlock) && fluid1.getType() == Fluids.EMPTY;
}
}
|