3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 06:40:07 +01:00
Paper/nms-patches/BlockChorusFlower.patch

62 Zeilen
3.3 KiB
Diff

2016-02-29 22:32:46 +01:00
--- a/net/minecraft/server/BlockChorusFlower.java
+++ b/net/minecraft/server/BlockChorusFlower.java
2016-05-10 13:47:39 +02:00
@@ -4,6 +4,8 @@
2016-02-29 22:32:46 +01:00
import java.util.Random;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
2016-02-29 22:32:46 +01:00
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockChorusFlower extends Block {
2019-04-23 04:00:00 +02:00
public static final BlockStateInteger AGE = BlockProperties.ab;
@@ -58,8 +60,12 @@
2016-02-29 22:32:46 +01:00
}
2019-04-23 04:00:00 +02:00
if (flag && b((IWorldReader) world, blockposition1, (EnumDirection) null) && world.isEmpty(blockposition.up(2))) {
2018-07-15 02:00:00 +02:00
- world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
- this.b(world, blockposition1, i);
2016-02-29 22:32:46 +01:00
+ // CraftBukkit start - add event
2018-07-15 02:00:00 +02:00
+ if (CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
+ world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
+ this.b(world, blockposition1, i);
2016-02-29 22:32:46 +01:00
+ }
+ // CraftBukkit end
} else if (i < 4) {
j = random.nextInt(4);
2018-07-15 02:00:00 +02:00
if (flag1) {
2019-04-23 04:00:00 +02:00
@@ -73,18 +79,30 @@
2016-02-29 22:32:46 +01:00
BlockPosition blockposition2 = blockposition.shift(enumdirection);
2019-04-23 04:00:00 +02:00
if (world.isEmpty(blockposition2) && world.isEmpty(blockposition2.down()) && b((IWorldReader) world, blockposition2, enumdirection.opposite())) {
2018-07-15 02:00:00 +02:00
- this.b(world, blockposition2, i + 1);
2016-02-29 22:32:46 +01:00
- flag2 = true;
+ // CraftBukkit start - add event
2018-07-15 02:00:00 +02:00
+ if (CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) {
+ this.b(world, blockposition2, i + 1);
2016-02-29 22:32:46 +01:00
+ flag2 = true;
+ }
+ // CraftBukkit end
}
}
if (flag2) {
2018-07-15 02:00:00 +02:00
world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
2016-02-29 22:32:46 +01:00
} else {
2018-07-15 02:00:00 +02:00
- this.a(world, blockposition);
2016-02-29 22:32:46 +01:00
+ // CraftBukkit - add event
2018-07-15 02:00:00 +02:00
+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
+ this.a(world, blockposition);
2016-02-29 22:32:46 +01:00
+ }
+ // CraftBukkit end
}
2018-07-15 02:00:00 +02:00
} else {
- this.a(world, blockposition);
2016-02-29 22:32:46 +01:00
+ // CraftBukkit - add event
2018-07-15 02:00:00 +02:00
+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
+ this.a(world, blockposition);
2016-02-29 22:32:46 +01:00
+ }
+ // CraftBukkit end
}
}