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
67
68
69
70
|
--- a/net/minecraft/world/level/block/SpawnerBlock.java
+++ b/net/minecraft/world/level/block/SpawnerBlock.java
@@ -16,14 +16,15 @@
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.block.state.IBlockData;
public class SpawnerBlock extends BaseEntityBlock {
+
public static final MapCodec<SpawnerBlock> CODEC = simpleCodec(SpawnerBlock::new);
@Override
public MapCodec<SpawnerBlock> codec() {
- return CODEC;
+ return SpawnerBlock.CODEC;
}
protected SpawnerBlock(BlockBehaviour.Properties properties) {
@@ -31,30 +32,38 @@
}
@Override
- public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
+ public BlockEntity newBlockEntity(BlockPos pos, IBlockData state) {
return new SpawnerBlockEntity(pos, state);
}
@Nullable
@Override
- public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
- return createTickerHelper(
- blockEntityType, BlockEntityType.MOB_SPAWNER, level.isClientSide ? SpawnerBlockEntity::clientTick : SpawnerBlockEntity::serverTick
- );
+ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, IBlockData state, BlockEntityType<T> blockEntityType) {
+ return createTickerHelper(blockEntityType, BlockEntityType.MOB_SPAWNER, level.isClientSide ? SpawnerBlockEntity::clientTick : SpawnerBlockEntity::serverTick);
}
@Override
- public void spawnAfterBreak(BlockState state, ServerLevel level, BlockPos pos, ItemStack stack, boolean dropExperience) {
+ public void spawnAfterBreak(IBlockData state, ServerLevel level, BlockPos pos, ItemStack stack, boolean dropExperience) {
super.spawnAfterBreak(state, level, pos, stack, dropExperience);
- if (dropExperience) {
- int i = 15 + level.random.nextInt(15) + level.random.nextInt(15);
- this.popExperience(level, pos, i);
+ // CraftBukkit start - Delegate to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack, boolean flag) {
+ if (flag) {
+ int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
+
+ // this.popExperience(worldserver, blockposition, i);
+ return i;
}
+
+ return 0;
+ // CraftBukkit end
}
@Override
- public RenderShape getRenderShape(BlockState state) {
- return RenderShape.MODEL;
+ public EnumRenderType getRenderShape(IBlockData state) {
+ return EnumRenderType.MODEL;
}
@Override
|