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

Fix bone meal grow actions

This commit is contained in:
XiaoMoMi
2024-12-04 16:55:04 +08:00
parent c96690dfaa
commit 25654d8cd3

View File

@@ -266,19 +266,26 @@ public class CropBlock extends AbstractCustomCropsBlock {
CropStageConfig nextStage = cropConfig.stageWithModelByPoint(afterPoints);
Context<CustomCropsBlockState> 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;
}
}