aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/block/ChestBlock.java.patch
blob: 1741eccf2faef8da44e227bff564ff1e978962b8 (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
--- a/net/minecraft/world/level/block/ChestBlock.java
+++ b/net/minecraft/world/level/block/ChestBlock.java
@@ -20,9 +20,9 @@
 import net.minecraft.world.CompoundContainer;
 import net.minecraft.world.Container;
 import net.minecraft.world.Containers;
-import net.minecraft.world.InteractionHand;
+import net.minecraft.world.EnumHand;
+import net.minecraft.world.ITileInventory;
 import net.minecraft.world.InteractionResult;
-import net.minecraft.world.MenuProvider;
 import net.minecraft.world.entity.LivingEntity;
 import net.minecraft.world.entity.animal.Cat;
 import net.minecraft.world.entity.monster.piglin.PiglinAi;
@@ -41,7 +41,7 @@
 import net.minecraft.world.level.block.entity.ChestBlockEntity;
 import net.minecraft.world.level.block.entity.LidBlockEntity;
 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.block.state.StateDefinition;
 import net.minecraft.world.level.block.state.properties.BlockStateProperties;
 import net.minecraft.world.level.block.state.properties.BooleanProperty;
@@ -51,7 +51,7 @@
 import net.minecraft.world.level.material.Fluid;
 import net.minecraft.world.level.material.FluidState;
 import net.minecraft.world.level.material.Fluids;
-import net.minecraft.world.level.pathfinder.PathComputationType;
+import net.minecraft.world.level.pathfinder.PathMode;
 import net.minecraft.world.phys.AABB;
 import net.minecraft.world.phys.BlockHitResult;
 import net.minecraft.world.phys.shapes.CollisionContext;
@@ -59,8 +59,8 @@
 
 public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements SimpleWaterloggedBlock {
 
-    public static final MapCodec<ChestBlock> CODEC = simpleCodec((blockbehaviour_properties) -> {
-        return new ChestBlock(blockbehaviour_properties, () -> {
+    public static final MapCodec<ChestBlock> CODEC = simpleCodec((blockbase_info) -> {
+        return new ChestBlock(blockbase_info, () -> {
             return BlockEntityType.CHEST;
         });
     });
@@ -76,111 +76,114 @@
     protected static final VoxelShape EAST_AABB = Block.box(1.0D, 0.0D, 1.0D, 16.0D, 14.0D, 15.0D);
     protected static final VoxelShape AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D);
     private static final DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<Container>> CHEST_COMBINER = new DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<Container>>() {
-        @Override
-        public Optional<Container> acceptDouble(ChestBlockEntity chestblockentity, ChestBlockEntity chestblockentity1) {
-            return Optional.of(new CompoundContainer(chestblockentity, chestblockentity1));
+        public Optional<Container> acceptDouble(ChestBlockEntity tileentitychest, ChestBlockEntity tileentitychest1) {
+            return Optional.of(new CompoundContainer(tileentitychest, tileentitychest1));
         }
 
-        @Override
-        public Optional<Container> acceptSingle(ChestBlockEntity chestblockentity) {
-            return Optional.of(chestblockentity);
+        public Optional<Container> acceptSingle(ChestBlockEntity tileentitychest) {
+            return Optional.of(tileentitychest);
         }
 
         @Override
-        @Override
         public Optional<Container> acceptNone() {
             return Optional.empty();
         }
     };
-    private static final DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>> MENU_PROVIDER_COMBINER = new DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<MenuProvider>>() {
+    private static final DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<ITileInventory>> MENU_PROVIDER_COMBINER = new DoubleBlockCombiner.Combiner<ChestBlockEntity, Optional<ITileInventory>>() {
+        public Optional<ITileInventory> acceptDouble(final ChestBlockEntity tileentitychest, final ChestBlockEntity tileentitychest1) {
+            final CompoundContainer inventorylargechest = new CompoundContainer(tileentitychest, tileentitychest1);
+
+            return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit
+        }
+
+        public Optional<ITileInventory> acceptSingle(ChestBlockEntity tileentitychest) {
+            return Optional.of(tileentitychest);
+        }
+
         @Override
-        public Optional<MenuProvider> acceptDouble(final ChestBlockEntity chestblockentity, final ChestBlockEntity chestblockentity1) {
-            final CompoundContainer compoundcontainer = new CompoundContainer(chestblockentity, chestblockentity1);
+        public Optional<ITileInventory> acceptNone() {
+            return Optional.empty();
+        }
+    };
 
-            return Optional.of(new MenuProvider() {
-                @Nullable
-                @Override
-                @Override
-                public AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) {
-                    if (chestblockentity.canOpen(player) && chestblockentity1.canOpen(player)) {
-                        chestblockentity.unpackLootTable(inventory.player);
-                        chestblockentity1.unpackLootTable(inventory.player);
-                        return ChestMenu.sixRows(i, inventory, compoundcontainer);
-                    } else {
-                        return null;
-                    }
-                }
+    // CraftBukkit start
+    public static class DoubleInventory implements ITileInventory {
 
-                @Override
-                @Override
-                public Component getDisplayName() {
-                    return (Component) (chestblockentity.hasCustomName() ? chestblockentity.getDisplayName() : (chestblockentity1.hasCustomName() ? chestblockentity1.getDisplayName() : Component.translatable("container.chestDouble")));
-                }
-            });
+        private final ChestBlockEntity tileentitychest;
+        private final ChestBlockEntity tileentitychest1;
+        public final CompoundContainer inventorylargechest;
+
+        public DoubleInventory(ChestBlockEntity tileentitychest, ChestBlockEntity tileentitychest1, CompoundContainer inventorylargechest) {
+            this.tileentitychest = tileentitychest;
+            this.tileentitychest1 = tileentitychest1;
+            this.inventorylargechest = inventorylargechest;
         }
 
+        @Nullable
         @Override
-        public Optional<MenuProvider> acceptSingle(ChestBlockEntity chestblockentity) {
-            return Optional.of(chestblockentity);
+        public AbstractContainerMenu createMenu(int containerId, Inventory playerInventory, Player player) {
+            if (tileentitychest.canOpen(player) && tileentitychest1.canOpen(player)) {
+                tileentitychest.unpackLootTable(playerInventory.player);
+                tileentitychest1.unpackLootTable(playerInventory.player);
+                return ChestMenu.sixRows(containerId, playerInventory, inventorylargechest);
+            } else {
+                return null;
+            }
         }
 
         @Override
-        @Override
-        public Optional<MenuProvider> acceptNone() {
-            return Optional.empty();
+        public Component getDisplayName() {
+            return (Component) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : Component.translatable("container.chestDouble")));
         }
     };
+    // CraftBukkit end
 
     @Override
-    @Override
     public MapCodec<? extends ChestBlock> codec() {
         return ChestBlock.CODEC;
     }
 
-    protected ChestBlock(BlockBehaviour.Properties blockbehaviour_properties, Supplier<BlockEntityType<? extends ChestBlockEntity>> supplier) {
-        super(blockbehaviour_properties, supplier);
-        this.registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(ChestBlock.FACING, Direction.NORTH)).setValue(ChestBlock.TYPE, ChestType.SINGLE)).setValue(ChestBlock.WATERLOGGED, false));
+    protected ChestBlock(BlockBehaviour.Properties properties, Supplier<BlockEntityType<? extends ChestBlockEntity>> blockEntityType) {
+        super(properties, blockEntityType);
+        this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(ChestBlock.FACING, Direction.NORTH)).setValue(ChestBlock.TYPE, ChestType.SINGLE)).setValue(ChestBlock.WATERLOGGED, false));
     }
 
-    public static DoubleBlockCombiner.BlockType getBlockType(BlockState blockstate) {
-        ChestType chesttype = (ChestType) blockstate.getValue(ChestBlock.TYPE);
+    public static DoubleBlockCombiner.BlockType getBlockType(IBlockData state) {
+        ChestType blockpropertychesttype = (ChestType) state.getValue(ChestBlock.TYPE);
 
-        return chesttype == ChestType.SINGLE ? DoubleBlockCombiner.BlockType.SINGLE : (chesttype == ChestType.RIGHT ? DoubleBlockCombiner.BlockType.FIRST : DoubleBlockCombiner.BlockType.SECOND);
+        return blockpropertychesttype == ChestType.SINGLE ? DoubleBlockCombiner.BlockType.SINGLE : (blockpropertychesttype == ChestType.RIGHT ? DoubleBlockCombiner.BlockType.FIRST : DoubleBlockCombiner.BlockType.SECOND);
     }
 
     @Override
-    @Override
-    public RenderShape getRenderShape(BlockState blockstate) {
-        return RenderShape.ENTITYBLOCK_ANIMATED;
+    public EnumRenderType getRenderShape(IBlockData state) {
+        return EnumRenderType.ENTITYBLOCK_ANIMATED;
     }
 
     @Override
-    @Override
-    public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) {
-        if ((Boolean) blockstate.getValue(ChestBlock.WATERLOGGED)) {
-            levelaccessor.scheduleTick(blockpos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(levelaccessor));
+    public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
+        if ((Boolean) state.getValue(ChestBlock.WATERLOGGED)) {
+            level.scheduleTick(currentPos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(level));
         }
 
-        if (blockstate1.is((Block) this) && direction.getAxis().isHorizontal()) {
-            ChestType chesttype = (ChestType) blockstate1.getValue(ChestBlock.TYPE);
+        if (facingState.is((Block) this) && facing.getAxis().isHorizontal()) {
+            ChestType blockpropertychesttype = (ChestType) facingState.getValue(ChestBlock.TYPE);
 
-            if (blockstate.getValue(ChestBlock.TYPE) == ChestType.SINGLE && chesttype != ChestType.SINGLE && blockstate.getValue(ChestBlock.FACING) == blockstate1.getValue(ChestBlock.FACING) && getConnectedDirection(blockstate1) == direction.getOpposite()) {
-                return (BlockState) blockstate.setValue(ChestBlock.TYPE, chesttype.getOpposite());
+            if (state.getValue(ChestBlock.TYPE) == ChestType.SINGLE && blockpropertychesttype != ChestType.SINGLE && state.getValue(ChestBlock.FACING) == facingState.getValue(ChestBlock.FACING) && getConnectedDirection(facingState) == facing.getOpposite()) {
+                return (IBlockData) state.setValue(ChestBlock.TYPE, blockpropertychesttype.getOpposite());
             }
-        } else if (getConnectedDirection(blockstate) == direction) {
-            return (BlockState) blockstate.setValue(ChestBlock.TYPE, ChestType.SINGLE);
+        } else if (getConnectedDirection(state) == facing) {
+            return (IBlockData) state.setValue(ChestBlock.TYPE, ChestType.SINGLE);
         }
 
-        return super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1);
+        return super.updateShape(state, facing, facingState, level, currentPos, facingPos);
     }
 
     @Override
-    @Override
-    public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) {
-        if (blockstate.getValue(ChestBlock.TYPE) == ChestType.SINGLE) {
+    public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
+        if (state.getValue(ChestBlock.TYPE) == ChestType.SINGLE) {
             return ChestBlock.AABB;
         } else {
-            switch (getConnectedDirection(blockstate)) {
+            switch (getConnectedDirection(state)) {
                 case NORTH:
                 default:
                     return ChestBlock.NORTH_AABB;
@@ -194,84 +197,79 @@
         }
     }
 
-    public static Direction getConnectedDirection(BlockState blockstate) {
-        Direction direction = (Direction) blockstate.getValue(ChestBlock.FACING);
+    public static Direction getConnectedDirection(IBlockData state) {
+        Direction enumdirection = (Direction) state.getValue(ChestBlock.FACING);
 
-        return blockstate.getValue(ChestBlock.TYPE) == ChestType.LEFT ? direction.getClockWise() : direction.getCounterClockWise();
+        return state.getValue(ChestBlock.TYPE) == ChestType.LEFT ? enumdirection.getClockWise() : enumdirection.getCounterClockWise();
     }
 
     @Override
-    @Override
-    public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) {
-        ChestType chesttype = ChestType.SINGLE;
-        Direction direction = blockplacecontext.getHorizontalDirection().getOpposite();
-        FluidState fluidstate = blockplacecontext.getLevel().getFluidState(blockplacecontext.getClickedPos());
-        boolean flag = blockplacecontext.isSecondaryUseActive();
-        Direction direction1 = blockplacecontext.getClickedFace();
+    public IBlockData getStateForPlacement(BlockPlaceContext context) {
+        ChestType blockpropertychesttype = ChestType.SINGLE;
+        Direction enumdirection = context.getHorizontalDirection().getOpposite();
+        FluidState fluid = context.getLevel().getFluidState(context.getClickedPos());
+        boolean flag = context.isSecondaryUseActive();
+        Direction enumdirection1 = context.getClickedFace();
 
-        if (direction1.getAxis().isHorizontal() && flag) {
-            Direction direction2 = this.candidatePartnerFacing(blockplacecontext, direction1.getOpposite());
+        if (enumdirection1.getAxis().isHorizontal() && flag) {
+            Direction enumdirection2 = this.candidatePartnerFacing(context, enumdirection1.getOpposite());
 
-            if (direction2 != null && direction2.getAxis() != direction1.getAxis()) {
-                direction = direction2;
-                chesttype = direction2.getCounterClockWise() == direction1.getOpposite() ? ChestType.RIGHT : ChestType.LEFT;
+            if (enumdirection2 != null && enumdirection2.getAxis() != enumdirection1.getAxis()) {
+                enumdirection = enumdirection2;
+                blockpropertychesttype = enumdirection2.getCounterClockWise() == enumdirection1.getOpposite() ? ChestType.RIGHT : ChestType.LEFT;
             }
         }
 
-        if (chesttype == ChestType.SINGLE && !flag) {
-            if (direction == this.candidatePartnerFacing(blockplacecontext, direction.getClockWise())) {
-                chesttype = ChestType.LEFT;
-            } else if (direction == this.candidatePartnerFacing(blockplacecontext, direction.getCounterClockWise())) {
-                chesttype = ChestType.RIGHT;
+        if (blockpropertychesttype == ChestType.SINGLE && !flag) {
+            if (enumdirection == this.candidatePartnerFacing(context, enumdirection.getClockWise())) {
+                blockpropertychesttype = ChestType.LEFT;
+            } else if (enumdirection == this.candidatePartnerFacing(context, enumdirection.getCounterClockWise())) {
+                blockpropertychesttype = ChestType.RIGHT;
             }
         }
 
-        return (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(ChestBlock.FACING, direction)).setValue(ChestBlock.TYPE, chesttype)).setValue(ChestBlock.WATERLOGGED, fluidstate.getType() == Fluids.WATER);
+        return (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(ChestBlock.FACING, enumdirection)).setValue(ChestBlock.TYPE, blockpropertychesttype)).setValue(ChestBlock.WATERLOGGED, fluid.getType() == Fluids.WATER);
     }
 
     @Override
-    @Override
-    public FluidState getFluidState(BlockState blockstate) {
-        return (Boolean) blockstate.getValue(ChestBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(blockstate);
+    public FluidState getFluidState(IBlockData state) {
+        return (Boolean) state.getValue(ChestBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
     }
 
     @Nullable
-    private Direction candidatePartnerFacing(BlockPlaceContext blockplacecontext, Direction direction) {
-        BlockState blockstate = blockplacecontext.getLevel().getBlockState(blockplacecontext.getClickedPos().relative(direction));
+    private Direction candidatePartnerFacing(BlockPlaceContext context, Direction direction) {
+        IBlockData iblockdata = context.getLevel().getBlockState(context.getClickedPos().relative(direction));
 
-        return blockstate.is((Block) this) && blockstate.getValue(ChestBlock.TYPE) == ChestType.SINGLE ? (Direction) blockstate.getValue(ChestBlock.FACING) : null;
+        return iblockdata.is((Block) this) && iblockdata.getValue(ChestBlock.TYPE) == ChestType.SINGLE ? (Direction) iblockdata.getValue(ChestBlock.FACING) : null;
     }
 
     @Override
-    @Override
-    public void setPlacedBy(Level level, BlockPos blockpos, BlockState blockstate, LivingEntity livingentity, ItemStack itemstack) {
-        if (itemstack.hasCustomHoverName()) {
-            BlockEntity blockentity = level.getBlockEntity(blockpos);
+    public void setPlacedBy(Level level, BlockPos pos, IBlockData state, LivingEntity placer, ItemStack stack) {
+        if (stack.hasCustomHoverName()) {
+            BlockEntity tileentity = level.getBlockEntity(pos);
 
-            if (blockentity instanceof ChestBlockEntity) {
-                ((ChestBlockEntity) blockentity).setCustomName(itemstack.getHoverName());
+            if (tileentity instanceof ChestBlockEntity) {
+                ((ChestBlockEntity) tileentity).setCustomName(stack.getHoverName());
             }
         }
 
     }
 
     @Override
-    @Override
-    public void onRemove(BlockState blockstate, Level level, BlockPos blockpos, BlockState blockstate1, boolean flag) {
-        Containers.dropContentsOnDestroy(blockstate, blockstate1, level, blockpos);
-        super.onRemove(blockstate, level, blockpos, blockstate1, flag);
+    public void onRemove(IBlockData state, Level level, BlockPos pos, IBlockData newState, boolean isMoving) {
+        Containers.dropContentsOnDestroy(state, newState, level, pos);
+        super.onRemove(state, level, pos, newState, isMoving);
     }
 
     @Override
-    @Override
-    public InteractionResult use(BlockState blockstate, Level level, BlockPos blockpos, Player player, InteractionHand interactionhand, BlockHitResult blockhitresult) {
+    public InteractionResult use(IBlockData state, Level level, BlockPos pos, Player player, EnumHand hand, BlockHitResult hit) {
         if (level.isClientSide) {
             return InteractionResult.SUCCESS;
         } else {
-            MenuProvider menuprovider = this.getMenuProvider(blockstate, level, blockpos);
+            ITileInventory itileinventory = this.getMenuProvider(state, level, pos);
 
-            if (menuprovider != null) {
-                player.openMenu(menuprovider);
+            if (itileinventory != null) {
+                player.openMenu(itileinventory);
                 player.awardStat(this.getOpenChestStat());
                 PiglinAi.angerNearbyPiglins(player, true);
             }
@@ -289,92 +287,92 @@
     }
 
     @Nullable
-    public static Container getContainer(ChestBlock chestblock, BlockState blockstate, Level level, BlockPos blockpos, boolean flag) {
-        return (Container) ((Optional) chestblock.combine(blockstate, level, blockpos, flag).apply(ChestBlock.CHEST_COMBINER)).orElse((Object) null);
+    public static Container getContainer(ChestBlock chest, IBlockData state, Level level, BlockPos pos, boolean override) {
+        return (Container) ((Optional) chest.combine(state, level, pos, override).apply(ChestBlock.CHEST_COMBINER)).orElse((Object) null);
     }
 
     @Override
-    @Override
-    public DoubleBlockCombiner.NeighborCombineResult<? extends ChestBlockEntity> combine(BlockState blockstate, Level level, BlockPos blockpos, boolean flag) {
-        BiPredicate bipredicate;
+    public DoubleBlockCombiner.NeighborCombineResult<? extends ChestBlockEntity> combine(IBlockData state, Level level, BlockPos pos, boolean override) {
+        BiPredicate<LevelAccessor, BlockPos> bipredicate; // CraftBukkit - decompile error
 
-        if (flag) {
-            bipredicate = (levelaccessor, blockpos1) -> {
+        if (override) {
+            bipredicate = (generatoraccess, blockposition1) -> {
                 return false;
             };
         } else {
             bipredicate = ChestBlock::isChestBlockedAt;
         }
 
-        return DoubleBlockCombiner.combineWithNeigbour((BlockEntityType) this.blockEntityType.get(), ChestBlock::getBlockType, ChestBlock::getConnectedDirection, ChestBlock.FACING, blockstate, level, blockpos, bipredicate);
+        return DoubleBlockCombiner.combineWithNeigbour((BlockEntityType) this.blockEntityType.get(), ChestBlock::getBlockType, ChestBlock::getConnectedDirection, ChestBlock.FACING, state, level, pos, bipredicate);
     }
 
     @Nullable
     @Override
-    @Override
-    public MenuProvider getMenuProvider(BlockState blockstate, Level level, BlockPos blockpos) {
-        return (MenuProvider) ((Optional) this.combine(blockstate, level, blockpos, false).apply(ChestBlock.MENU_PROVIDER_COMBINER)).orElse((Object) null);
+    public ITileInventory getMenuProvider(IBlockData state, Level level, BlockPos pos) {
+        // CraftBukkit start
+        return getMenuProvider(state, level, pos, false);
     }
 
-    public static DoubleBlockCombiner.Combiner<ChestBlockEntity, Float2FloatFunction> opennessCombiner(final LidBlockEntity lidblockentity) {
+    @Nullable
+    public ITileInventory getMenuProvider(IBlockData iblockdata, Level world, BlockPos blockposition, boolean ignoreObstructions) {
+        return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, ignoreObstructions).apply(ChestBlock.MENU_PROVIDER_COMBINER)).orElse((Object) null);
+        // CraftBukkit end
+    }
+
+    public static DoubleBlockCombiner.Combiner<ChestBlockEntity, Float2FloatFunction> opennessCombiner(final LidBlockEntity lid) {
         return new DoubleBlockCombiner.Combiner<ChestBlockEntity, Float2FloatFunction>() {
-            @Override
-            public Float2FloatFunction acceptDouble(ChestBlockEntity chestblockentity, ChestBlockEntity chestblockentity1) {
+            public Float2FloatFunction acceptDouble(ChestBlockEntity first, ChestBlockEntity second) {
                 return (f) -> {
-                    return Math.max(chestblockentity.getOpenNess(f), chestblockentity1.getOpenNess(f));
+                    return Math.max(first.getOpenNess(f), second.getOpenNess(f));
                 };
             }
 
-            @Override
-            public Float2FloatFunction acceptSingle(ChestBlockEntity chestblockentity) {
-                Objects.requireNonNull(chestblockentity);
-                return chestblockentity::getOpenNess;
+            public Float2FloatFunction acceptSingle(ChestBlockEntity single) {
+                Objects.requireNonNull(single);
+                return single::getOpenNess;
             }
 
             @Override
-            @Override
             public Float2FloatFunction acceptNone() {
-                LidBlockEntity lidblockentity1 = lidblockentity;
+                LidBlockEntity lidblockentity1 = lid;
 
-                Objects.requireNonNull(lidblockentity);
+                Objects.requireNonNull(lid);
                 return lidblockentity1::getOpenNess;
             }
         };
     }
 
     @Override
-    @Override
-    public BlockEntity newBlockEntity(BlockPos blockpos, BlockState blockstate) {
-        return new ChestBlockEntity(blockpos, blockstate);
+    public BlockEntity newBlockEntity(BlockPos pos, IBlockData state) {
+        return new ChestBlockEntity(pos, state);
     }
 
     @Nullable
     @Override
-    @Override
-    public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockstate, BlockEntityType<T> blockentitytype) {
-        return level.isClientSide ? createTickerHelper(blockentitytype, this.blockEntityType(), ChestBlockEntity::lidAnimateTick) : null;
+    public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, IBlockData state, BlockEntityType<T> blockEntityType) {
+        return level.isClientSide ? createTickerHelper(blockEntityType, this.blockEntityType(), ChestBlockEntity::lidAnimateTick) : null;
     }
 
-    public static boolean isChestBlockedAt(LevelAccessor levelaccessor, BlockPos blockpos) {
-        return isBlockedChestByBlock(levelaccessor, blockpos) || isCatSittingOnChest(levelaccessor, blockpos);
+    public static boolean isChestBlockedAt(LevelAccessor level, BlockPos pos) {
+        return isBlockedChestByBlock(level, pos) || isCatSittingOnChest(level, pos);
     }
 
-    private static boolean isBlockedChestByBlock(BlockGetter blockgetter, BlockPos blockpos) {
-        BlockPos blockpos1 = blockpos.above();
+    private static boolean isBlockedChestByBlock(BlockGetter level, BlockPos pos) {
+        BlockPos blockposition1 = pos.above();
 
-        return blockgetter.getBlockState(blockpos1).isRedstoneConductor(blockgetter, blockpos1);
+        return level.getBlockState(blockposition1).isRedstoneConductor(level, blockposition1);
     }
 
-    private static boolean isCatSittingOnChest(LevelAccessor levelaccessor, BlockPos blockpos) {
-        List<Cat> list = levelaccessor.getEntitiesOfClass(Cat.class, new AABB((double) blockpos.getX(), (double) (blockpos.getY() + 1), (double) blockpos.getZ(), (double) (blockpos.getX() + 1), (double) (blockpos.getY() + 2), (double) (blockpos.getZ() + 1)));
+    private static boolean isCatSittingOnChest(LevelAccessor level, BlockPos pos) {
+        List<Cat> list = level.getEntitiesOfClass(Cat.class, new AABB((double) pos.getX(), (double) (pos.getY() + 1), (double) pos.getZ(), (double) (pos.getX() + 1), (double) (pos.getY() + 2), (double) (pos.getZ() + 1)));
 
         if (!list.isEmpty()) {
             Iterator iterator = list.iterator();
 
             while (iterator.hasNext()) {
-                Cat cat = (Cat) iterator.next();
+                Cat entitycat = (Cat) iterator.next();
 
-                if (cat.isInSittingPose()) {
+                if (entitycat.isInSittingPose()) {
                     return true;
                 }
             }
@@ -384,48 +382,41 @@
     }
 
     @Override
-    @Override
-    public boolean hasAnalogOutputSignal(BlockState blockstate) {
+    public boolean hasAnalogOutputSignal(IBlockData state) {
         return true;
     }
 
     @Override
-    @Override
-    public int getAnalogOutputSignal(BlockState blockstate, Level level, BlockPos blockpos) {
-        return AbstractContainerMenu.getRedstoneSignalFromContainer(getContainer(this, blockstate, level, blockpos, false));
+    public int getAnalogOutputSignal(IBlockData blockState, Level level, BlockPos pos) {
+        return AbstractContainerMenu.getRedstoneSignalFromContainer(getContainer(this, blockState, level, pos, false));
     }
 
     @Override
-    @Override
-    public BlockState rotate(BlockState blockstate, Rotation rotation) {
-        return (BlockState) blockstate.setValue(ChestBlock.FACING, rotation.rotate((Direction) blockstate.getValue(ChestBlock.FACING)));
+    public IBlockData rotate(IBlockData state, Rotation rotation) {
+        return (IBlockData) state.setValue(ChestBlock.FACING, rotation.rotate((Direction) state.getValue(ChestBlock.FACING)));
     }
 
     @Override
-    @Override
-    public BlockState mirror(BlockState blockstate, Mirror mirror) {
-        return blockstate.rotate(mirror.getRotation((Direction) blockstate.getValue(ChestBlock.FACING)));
+    public IBlockData mirror(IBlockData state, Mirror mirror) {
+        return state.rotate(mirror.getRotation((Direction) state.getValue(ChestBlock.FACING)));
     }
 
     @Override
-    @Override
-    protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) {
-        statedefinition_builder.add(ChestBlock.FACING, ChestBlock.TYPE, ChestBlock.WATERLOGGED);
+    protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
+        builder.add(ChestBlock.FACING, ChestBlock.TYPE, ChestBlock.WATERLOGGED);
     }
 
     @Override
-    @Override
-    public boolean isPathfindable(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, PathComputationType pathcomputationtype) {
+    public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) {
         return false;
     }
 
     @Override
-    @Override
-    public void tick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
-        BlockEntity blockentity = serverlevel.getBlockEntity(blockpos);
+    public void tick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
+        BlockEntity tileentity = level.getBlockEntity(pos);
 
-        if (blockentity instanceof ChestBlockEntity) {
-            ((ChestBlockEntity) blockentity).recheckOpen();
+        if (tileentity instanceof ChestBlockEntity) {
+            ((ChestBlockEntity) tileentity).recheckOpen();
         }
 
     }