From 25654d8cd3d1aa4f440d8750a1b479e2b94b3a5f Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Wed, 4 Dec 2024 16:55:04 +0800 Subject: [PATCH] Fix bone meal grow actions --- .../customcrops/api/core/block/CropBlock.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/net/momirealms/customcrops/api/core/block/CropBlock.java b/api/src/main/java/net/momirealms/customcrops/api/core/block/CropBlock.java index becdfdf..5021faa 100644 --- a/api/src/main/java/net/momirealms/customcrops/api/core/block/CropBlock.java +++ b/api/src/main/java/net/momirealms/customcrops/api/core/block/CropBlock.java @@ -266,19 +266,26 @@ public class CropBlock extends AbstractCustomCropsBlock { CropStageConfig nextStage = cropConfig.stageWithModelByPoint(afterPoints); Context blockContext = Context.block(state, location); + if (Objects.equals(nextStage.stageID(), event.relatedID())) { + for (int i = point + 1; i <= afterPoints; i++) { + CropStageConfig stage = cropConfig.stageByPoint(i); + if (stage != null) { + ActionManager.trigger(blockContext, stage.growActions()); + } + } + return; + } + FurnitureRotation rotation = BukkitCustomCropsPlugin.getInstance().getItemManager().remove(location, ExistenceForm.ANY); + if (rotation == FurnitureRotation.NONE && cropConfig.rotation()) { + rotation = FurnitureRotation.random(); + } + BukkitCustomCropsPlugin.getInstance().getItemManager().place(location, nextStage.existenceForm(), Objects.requireNonNull(nextStage.stageID()), rotation); for (int i = point + 1; i <= afterPoints; i++) { CropStageConfig stage = cropConfig.stageByPoint(i); if (stage != null) { ActionManager.trigger(blockContext, stage.growActions()); } } - - if (Objects.equals(nextStage.stageID(), event.relatedID())) return; - FurnitureRotation rotation = BukkitCustomCropsPlugin.getInstance().getItemManager().remove(location, ExistenceForm.ANY); - if (rotation == FurnitureRotation.NONE && cropConfig.rotation()) { - rotation = FurnitureRotation.random(); - } - BukkitCustomCropsPlugin.getInstance().getItemManager().place(location, nextStage.existenceForm(), Objects.requireNonNull(nextStage.stageID()), rotation); return; } }