added playerrace and updated to version 26.2 #14
+16
-1
@@ -4,20 +4,30 @@ 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.entity.GameMode;
|
||||||
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.event.player.PlayerMoveEvent;
|
import net.minestom.server.event.player.PlayerMoveEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PlayerRace extends StatelessGame {
|
public class PlayerRace extends StatelessGame {
|
||||||
private final int height = 64;
|
private final int height = 64;
|
||||||
|
private double zLine = 32;
|
||||||
|
private double zSpawnPoint = 14.5;
|
||||||
|
|
||||||
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(this.height, obstacleCount));
|
this.setGenerator(new PlayerRaceChunkgenerator(this.height, obstacleCount));
|
||||||
}
|
}
|
||||||
|
Pupsi marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onPlayerJoin(Player p) {
|
||||||
|
p.setGameMode(GameMode.ADVENTURE);
|
||||||
|
return false;
|
||||||
|
Pupsi marked this conversation as resolved
Outdated
Pupsi
commented
Bei LastWinsScore gewinnt derjenige, der als letztes ins Ziel kommt... Bei LastWinsScore gewinnt derjenige, der als letztes ins Ziel kommt...
|
|||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pos getSpawn() {
|
public Pos getSpawn() {
|
||||||
return new Pos(8, this.height + 1.5, 8);
|
return new Pos(8, this.height + 1.5, this.zSpawnPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -25,5 +35,10 @@ public class PlayerRace extends StatelessGame {
|
|||||||
var player = playerMoveEvent.getPlayer();
|
var player = playerMoveEvent.getPlayer();
|
||||||
if(playerMoveEvent.getNewPosition().y() < this.height - 5)
|
if(playerMoveEvent.getNewPosition().y() < this.height - 5)
|
||||||
player.teleport(this.getSpawn());
|
player.teleport(this.getSpawn());
|
||||||
|
|
||||||
|
if(playerMoveEvent.getNewPosition().z() >= this.zLine) {
|
||||||
|
this.zLine += 19;
|
||||||
|
this.zSpawnPoint += 19;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
package eu.mhsl.minenet.minigames.instance.game.stateless.types.playerRace.obstacles;
|
||||||
|
|
||||||
|
import eu.mhsl.minenet.minigames.world.BlockPallet;
|
||||||
|
import net.minestom.server.coordinate.Point;
|
||||||
|
import net.minestom.server.instance.block.Block;
|
||||||
|
import net.minestom.server.instance.generator.GenerationUnit;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
class LadderWall2 extends Obstacle{
|
||||||
|
@Override
|
||||||
|
public void generate(GenerationUnit unit, Point start) {
|
||||||
|
forEachColumn(start, point ->
|
||||||
|
unit.modifier().setBlock(point.withY(start.blockY()), BlockPallet.STREET.rnd()));
|
||||||
|
|
||||||
|
this.buildWall(unit, start,4, 4, false);
|
||||||
|
this.buildWall(unit, start,10, 8, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildWall(GenerationUnit unit, Point start, int z, int height, boolean lastRow) {
|
||||||
|
Random random = new Random();
|
||||||
|
int y = 1;
|
||||||
|
for(int x = 0; x < 16; x++) {
|
||||||
|
for(int wy = 0; wy <= height; wy++) {
|
||||||
|
unit.modifier().setBlock(start.add(x, y + wy, z), BlockPallet.STONE.rnd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int wy = lastRow ? 2 : 0; wy <= height; wy++) {
|
||||||
|
|
||||||
|
Set<Integer> noLadder = new HashSet<>();
|
||||||
|
for(int i = 0; i < 5; i++) {
|
||||||
|
noLadder.add(random.nextInt(16));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int x = 0; x < 16; x++) {
|
||||||
|
if(!noLadder.contains(x))
|
||||||
|
unit.modifier().setBlock(start.add(x, y + wy, z - 1), Block.LADDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!lastRow) {
|
||||||
|
for(int x = 7; x < 9; x++) {
|
||||||
|
unit.modifier().setBlock(start.add(x, y + wy, z + 1), Block.LADDER.withProperty("facing", "south"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -32,6 +32,7 @@ public abstract class Obstacle {
|
|||||||
new MushroomRoofs(),
|
new MushroomRoofs(),
|
||||||
new SandDunes(),
|
new SandDunes(),
|
||||||
new LadderWall(),
|
new LadderWall(),
|
||||||
|
new LadderWall2(),
|
||||||
new GlassPaneWeave(),
|
new GlassPaneWeave(),
|
||||||
new BoulderTrench(),
|
new BoulderTrench(),
|
||||||
new BambooThicket()
|
new BambooThicket()
|
||||||
|
|||||||
Reference in New Issue
Block a user
Checkpoints sollten nicht global für alle Spieler gleich sein, sonst werden langsamere Spieler beim herunterfallen nach vorne teleportiert.