added fastbridge terrain generator
This commit is contained in:
@@ -48,7 +48,7 @@ dependencies {
|
||||
|
||||
//Tools
|
||||
implementation 'de.articdive:jnoise:3.0.2'
|
||||
implementation 'net.md-5:bungeecord-config:1.19-R0.1-SNAPSHOT'
|
||||
implementation 'net.md-5:bungeecord-config:1.21-R0.3'
|
||||
implementation 'org.apache.commons:commons-text:1.10.0'
|
||||
implementation 'org.spongepowered:configurate-yaml:4.1.2'
|
||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||
|
@@ -27,7 +27,7 @@ public class Fastbridge extends StatelessGame {
|
||||
Player player = playerMoveEvent.getPlayer();
|
||||
Pos newPos = playerMoveEvent.getNewPosition();
|
||||
if(this.getScore().hasResult(player)) return;
|
||||
if(newPos.y() < -65) {
|
||||
if(newPos.y() < 0) {
|
||||
player.teleport(getSpawn());
|
||||
if(!isBeforeBeginning) this.resetPlayer(player);
|
||||
}
|
||||
@@ -59,6 +59,6 @@ public class Fastbridge extends StatelessGame {
|
||||
|
||||
@Override
|
||||
public synchronized Pos getSpawn() {
|
||||
return new Pos(24, -60, currentSpawn++*Chunk.CHUNK_SIZE_Z*2-8, -90, 0);
|
||||
return new Pos(24, 1, currentSpawn++*Chunk.CHUNK_SIZE_Z*2-8, -90, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,12 @@
|
||||
package eu.mhsl.minenet.minigames.instance.game.stateless.types.fastbridge;
|
||||
|
||||
import eu.mhsl.minenet.minigames.world.generator.featureEnriched.ValeGenerator;
|
||||
import eu.mhsl.minenet.minigames.world.generator.terrain.BaseGenerator;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.generator.GenerationUnit;
|
||||
import net.minestom.server.instance.generator.Generator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FastbridgeChunkgenerator implements Generator {
|
||||
@Override
|
||||
public void generate(@NotNull GenerationUnit unit) {
|
||||
public class FastbridgeChunkgenerator extends BaseGenerator {
|
||||
public FastbridgeChunkgenerator() {
|
||||
this.addMixIn(unit -> {
|
||||
if (unit.absoluteStart().chunkZ() % 2 == 0) {
|
||||
unit.modifier().fill(Block.BARRIER);
|
||||
return;
|
||||
@@ -16,8 +15,15 @@ public class FastbridgeChunkgenerator implements Generator {
|
||||
if (unit.absoluteStart().chunkX() != 1 && unit.absoluteStart().chunkX() != 3) return;
|
||||
for (int x = 5; x <= 10; x++){
|
||||
for (int z = 5; z <= 10; z++){
|
||||
unit.modifier().setRelative(x, 2, z, unit.absoluteStart().chunkX() == 3 ? Block.GOLD_BLOCK : Block.GRASS_BLOCK);
|
||||
unit.modifier().setRelative(x, 64, z, unit.absoluteStart().chunkX() == 3 ? Block.GOLD_BLOCK : Block.GRASS_BLOCK);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ValeGenerator vale = new ValeGenerator();
|
||||
vale.setXShiftMultiplier(integer -> 0.5d);
|
||||
vale.setHeightNoiseMultiplier(integer -> 2);
|
||||
vale.setXShiftOffset(integer -> 40d);
|
||||
this.addMixIn(vale);
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ public class ValeGenerator extends HeightTerrainGenerator {
|
||||
.build();
|
||||
|
||||
private Function<Integer, Double> xShiftMultiplier = multiplier -> 1d;
|
||||
private Function<Integer, Double> xShiftOffset = z -> 0d;
|
||||
|
||||
public ValeGenerator() {
|
||||
setCalculateHeight(this::calculateY);
|
||||
@@ -32,10 +33,14 @@ public class ValeGenerator extends HeightTerrainGenerator {
|
||||
}
|
||||
|
||||
public int getXShiftAtZ(int z) {
|
||||
return (int) ((curves.getNoise(z) * 32 + largeCurves.getNoise(z) * 64) * xShiftMultiplier.apply(z));
|
||||
return (int) ((curves.getNoise(z) * 32 + largeCurves.getNoise(z) * 64) * xShiftMultiplier.apply(z) + xShiftOffset.apply(z));
|
||||
}
|
||||
|
||||
public void setXShiftMultiplier(Function<Integer, Double> xShiftMultiplier) {
|
||||
this.xShiftMultiplier = xShiftMultiplier;
|
||||
}
|
||||
|
||||
public void setXShiftOffset(Function<Integer, Double> xShiftOffset) {
|
||||
this.xShiftOffset = xShiftOffset;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user