@@ -8,46 +8,31 @@
|
||||
+
|
||||
public class BlockChorusFlower extends Block {
|
||||
|
||||
public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 5);
|
||||
@@ -68,8 +70,20 @@
|
||||
public static final BlockStateInteger AGE = BlockProperties.U;
|
||||
@@ -61,8 +63,12 @@
|
||||
}
|
||||
|
||||
if (flag && a(world, blockposition1, (EnumDirection) null) && world.isEmpty(blockposition.up(2))) {
|
||||
- world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
- this.a(world, blockposition1, i);
|
||||
+ // world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
+ // this.a(world, blockposition1, i);
|
||||
if (flag && a((IWorldReader) world, blockposition1, (EnumDirection) null) && world.isEmpty(blockposition.up(2))) {
|
||||
- world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
|
||||
- this.b(world, blockposition1, i);
|
||||
+ // CraftBukkit start - add event
|
||||
+ BlockPosition target = blockposition1;
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(
|
||||
+ world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()),
|
||||
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
+ this,
|
||||
+ toLegacyData(this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i)))
|
||||
+ )) {
|
||||
+ world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
+ world.triggerEffect(1033, blockposition, 0);
|
||||
+ 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);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (i < 4) {
|
||||
j = random.nextInt(4);
|
||||
boolean flag2 = false;
|
||||
@@ -83,18 +97,53 @@
|
||||
if (flag1) {
|
||||
@@ -76,18 +82,30 @@
|
||||
BlockPosition blockposition2 = blockposition.shift(enumdirection);
|
||||
|
||||
if (world.isEmpty(blockposition2) && world.isEmpty(blockposition2.down()) && a(world, blockposition2, enumdirection.opposite())) {
|
||||
- this.a(world, blockposition2, i + 1);
|
||||
if (world.isEmpty(blockposition2) && world.isEmpty(blockposition2.down()) && a((IWorldReader) world, blockposition2, enumdirection.opposite())) {
|
||||
- this.b(world, blockposition2, i + 1);
|
||||
- flag2 = true;
|
||||
+ // CraftBukkit start - add event
|
||||
+ // this.a(world, blockposition2, i + 1);
|
||||
+ BlockPosition target = blockposition2;
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(
|
||||
+ world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()),
|
||||
+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
+ this,
|
||||
+ toLegacyData(this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)))
|
||||
+ )) {
|
||||
+ world.triggerEffect(1033, blockposition, 0);
|
||||
+ if (CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(i + 1)), 2)) {
|
||||
+ this.b(world, blockposition2, i + 1);
|
||||
+ flag2 = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -55,37 +40,21 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
world.setTypeAndData(blockposition, Blocks.CHORUS_PLANT.getBlockData(), 2);
|
||||
world.setTypeAndData(blockposition, this.b.a((IBlockAccess) world, blockposition), 2);
|
||||
} else {
|
||||
- this.c(world, blockposition);
|
||||
- this.a(world, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(
|
||||
+ world,
|
||||
+ blockposition.getX(),
|
||||
+ blockposition.getY(),
|
||||
+ blockposition.getZ(),
|
||||
+ this,
|
||||
+ toLegacyData(iblockdata.set(BlockChorusFlower.AGE, Integer.valueOf(5)))
|
||||
+ )) {
|
||||
+ world.triggerEffect(1034, blockposition, 0);
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
|
||||
+ this.a(world, blockposition);
|
||||
+ }
|
||||
+ // this.c(world, blockposition);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if (i == 4) {
|
||||
- this.c(world, blockposition);
|
||||
} else {
|
||||
- this.a(world, blockposition);
|
||||
+ // CraftBukkit - add event
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(
|
||||
+ world,
|
||||
+ blockposition.getX(),
|
||||
+ blockposition.getY(),
|
||||
+ blockposition.getZ(),
|
||||
+ this,
|
||||
+ toLegacyData(iblockdata.set(BlockChorusFlower.AGE, Integer.valueOf(5)))
|
||||
+ )) {
|
||||
+ world.triggerEffect(1034, blockposition, 0);
|
||||
+ if (CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getBlockData().set(BlockChorusFlower.AGE, Integer.valueOf(5)), 2)) {
|
||||
+ this.a(world, blockposition);
|
||||
+ }
|
||||
+ // this.c(world, blockposition);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user