added cos function to mudpit
This commit is contained in:
+8
-7
@@ -2,6 +2,7 @@ package eu.mhsl.minenet.minigames.instance.game.stateless.types.playerRace.obsta
|
||||
|
||||
import de.articdive.jnoise.JNoise;
|
||||
import eu.mhsl.minenet.minigames.util.GeneratorUtils;
|
||||
import net.minestom.server.coordinate.CoordConversion;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.generator.GenerationUnit;
|
||||
@@ -14,12 +15,12 @@ class Mudpit extends Obstacle {
|
||||
|
||||
@Override
|
||||
public void generate(GenerationUnit unit, Point start) {
|
||||
unit.modifier().setBlock(start, Block.BAMBOO_BLOCK);
|
||||
|
||||
// GeneratorUtils.foreachXZ(unit, point -> {
|
||||
// int modifier = point.blockX() / 16 * 5;
|
||||
// double heightAtBlock = this.curves.getNoise(point.blockX(), point.blockY(), point.blockZ()) * modifier;
|
||||
// unit.modifier().setBlock(point.withY(v -> heightAtBlock), Block.SOUL_SAND);
|
||||
// });
|
||||
GeneratorUtils.foreachXZ(unit, point -> {
|
||||
double relative = CoordConversion.globalToSectionRelative(point.blockZ());
|
||||
double modifier = -1.5 * Math.cos(relative * Math.PI/7.5) + 1.5;
|
||||
double heightAtBlock = start.blockY() + this.curves.getNoise(point.blockX(), point.blockZ()) * modifier;
|
||||
unit.modifier().setBlock(point.withY(heightAtBlock), Block.SOUL_SAND);
|
||||
unit.modifier().setBlock(point.withY(heightAtBlock-1), Block.SOUL_SAND);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user