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
|
--- a/net/minecraft/world/level/block/ComposterBlock.java
+++ b/net/minecraft/world/level/block/ComposterBlock.java
@@ -13,7 +13,7 @@
import net.minecraft.sounds.SoundSource;
import net.minecraft.stats.Stats;
import net.minecraft.util.RandomSource;
-import net.minecraft.world.InteractionHand;
+import net.minecraft.world.EnumHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.WorldlyContainer;
@@ -24,22 +24,26 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.BlockGetter;
-import net.minecraft.world.level.ItemLike;
+import net.minecraft.world.level.IMaterial;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
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.IntegerProperty;
import net.minecraft.world.level.gameevent.GameEvent;
-import net.minecraft.world.level.pathfinder.PathComputationType;
+import net.minecraft.world.level.pathfinder.PathMode;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftBlockInventoryHolder;
+import org.bukkit.craftbukkit.util.DummyGeneratorAccess;
+// CraftBukkit end
public class ComposterBlock extends Block implements WorldlyContainerHolder {
@@ -48,7 +52,7 @@
public static final int MIN_LEVEL = 0;
public static final int MAX_LEVEL = 7;
public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_COMPOSTER;
- public static final Object2FloatMap<ItemLike> COMPOSTABLES = new Object2FloatOpenHashMap();
+ public static final Object2FloatMap<IMaterial> COMPOSTABLES = new Object2FloatOpenHashMap();
private static final int AABB_SIDE_THICKNESS = 2;
private static final VoxelShape OUTER_SHAPE = Shapes.block();
private static final VoxelShape[] SHAPES = (VoxelShape[]) Util.make(new VoxelShape[9], (avoxelshape) -> {
@@ -60,7 +64,6 @@
});
@Override
- @Override
public MapCodec<ComposterBlock> codec() {
return ComposterBlock.CODEC;
}
@@ -176,20 +179,20 @@
add(1.0F, Items.PUMPKIN_PIE);
}
- private static void add(float f, ItemLike itemlike) {
- ComposterBlock.COMPOSTABLES.put(itemlike.asItem(), f);
+ private static void add(float chance, IMaterial item) {
+ ComposterBlock.COMPOSTABLES.put(item.asItem(), chance);
}
- public ComposterBlock(BlockBehaviour.Properties blockbehaviour_properties) {
- super(blockbehaviour_properties);
- this.registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any()).setValue(ComposterBlock.LEVEL, 0));
+ public ComposterBlock(BlockBehaviour.Properties properties) {
+ super(properties);
+ this.registerDefaultState((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(ComposterBlock.LEVEL, 0));
}
- public static void handleFill(Level level, BlockPos blockpos, boolean flag) {
- BlockState blockstate = level.getBlockState(blockpos);
+ public static void handleFill(Level level, BlockPos pos, boolean success) {
+ IBlockData iblockdata = level.getBlockState(pos);
- level.playLocalSound(blockpos, flag ? SoundEvents.COMPOSTER_FILL_SUCCESS : SoundEvents.COMPOSTER_FILL, SoundSource.BLOCKS, 1.0F, 1.0F, false);
- double d0 = blockstate.getShape(level, blockpos).max(Direction.Axis.Y, 0.5D, 0.5D) + 0.03125D;
+ level.playLocalSound(pos, success ? SoundEvents.COMPOSTER_FILL_SUCCESS : SoundEvents.COMPOSTER_FILL, SoundSource.BLOCKS, 1.0F, 1.0F, false);
+ double d0 = iblockdata.getShape(level, pos).max(Direction.Axis.Y, 0.5D, 0.5D) + 0.03125D;
double d1 = 0.13124999403953552D;
double d2 = 0.737500011920929D;
RandomSource randomsource = level.getRandom();
@@ -199,49 +202,44 @@
double d4 = randomsource.nextGaussian() * 0.02D;
double d5 = randomsource.nextGaussian() * 0.02D;
- level.addParticle(ParticleTypes.COMPOSTER, (double) blockpos.getX() + 0.13124999403953552D + 0.737500011920929D * (double) randomsource.nextFloat(), (double) blockpos.getY() + d0 + (double) randomsource.nextFloat() * (1.0D - d0), (double) blockpos.getZ() + 0.13124999403953552D + 0.737500011920929D * (double) randomsource.nextFloat(), d3, d4, d5);
+ level.addParticle(ParticleTypes.COMPOSTER, (double) pos.getX() + 0.13124999403953552D + 0.737500011920929D * (double) randomsource.nextFloat(), (double) pos.getY() + d0 + (double) randomsource.nextFloat() * (1.0D - d0), (double) pos.getZ() + 0.13124999403953552D + 0.737500011920929D * (double) randomsource.nextFloat(), d3, d4, d5);
}
}
@Override
- @Override
- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) {
- return ComposterBlock.SHAPES[(Integer) blockstate.getValue(ComposterBlock.LEVEL)];
+ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
+ return ComposterBlock.SHAPES[(Integer) state.getValue(ComposterBlock.LEVEL)];
}
@Override
- @Override
- public VoxelShape getInteractionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) {
+ public VoxelShape getInteractionShape(IBlockData state, BlockGetter level, BlockPos pos) {
return ComposterBlock.OUTER_SHAPE;
}
@Override
- @Override
- public VoxelShape getCollisionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) {
+ public VoxelShape getCollisionShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
return ComposterBlock.SHAPES[0];
}
@Override
- @Override
- public void onPlace(BlockState blockstate, Level level, BlockPos blockpos, BlockState blockstate1, boolean flag) {
- if ((Integer) blockstate.getValue(ComposterBlock.LEVEL) == 7) {
- level.scheduleTick(blockpos, blockstate.getBlock(), 20);
+ public void onPlace(IBlockData state, Level level, BlockPos pos, IBlockData oldState, boolean isMoving) {
+ if ((Integer) state.getValue(ComposterBlock.LEVEL) == 7) {
+ level.scheduleTick(pos, state.getBlock(), 20);
}
}
@Override
- @Override
- public InteractionResult use(BlockState blockstate, Level level, BlockPos blockpos, Player player, InteractionHand interactionhand, BlockHitResult blockhitresult) {
- int i = (Integer) blockstate.getValue(ComposterBlock.LEVEL);
- ItemStack itemstack = player.getItemInHand(interactionhand);
+ public InteractionResult use(IBlockData state, Level level, BlockPos pos, Player player, EnumHand hand, BlockHitResult hit) {
+ int i = (Integer) state.getValue(ComposterBlock.LEVEL);
+ ItemStack itemstack = player.getItemInHand(hand);
if (i < 8 && ComposterBlock.COMPOSTABLES.containsKey(itemstack.getItem())) {
if (i < 7 && !level.isClientSide) {
- BlockState blockstate1 = addItem(player, blockstate, level, blockpos, itemstack);
+ IBlockData iblockdata1 = addItem(player, state, level, pos, itemstack);
- level.levelEvent(1500, blockpos, blockstate != blockstate1 ? 1 : 0);
+ level.levelEvent(1500, pos, state != iblockdata1 ? 1 : 0);
player.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
if (!player.getAbilities().instabuild) {
itemstack.shrink(1);
@@ -250,232 +248,245 @@
return InteractionResult.sidedSuccess(level.isClientSide);
} else if (i == 8) {
- extractProduce(player, blockstate, level, blockpos);
+ extractProduce(player, state, level, pos);
return InteractionResult.sidedSuccess(level.isClientSide);
} else {
return InteractionResult.PASS;
}
}
- public static BlockState insertItem(Entity entity, BlockState blockstate, ServerLevel serverlevel, ItemStack itemstack, BlockPos blockpos) {
- int i = (Integer) blockstate.getValue(ComposterBlock.LEVEL);
+ public static IBlockData insertItem(Entity entity, IBlockData state, ServerLevel level, ItemStack stack, BlockPos pos) {
+ int i = (Integer) state.getValue(ComposterBlock.LEVEL);
- if (i < 7 && ComposterBlock.COMPOSTABLES.containsKey(itemstack.getItem())) {
- BlockState blockstate1 = addItem(entity, blockstate, serverlevel, blockpos, itemstack);
+ if (i < 7 && ComposterBlock.COMPOSTABLES.containsKey(stack.getItem())) {
+ // CraftBukkit start
+ double rand = level.getRandom().nextDouble();
+ IBlockData iblockdata1 = addItem(entity, state, DummyGeneratorAccess.INSTANCE, pos, stack, rand);
+ if (state == iblockdata1 || !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, iblockdata1)) {
+ return state;
+ }
+ iblockdata1 = addItem(entity, state, level, pos, stack, rand);
+ // CraftBukkit end
- itemstack.shrink(1);
- return blockstate1;
+ stack.shrink(1);
+ return iblockdata1;
} else {
- return blockstate;
+ return state;
}
}
- public static BlockState extractProduce(Entity entity, BlockState blockstate, Level level, BlockPos blockpos) {
+ public static IBlockData extractProduce(Entity entity, IBlockData state, Level level, BlockPos pos) {
+ // CraftBukkit start
+ if (entity != null && !(entity instanceof Player)) {
+ IBlockData iblockdata1 = empty(entity, state, DummyGeneratorAccess.INSTANCE, pos);
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, iblockdata1)) {
+ return state;
+ }
+ }
+ // CraftBukkit end
if (!level.isClientSide) {
- Vec3 vec3 = Vec3.atLowerCornerWithOffset(blockpos, 0.5D, 1.01D, 0.5D).offsetRandom(level.random, 0.7F);
- ItemEntity itementity = new ItemEntity(level, vec3.x(), vec3.y(), vec3.z(), new ItemStack(Items.BONE_MEAL));
+ Vec3 vec3d = Vec3.atLowerCornerWithOffset(pos, 0.5D, 1.01D, 0.5D).offsetRandom(level.random, 0.7F);
+ ItemEntity entityitem = new ItemEntity(level, vec3d.x(), vec3d.y(), vec3d.z(), new ItemStack(Items.BONE_MEAL));
- itementity.setDefaultPickUpDelay();
- level.addFreshEntity(itementity);
+ entityitem.setDefaultPickUpDelay();
+ level.addFreshEntity(entityitem);
}
- BlockState blockstate1 = empty(entity, blockstate, level, blockpos);
+ IBlockData iblockdata1 = empty(entity, state, level, pos);
- level.playSound((Player) null, blockpos, SoundEvents.COMPOSTER_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F);
- return blockstate1;
+ level.playSound((Player) null, pos, SoundEvents.COMPOSTER_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F);
+ return iblockdata1;
}
- static BlockState empty(@Nullable Entity entity, BlockState blockstate, LevelAccessor levelaccessor, BlockPos blockpos) {
- BlockState blockstate1 = (BlockState) blockstate.setValue(ComposterBlock.LEVEL, 0);
+ static IBlockData empty(@Nullable Entity entity, IBlockData state, LevelAccessor level, BlockPos pos) {
+ IBlockData iblockdata1 = (IBlockData) state.setValue(ComposterBlock.LEVEL, 0);
- levelaccessor.setBlock(blockpos, blockstate1, 3);
- levelaccessor.gameEvent(GameEvent.BLOCK_CHANGE, blockpos, GameEvent.Context.of(entity, blockstate1));
- return blockstate1;
+ level.setBlock(pos, iblockdata1, 3);
+ level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, iblockdata1));
+ return iblockdata1;
}
- static BlockState addItem(@Nullable Entity entity, BlockState blockstate, LevelAccessor levelaccessor, BlockPos blockpos, ItemStack itemstack) {
- int i = (Integer) blockstate.getValue(ComposterBlock.LEVEL);
+ static IBlockData addItem(@Nullable Entity entity, IBlockData state, LevelAccessor level, BlockPos pos, ItemStack stack) {
+ // CraftBukkit start
+ return addItem(entity, state, level, pos, stack, level.getRandom().nextDouble());
+ }
+
+ static IBlockData addItem(@Nullable Entity entity, IBlockData iblockdata, LevelAccessor generatoraccess, BlockPos blockposition, ItemStack itemstack, double rand) {
+ // CraftBukkit end
+ int i = (Integer) iblockdata.getValue(ComposterBlock.LEVEL);
float f = ComposterBlock.COMPOSTABLES.getFloat(itemstack.getItem());
- if ((i != 0 || f <= 0.0F) && levelaccessor.getRandom().nextDouble() >= (double) f) {
- return blockstate;
+ if ((i != 0 || f <= 0.0F) && rand >= (double) f) {
+ return iblockdata;
} else {
int j = i + 1;
- BlockState blockstate1 = (BlockState) blockstate.setValue(ComposterBlock.LEVEL, j);
+ IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(ComposterBlock.LEVEL, j);
- levelaccessor.setBlock(blockpos, blockstate1, 3);
- levelaccessor.gameEvent(GameEvent.BLOCK_CHANGE, blockpos, GameEvent.Context.of(entity, blockstate1));
+ generatoraccess.setBlock(blockposition, iblockdata1, 3);
+ generatoraccess.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(entity, iblockdata1));
if (j == 7) {
- levelaccessor.scheduleTick(blockpos, blockstate.getBlock(), 20);
+ generatoraccess.scheduleTick(blockposition, iblockdata.getBlock(), 20);
}
- return blockstate1;
+ return iblockdata1;
}
}
@Override
- @Override
- public void tick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
- if ((Integer) blockstate.getValue(ComposterBlock.LEVEL) == 7) {
- serverlevel.setBlock(blockpos, (BlockState) blockstate.cycle(ComposterBlock.LEVEL), 3);
- serverlevel.playSound((Player) null, blockpos, SoundEvents.COMPOSTER_READY, SoundSource.BLOCKS, 1.0F, 1.0F);
+ public void tick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
+ if ((Integer) state.getValue(ComposterBlock.LEVEL) == 7) {
+ level.setBlock(pos, (IBlockData) state.cycle(ComposterBlock.LEVEL), 3);
+ level.playSound((Player) null, pos, SoundEvents.COMPOSTER_READY, SoundSource.BLOCKS, 1.0F, 1.0F);
}
}
@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 (Integer) blockstate.getValue(ComposterBlock.LEVEL);
+ public int getAnalogOutputSignal(IBlockData blockState, Level level, BlockPos pos) {
+ return (Integer) blockState.getValue(ComposterBlock.LEVEL);
}
@Override
- @Override
- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) {
- statedefinition_builder.add(ComposterBlock.LEVEL);
+ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
+ builder.add(ComposterBlock.LEVEL);
}
@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 WorldlyContainer getContainer(BlockState blockstate, LevelAccessor levelaccessor, BlockPos blockpos) {
- int i = (Integer) blockstate.getValue(ComposterBlock.LEVEL);
+ public WorldlyContainer getContainer(IBlockData state, LevelAccessor level, BlockPos pos) {
+ int i = (Integer) state.getValue(ComposterBlock.LEVEL);
- return (WorldlyContainer) (i == 8 ? new ComposterBlock.OutputContainer(blockstate, levelaccessor, blockpos, new ItemStack(Items.BONE_MEAL)) : (i < 7 ? new ComposterBlock.InputContainer(blockstate, levelaccessor, blockpos) : new ComposterBlock.EmptyContainer()));
+ // CraftBukkit - empty generatoraccess, blockposition
+ return (WorldlyContainer) (i == 8 ? new ComposterBlock.OutputContainer(state, level, pos, new ItemStack(Items.BONE_MEAL)) : (i < 7 ? new ComposterBlock.InputContainer(state, level, pos) : new ComposterBlock.EmptyContainer(level, pos)));
}
- private static class OutputContainer extends SimpleContainer implements WorldlyContainer {
+ public static class OutputContainer extends SimpleContainer implements WorldlyContainer {
- private final BlockState state;
+ private final IBlockData state;
private final LevelAccessor level;
private final BlockPos pos;
private boolean changed;
- public OutputContainer(BlockState blockstate, LevelAccessor levelaccessor, BlockPos blockpos, ItemStack itemstack) {
- super(itemstack);
- this.state = blockstate;
- this.level = levelaccessor;
- this.pos = blockpos;
+ public OutputContainer(IBlockData state, LevelAccessor level, BlockPos pos, ItemStack stack) {
+ super(stack);
+ this.state = state;
+ this.level = level;
+ this.pos = pos;
+ this.bukkitOwner = new CraftBlockInventoryHolder(level, pos, this); // CraftBukkit
}
@Override
- @Override
public int getMaxStackSize() {
return 1;
}
@Override
- @Override
- public int[] getSlotsForFace(Direction direction) {
- return direction == Direction.DOWN ? new int[]{0} : new int[0];
+ public int[] getSlotsForFace(Direction side) {
+ return side == Direction.DOWN ? new int[]{0} : new int[0];
}
@Override
- @Override
- public boolean canPlaceItemThroughFace(int i, ItemStack itemstack, @Nullable Direction direction) {
+ public boolean canPlaceItemThroughFace(int index, ItemStack itemStack, @Nullable Direction direction) {
return false;
}
@Override
- @Override
- public boolean canTakeItemThroughFace(int i, ItemStack itemstack, Direction direction) {
- return !this.changed && direction == Direction.DOWN && itemstack.is(Items.BONE_MEAL);
+ public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) {
+ return !this.changed && direction == Direction.DOWN && stack.is(Items.BONE_MEAL);
}
@Override
- @Override
public void setChanged() {
+ // CraftBukkit start - allow putting items back (eg cancelled InventoryMoveItemEvent)
+ if (this.isEmpty()) {
ComposterBlock.empty((Entity) null, this.state, this.level, this.pos);
this.changed = true;
+ } else {
+ this.level.setBlock(this.pos, this.state, 3);
+ this.changed = false;
+ }
+ // CraftBukkit end
}
}
- private static class InputContainer extends SimpleContainer implements WorldlyContainer {
+ public static class InputContainer extends SimpleContainer implements WorldlyContainer {
- private final BlockState state;
+ private final IBlockData state;
private final LevelAccessor level;
private final BlockPos pos;
private boolean changed;
- public InputContainer(BlockState blockstate, LevelAccessor levelaccessor, BlockPos blockpos) {
+ public InputContainer(IBlockData state, LevelAccessor level, BlockPos pos) {
super(1);
- this.state = blockstate;
- this.level = levelaccessor;
- this.pos = blockpos;
+ this.bukkitOwner = new CraftBlockInventoryHolder(level, pos, this); // CraftBukkit
+ this.state = state;
+ this.level = level;
+ this.pos = pos;
}
@Override
- @Override
public int getMaxStackSize() {
return 1;
}
@Override
- @Override
- public int[] getSlotsForFace(Direction direction) {
- return direction == Direction.UP ? new int[]{0} : new int[0];
+ public int[] getSlotsForFace(Direction side) {
+ return side == Direction.UP ? new int[]{0} : new int[0];
}
@Override
- @Override
- public boolean canPlaceItemThroughFace(int i, ItemStack itemstack, @Nullable Direction direction) {
- return !this.changed && direction == Direction.UP && ComposterBlock.COMPOSTABLES.containsKey(itemstack.getItem());
+ public boolean canPlaceItemThroughFace(int index, ItemStack itemStack, @Nullable Direction direction) {
+ return !this.changed && direction == Direction.UP && ComposterBlock.COMPOSTABLES.containsKey(itemStack.getItem());
}
@Override
- @Override
- public boolean canTakeItemThroughFace(int i, ItemStack itemstack, Direction direction) {
+ public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) {
return false;
}
@Override
- @Override
public void setChanged() {
ItemStack itemstack = this.getItem(0);
if (!itemstack.isEmpty()) {
this.changed = true;
- BlockState blockstate = ComposterBlock.addItem((Entity) null, this.state, this.level, this.pos, itemstack);
+ IBlockData iblockdata = ComposterBlock.addItem((Entity) null, this.state, this.level, this.pos, itemstack);
- this.level.levelEvent(1500, this.pos, blockstate != this.state ? 1 : 0);
+ this.level.levelEvent(1500, this.pos, iblockdata != this.state ? 1 : 0);
this.removeItemNoUpdate(0);
}
}
}
- private static class EmptyContainer extends SimpleContainer implements WorldlyContainer {
+ public static class EmptyContainer extends SimpleContainer implements WorldlyContainer {
- public EmptyContainer() {
+ public EmptyContainer(LevelAccessor generatoraccess, BlockPos blockposition) { // CraftBukkit
super(0);
+ this.bukkitOwner = new CraftBlockInventoryHolder(generatoraccess, blockposition, this); // CraftBukkit
}
@Override
- @Override
- public int[] getSlotsForFace(Direction direction) {
+ public int[] getSlotsForFace(Direction side) {
return new int[0];
}
@Override
- @Override
- public boolean canPlaceItemThroughFace(int i, ItemStack itemstack, @Nullable Direction direction) {
+ public boolean canPlaceItemThroughFace(int index, ItemStack itemStack, @Nullable Direction direction) {
return false;
}
@Override
- @Override
- public boolean canTakeItemThroughFace(int i, ItemStack itemstack, Direction direction) {
+ public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) {
return false;
}
}
|