simplified block loop from generator
This commit is contained in:
+18
-15
@@ -1,12 +1,15 @@
|
||||
package eu.mhsl.minenet.minigames.instance.game.stateless.types.playerRace;
|
||||
|
||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.playerRace.obstacles.Obstacle;
|
||||
import eu.mhsl.minenet.minigames.util.GeneratorUtils;
|
||||
import eu.mhsl.minenet.minigames.world.BlockPallet;
|
||||
import eu.mhsl.minenet.minigames.world.generator.featureEnriched.ValeGenerator;
|
||||
import eu.mhsl.minenet.minigames.world.generator.terrain.BaseGenerator;
|
||||
import net.minestom.server.coordinate.Point;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class PlayerRaceChunkgenerator extends BaseGenerator {
|
||||
public PlayerRaceChunkgenerator(int height) {
|
||||
ValeGenerator vale = new ValeGenerator();
|
||||
@@ -21,26 +24,26 @@ public class PlayerRaceChunkgenerator extends BaseGenerator {
|
||||
unit.absoluteStart().chunkZ() > 16
|
||||
) return;
|
||||
|
||||
Point start = unit.absoluteStart();
|
||||
Point start = unit.absoluteStart().withY(height);
|
||||
|
||||
for(int x = 0; x <= 15; x++) {
|
||||
for(int z = 0; z <= 15; z++) {
|
||||
Point blockPosition = start.add(x, height, z);
|
||||
if(unit.absoluteStart().chunkZ() == 0) {
|
||||
unit.modifier().setBlock(blockPosition, Block.AMETHYST_BLOCK);
|
||||
continue;
|
||||
}
|
||||
if(unit.absoluteStart().chunkZ() == 16) {
|
||||
unit.modifier().setBlock(blockPosition, Block.DIAMOND_BLOCK);
|
||||
continue;
|
||||
}
|
||||
if(unit.absoluteStart().chunkZ() % 2 == 1) {
|
||||
Obstacle.getRandomObstacle().generate(unit, blockPosition);
|
||||
continue;
|
||||
Obstacle.getRandomObstacle().generate(unit, start);
|
||||
return;
|
||||
}
|
||||
unit.modifier().setBlock(blockPosition, BlockPallet.GROUND.rnd());
|
||||
|
||||
BiConsumer<Point, Block> setBlock = (Point point, Block block) -> unit.modifier().setBlock(point.withY(height), block);
|
||||
|
||||
if(unit.absoluteStart().chunkZ() == 0) {
|
||||
GeneratorUtils.foreachXZ(unit, point -> setBlock.accept(point, Block.AMETHYST_BLOCK));
|
||||
return;
|
||||
}
|
||||
|
||||
if(unit.absoluteStart().chunkZ() == 16) {
|
||||
GeneratorUtils.foreachXZ(unit, point -> setBlock.accept(point, Block.DIAMOND_BLOCK));
|
||||
return;
|
||||
}
|
||||
|
||||
GeneratorUtils.foreachXZ(unit, point -> setBlock.accept(point, BlockPallet.GROUND.rnd()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -14,10 +14,12 @@ class Mudpit extends Obstacle {
|
||||
|
||||
@Override
|
||||
public void generate(GenerationUnit unit, Point start) {
|
||||
GeneratorUtils.foreachXZ(unit, point -> {
|
||||
int modifier = point.blockX()/16 * -3;
|
||||
double heightAtBlock = this.curves.getNoise(point.blockX(), point.blockY(), point.blockZ()) * modifier;
|
||||
unit.modifier().setBlock(point.withY(v -> heightAtBlock), Block.SOUL_SAND);
|
||||
});
|
||||
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);
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user