9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-19 15:09:25 +00:00
This commit is contained in:
XiaoMoMi
2024-09-22 21:27:31 +08:00
parent 5802976433
commit 780ec12fdb
4 changed files with 17 additions and 4 deletions

View File

@@ -176,10 +176,11 @@ public abstract class AbstractCustomEventListener implements Listener {
if (ConfigManager.overriddenCrops().contains(block.getType())) {
event.setDropItems(false);
}
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
this.itemManager.handlePlayerBreak(
event.getPlayer(),
block.getLocation(),
event.getPlayer().getInventory().getItemInMainHand(),
itemStack,
block.getBlockData().getAsString(),
event
);

View File

@@ -204,7 +204,19 @@ public class CropBlock extends AbstractCustomCropsBlock {
int point = point(state);
CropStageConfig stageConfig = cropConfig.stageByID(event.relatedID());
assert stageConfig != null;
if (stageConfig == null) {
// fix it if it's a wrong data
world.removeBlockState(pos3);
state = fixOrGetState(world, pos3, event.relatedID());
if (state == null) {
return;
}
cropConfig = config(state);
stageConfig = cropConfig.stageByID(event.relatedID());
if (stageConfig == null) {
return;
}
}
if (!RequirementManager.isSatisfied(context, stageConfig.interactRequirements())) {
return;
}

View File

@@ -83,7 +83,7 @@ public class WateringCanItem extends AbstractCustomCropsItem {
wrapped.maxDamage().ifPresent(max -> {
if (max <= 0) return;
int damage = (int) (max * (((double) config.storage() - realWater) / config.storage()));
wrapped.damage(damage);
wrapped.damage(Math.min(Math.max(1, damage), max - 1));
});
// set appearance
Optional.ofNullable(config.appearance(realWater)).ifPresent(wrapped::customModelData);

View File

@@ -1,6 +1,6 @@
# Project settings
# Rule: [major update].[feature update].[bug fix]
project_version=3.6.11
project_version=3.6.12
config_version=41
project_group=net.momirealms