Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.

Commit ca610c8

Browse files
committed
fix MohistMC#1712
1 parent c0df81c commit ca610c8

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

patches/minecraft/net/minecraft/block/ComposterBlock.java.patch

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
return ActionResultType.func_233537_a_(p_225533_2_.field_72995_K);
2727
} else {
2828
return ActionResultType.PASS;
29-
@@ -204,29 +_,49 @@
29+
@@ -204,29 +_,53 @@
3030
}
3131

3232
public static BlockState func_235486_a_(BlockState p_235486_0_, ServerWorld p_235486_1_, ItemStack p_235486_2_, BlockPos p_235486_3_) {
@@ -43,7 +43,7 @@
4343
+ // CraftBukkit start
4444
+ double rand = world.func_201674_k().nextDouble();
4545
+ BlockState blockstate = attemptCompost(state, DummyGeneratorAccess.INSTANCE, pos, stack, rand);
46-
+ if (state == blockstate || org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, blockstate).isCancelled()) {
46+
+ if (state == blockstate || (entity == null || org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, blockstate).isCancelled())) {
4747
+ return state;
4848
+ }
4949
+ blockstate = attemptCompost(state, (IWorld) world, pos, stack, rand);
@@ -57,8 +57,11 @@
5757
}
5858
}
5959

60-
- public static BlockState func_235489_d_(BlockState p_235489_0_, World p_235489_1_, BlockPos p_235489_2_) {
60+
public static BlockState func_235489_d_(BlockState p_235489_0_, World p_235489_1_, BlockPos p_235489_2_) {
6161
- if (!p_235489_1_.field_72995_K) {
62+
+ return empty(p_235489_0_, p_235489_1_, p_235489_2_, null);
63+
+ }
64+
+
6265
+ // CraftBukkit start
6366
+ public static BlockState empty(BlockState state, World world, BlockPos pos, Entity entity) {
6467
+ if (entity != null) {
@@ -120,7 +123,7 @@
120123
}
121124

122125
return blockstate;
123-
@@ -282,13 +_,15 @@
126+
@@ -282,13 +_,19 @@
124127
if (i == 8) {
125128
return new ComposterBlock.FullInventory(p_219966_1_, p_219966_2_, p_219966_3_, new ItemStack(Items.field_196106_bc));
126129
} else {
@@ -132,8 +135,13 @@
132135

133136
static class EmptyInventory extends Inventory implements ISidedInventory {
134137
- public EmptyInventory() {
138+
- super(0);
139+
+ public EmptyInventory() { // CraftBukkit
140+
+ super(0);
141+
+ }
142+
+
135143
+ public EmptyInventory(IWorld world, BlockPos blockPos) { // CraftBukkit
136-
super(0);
144+
+ super(0);
137145
+ this.bukkitOwner = new CraftBlockInventoryHolder(world, blockPos, this); // CraftBukkit
138146
}
139147

0 commit comments

Comments
 (0)