Skip to content

Commit

Permalink
chore: revert biome updater
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex4386 committed Dec 18, 2024
1 parent 4beb94b commit 058690b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
3 changes: 3 additions & 0 deletions Typhon.iml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
</configuration>
</facet>
</component>
<component name="McpModuleSettings">
<option name="srgType" value="SRG" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ public void onBlockFromTo(BlockFromToEvent event) {
this.tryRootlessCone();
}

toBlock.getWorld().setBiome(event.getToBlock().getLocation(), Biome.BASALT_DELTAS);
if (this.vent != null && !data.isBomb && data.source != null) {
double distance;
distance =
Expand Down Expand Up @@ -1220,7 +1219,7 @@ public boolean tryRootlessCone() {
if (this.vent.erupt.getStyle() != VolcanoEruptStyle.HAWAIIAN)
return false;

double radius = 100 + (Math.random() * (this.vent.longestNormalLavaFlowLength - 100));
double radius = 70 + (Math.random() * (this.vent.longestNormalLavaFlowLength - 70));
double angle = Math.random() * Math.PI * 2;

if (this.vent.isCaldera()) {
Expand Down Expand Up @@ -1268,7 +1267,12 @@ public int rootlessConeHeight(int height, double offset) {
public void addRootlessCone(Location location) {
Block baseBlock = TyphonUtils.getHighestRocklikes(location);

int height = 3 + (int) (Math.pow(Math.random(), 2) * (4 + (Math.random()) * 5));
int height = 3 + (int) (Math.pow(Math.random(), 1.5) * (1 + (Math.random()) * 4));
boolean tryParasiticVent = height >= 6 && this.vent.isMainVent() && Math.random() < 0.5;

if (tryParasiticVent) {
height = 10;
}

double baseRaw = getRootlessConeRadius(height);
int baseInt = (int) Math.ceil(baseRaw);
Expand All @@ -1286,15 +1290,17 @@ public void addRootlessCone(Location location) {
int limit = baseBlock.getY() + height;
if (distance < height) limit = (int) Math.round(baseBlock.getY() + distance);

if (targetBlock.getY() > limit) {
// flow lava on top of this block
if (targetHeight == height) {
if (targetBlock.getType().isAir() || targetBlock.getType() == Material.WATER) {
if (allowLavaFlow && Math.random() < 0.2) this.flowLava(targetBlock);
if (!tryParasiticVent) {
if (targetBlock.getY() > limit) {
// flow lava on top of this block
if (targetHeight == height) {
if (targetBlock.getType().isAir() || targetBlock.getType() == Material.WATER) {
if (allowLavaFlow && Math.random() < 0.2) this.flowLava(targetBlock);
}
}
}

break;
break;
}
}

if (targetBlock.getType().isAir() || targetBlock.getType() == Material.WATER) {
Expand Down Expand Up @@ -1329,19 +1335,16 @@ public void addRootlessCone(Location location) {
this.vent.bombs.launchSpecifiedBomb(bomb);
}

if (height >= 10 && this.vent.isMainVent()) {
if (tryParasiticVent) {
// check if it is too nearby existing vent

if (Math.random() < Math.pow(Math.min(12, height) - 10.0 / 2, 2)) {
return;
}

if (Math.random() < 0.9) return;
VolcanoVent nearestVent = this.getVolcano().manager.getNearestVent(location);
if (nearestVent != null && nearestVent.getTwoDimensionalDistance(location) < 50) return;

int finalHeight = height;
this.generateParasiticVent(baseBlock.getLocation(), "rootless", vent -> {
vent.setRadius(height);
vent.setRadius(finalHeight);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,16 @@ public boolean shouldCheckHeat(Block block) {
}

public void returnToNormalBiome(Block block) {
// if (block.getY() > snowYAxis) {
// block.getWorld().setBiome(block.getLocation(), Biome.GROVE);
// } else if (block.getY() > peakThreshold) {
// block.getWorld().setBiome(block.getLocation(), Biome.JAGGED_PEAKS);
// } else {
// block.getWorld().setBiome(block.getLocation(), Biome.MEADOW);
// }
//
// block.getWorld().refreshChunk(block.getChunk().getX(), block.getChunk().getZ());

if (block.getY() > snowYAxis) {
block.getWorld().setBiome(block.getLocation(), Biome.GROVE);
} else if (block.getY() > peakThreshold) {
block.getWorld().setBiome(block.getLocation(), Biome.JAGGED_PEAKS);
} else {
block.getWorld().setBiome(block.getLocation(), Biome.MEADOW);
}
}

public void runSuccession(Block block) {
Expand Down Expand Up @@ -432,7 +434,6 @@ public void spreadSoil(Block block, int spreadRange, boolean withExtension) {
returnToNormalBiome(block);

VolcanoVent vent = this.volcano.manager.getNearestVent(block);

for (Block rockRange : treeRange) {
double distance = TyphonUtils.getTwoDimensionalDistance(
rockRange.getLocation(),
Expand Down

0 comments on commit 058690b

Please sign in to comment.