9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-19 15:09:25 +00:00

Run grow actions at last

This commit is contained in:
XiaoMoMi
2024-09-05 16:55:33 +08:00
parent 37cef6b3f8
commit f9a1437129

View File

@@ -361,18 +361,18 @@ public class CropBlock extends AbstractCustomCropsBlock {
CropStageConfig nextStage = config.stageWithModelByPoint(afterPoints);
BukkitCustomCropsPlugin.getInstance().getScheduler().sync().run(() -> {
for (int i = previousPoint + 1; i <= afterPoints; i++) {
CropStageConfig stage = config.stageByPoint(i);
if (stage != null) {
ActionManager.trigger(context, stage.growActions());
}
}
if (currentStage == nextStage) return;
FurnitureRotation rotation = BukkitCustomCropsPlugin.getInstance().getItemManager().remove(bukkitLocation, ExistenceForm.ANY);
if (rotation == FurnitureRotation.NONE && config.rotation()) {
rotation = FurnitureRotation.random();
}
BukkitCustomCropsPlugin.getInstance().getItemManager().place(bukkitLocation, nextStage.existenceForm(), Objects.requireNonNull(nextStage.stageID()), rotation);
for (int i = previousPoint + 1; i <= afterPoints; i++) {
CropStageConfig stage = config.stageByPoint(i);
if (stage != null) {
ActionManager.trigger(context, stage.growActions());
}
}
}, bukkitLocation);
}