Skip to content

Commit

Permalink
fix: succession update is not applied accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex4386 committed Nov 3, 2024
1 parent 106cb50 commit bb34806
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
break;
} else {
boolean state = Boolean.parseBoolean(args[2]);
if (args[2].equalsIgnoreCase("enable")) {
state = true;
} else if (args[2].equalsIgnoreCase("disable")) {
state = false;
}

this.volcano.succession.setEnabled(state);

if (state) {
Expand All @@ -204,6 +210,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
msg.info("Primary Succession has been disabled!");
}
}
this.volcano.trySave(true);
} else {
msg.info(
"Primary Succession: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ public void runSuccession(Block block) {

double heatValueThreshold = 0.7;
if (targetBlock.getY() < block.getWorld().getSeaLevel() - 1) {
if (isDebug) this.volcano.logger.log(
VolcanoLogClass.SUCCESSION,
"Succession on block "+TyphonUtils.blockLocationTostring(block)+" / skipped due to sea level."
);

return;
}

Expand Down Expand Up @@ -282,6 +287,10 @@ public void runSuccession(Block block) {
if (rawHeatValue < 0.65) {
double amount = 1 - Math.min(1, Math.max(0, (rawHeatValue - 0.5) / 0.15));

if (isDebug) this.volcano.logger.log(
VolcanoLogClass.SUCCESSION,
"Succession on block "+TyphonUtils.blockLocationTostring(block)+" / amount: "+amount);

if (Math.random() < Math.pow(amount, 2)) {
targetBlock.applyBoneMeal(BlockFace.UP);
}
Expand Down

0 comments on commit bb34806

Please sign in to comment.