mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 20:50:41 +01:00
SPIGOT-4584: Call events for hatching turtle eggs
This commit is contained in:
parent
0c715b32b0
commit
47b06d5b4e
1 changed files with 22 additions and 1 deletions
|
@ -33,7 +33,28 @@
|
|||
this.a(world, blockposition, world.getType(blockposition));
|
||||
}
|
||||
|
||||
@@ -70,7 +89,7 @@
|
||||
@@ -57,9 +76,19 @@
|
||||
int i = (Integer) iblockdata.get(BlockTurtleEgg.a);
|
||||
|
||||
if (i < 2) {
|
||||
+ // CraftBukkit start - Call BlockGrowEvent
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition, iblockdata.set(BlockTurtleEgg.a, i + 1), 2)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
- world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2);
|
||||
+ // world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); // CraftBukkit - handled above
|
||||
} else {
|
||||
+ // CraftBukkit start - Call BlockFadeEvent
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
|
||||
world.setAir(blockposition);
|
||||
if (!world.isClientSide) {
|
||||
@@ -70,7 +99,7 @@
|
||||
entityturtle.setAgeRaw(-24000);
|
||||
entityturtle.g(blockposition);
|
||||
entityturtle.setPositionRotation((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
|
||||
|
|
Loading…
Reference in a new issue