merged origin/develop-jannis

This commit is contained in:
2026-07-18 22:15:03 +02:00
2 changed files with 17 additions and 12 deletions
@@ -4,25 +4,26 @@ import eu.mhsl.minenet.minigames.instance.Dimension;
import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame; import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
import eu.mhsl.minenet.minigames.score.LastWinsScore; import eu.mhsl.minenet.minigames.score.LastWinsScore;
import net.minestom.server.coordinate.Pos; import net.minestom.server.coordinate.Pos;
import net.minestom.server.instance.block.Block; import net.minestom.server.event.player.PlayerMoveEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.concurrent.CompletableFuture;
public class PlayerRace extends StatelessGame { public class PlayerRace extends StatelessGame {
private final int height = 64;
public PlayerRace(int obstacleCount) { public PlayerRace(int obstacleCount) {
super(Dimension.THE_END.key, "PlayerRace", new LastWinsScore()); super(Dimension.THE_END.key, "PlayerRace", new LastWinsScore());
this.setGenerator(new PlayerRaceChunkgenerator(64, obstacleCount)); this.setGenerator(new PlayerRaceChunkgenerator(this.height, obstacleCount));
}
@Override
protected void onLoad(@NotNull CompletableFuture<Void> callback) {
this.setBlock(0, 100, 0, Block.AMETHYST_BLOCK);
} }
@Override @Override
public Pos getSpawn() { public Pos getSpawn() {
return new Pos(0.5, 101.5, 0.5); return new Pos(8, this.height + 1.5, 8);
} }
@Override
protected void onPlayerMove(@NotNull PlayerMoveEvent playerMoveEvent) {
var player = playerMoveEvent.getPlayer();
if(playerMoveEvent.getNewPosition().y() < this.height - 5)
player.teleport(this.getSpawn());
}
} }
@@ -9,7 +9,8 @@ import java.util.Random;
/** /**
* Alte Festungsmauer quer über die Strecke: Drei Blöcke hoch, zu hoch zum * Alte Festungsmauer quer über die Strecke: Drei Blöcke hoch, zu hoch zum
* Springen — auf beiden Seiten hängen Leitern zum Drüberklettern. * Springen — nur an manchen Säulen hängen Leitern, den Aufstieg muss man
* erst finden. Auf der Rückseite geht es überall hinunter.
*/ */
class LadderWall extends Obstacle { class LadderWall extends Obstacle {
@Override @Override
@@ -20,12 +21,15 @@ class LadderWall extends Obstacle {
unit.modifier().setBlock(point.withY(start.blockY()), BlockPallet.STONE.rnd())); unit.modifier().setBlock(point.withY(start.blockY()), BlockPallet.STONE.rnd()));
for(int x = 0; x < 16; x++) { for(int x = 0; x < 16; x++) {
boolean hasLadder = rnd.nextInt(3) != 0;
for(int y = 1; y <= 3; y++) { for(int y = 1; y <= 3; y++) {
for(int z = 7; z <= 8; z++) { for(int z = 7; z <= 8; z++) {
Block block = rnd.nextInt(3) == 0 ? Block.MOSSY_STONE_BRICKS : Block.STONE_BRICKS; Block block = rnd.nextInt(3) == 0 ? Block.MOSSY_STONE_BRICKS : Block.STONE_BRICKS;
unit.modifier().setBlock(start.add(x, y, z), block); unit.modifier().setBlock(start.add(x, y, z), block);
} }
unit.modifier().setBlock(start.add(x, y, 6), Block.LADDER.withProperty("facing", "north")); if(hasLadder) {
unit.modifier().setBlock(start.add(x, y, 6), Block.LADDER.withProperty("facing", "north"));
}
unit.modifier().setBlock(start.add(x, y, 9), Block.LADDER.withProperty("facing", "south")); unit.modifier().setBlock(start.add(x, y, 9), Block.LADDER.withProperty("facing", "south"));
} }