added fastbridge terrain generator
This commit is contained in:
@@ -48,7 +48,7 @@ dependencies {
|
|||||||
|
|
||||||
//Tools
|
//Tools
|
||||||
implementation 'de.articdive:jnoise:3.0.2'
|
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.apache.commons:commons-text:1.10.0'
|
||||||
implementation 'org.spongepowered:configurate-yaml:4.1.2'
|
implementation 'org.spongepowered:configurate-yaml:4.1.2'
|
||||||
implementation 'com.sparkjava:spark-core:2.9.4'
|
implementation 'com.sparkjava:spark-core:2.9.4'
|
||||||
|
@@ -27,7 +27,7 @@ public class Fastbridge extends StatelessGame {
|
|||||||
Player player = playerMoveEvent.getPlayer();
|
Player player = playerMoveEvent.getPlayer();
|
||||||
Pos newPos = playerMoveEvent.getNewPosition();
|
Pos newPos = playerMoveEvent.getNewPosition();
|
||||||
if(this.getScore().hasResult(player)) return;
|
if(this.getScore().hasResult(player)) return;
|
||||||
if(newPos.y() < -65) {
|
if(newPos.y() < 0) {
|
||||||
player.teleport(getSpawn());
|
player.teleport(getSpawn());
|
||||||
if(!isBeforeBeginning) this.resetPlayer(player);
|
if(!isBeforeBeginning) this.resetPlayer(player);
|
||||||
}
|
}
|
||||||
@@ -59,6 +59,6 @@ public class Fastbridge extends StatelessGame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized Pos getSpawn() {
|
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,23 +1,29 @@
|
|||||||
package eu.mhsl.minenet.minigames.instance.game.stateless.types.fastbridge;
|
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.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 {
|
public class FastbridgeChunkgenerator extends BaseGenerator {
|
||||||
@Override
|
public FastbridgeChunkgenerator() {
|
||||||
public void generate(@NotNull GenerationUnit unit) {
|
this.addMixIn(unit -> {
|
||||||
if (unit.absoluteStart().chunkZ() % 2 == 0) {
|
if (unit.absoluteStart().chunkZ() % 2 == 0) {
|
||||||
unit.modifier().fill(Block.BARRIER);
|
unit.modifier().fill(Block.BARRIER);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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, 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();
|
.build();
|
||||||
|
|
||||||
private Function<Integer, Double> xShiftMultiplier = multiplier -> 1d;
|
private Function<Integer, Double> xShiftMultiplier = multiplier -> 1d;
|
||||||
|
private Function<Integer, Double> xShiftOffset = z -> 0d;
|
||||||
|
|
||||||
public ValeGenerator() {
|
public ValeGenerator() {
|
||||||
setCalculateHeight(this::calculateY);
|
setCalculateHeight(this::calculateY);
|
||||||
@@ -32,10 +33,14 @@ public class ValeGenerator extends HeightTerrainGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getXShiftAtZ(int z) {
|
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) {
|
public void setXShiftMultiplier(Function<Integer, Double> xShiftMultiplier) {
|
||||||
this.xShiftMultiplier = xShiftMultiplier;
|
this.xShiftMultiplier = xShiftMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setXShiftOffset(Function<Integer, Double> xShiftOffset) {
|
||||||
|
this.xShiftOffset = xShiftOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user