mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
readd chorus flower events
This commit is contained in:
parent
46eccd8c7d
commit
da1947b2ad
1 changed files with 31 additions and 1 deletions
|
@ -11,7 +11,7 @@
|
|||
} else if (ageValue < 4) {
|
||||
int i = random.nextInt(4);
|
||||
if (flag1) {
|
||||
@@ -112,8 +_,10 @@
|
||||
@@ -112,18 +_,28 @@
|
||||
if (level.isEmptyBlock(blockPos1)
|
||||
&& level.isEmptyBlock(blockPos1.below())
|
||||
&& allNeighborsEmpty(level, blockPos1, randomDirection.getOpposite())) {
|
||||
|
@ -22,3 +22,33 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
level.setBlock(pos, ChorusPlantBlock.getStateWithConnections(level, pos, this.plant.defaultBlockState()), 2);
|
||||
} else {
|
||||
+ // CraftBukkit start - add event
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos, this.defaultBlockState().setValue(ChorusFlowerBlock.AGE, Integer.valueOf(5)), 2)) {
|
||||
this.placeDeadFlower(level, pos);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
+ // CraftBukkit start - add event
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos, this.defaultBlockState().setValue(ChorusFlowerBlock.AGE, Integer.valueOf(5)), 2)) {
|
||||
this.placeDeadFlower(level, pos);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -261,6 +_,11 @@
|
||||
protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) {
|
||||
BlockPos blockPos = hit.getBlockPos();
|
||||
if (level instanceof ServerLevel serverLevel && projectile.mayInteract(serverLevel, blockPos) && projectile.mayBreak(serverLevel)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockPos, state.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
level.destroyBlock(blockPos, true, projectile);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue