removed tetris
This commit is contained in:
		@@ -11,7 +11,6 @@ import eu.mhsl.minenet.minigames.instance.game.stateless.types.deathcube.Deathcu
 | 
				
			|||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.minerun.MinerunFactory;
 | 
					import eu.mhsl.minenet.minigames.instance.game.stateless.types.minerun.MinerunFactory;
 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.spleef.SpleefFactory;
 | 
					import eu.mhsl.minenet.minigames.instance.game.stateless.types.spleef.SpleefFactory;
 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.stickfight.StickFightFactory;
 | 
					import eu.mhsl.minenet.minigames.instance.game.stateless.types.stickfight.StickFightFactory;
 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris.TetrisFactory;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.tntrun.TntRunFactory;
 | 
					import eu.mhsl.minenet.minigames.instance.game.stateless.types.tntrun.TntRunFactory;
 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.towerdefense.TowerdefenseFactory;
 | 
					import eu.mhsl.minenet.minigames.instance.game.stateless.types.towerdefense.TowerdefenseFactory;
 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.types.trafficlightrace.TrafficLightRaceFactory;
 | 
					import eu.mhsl.minenet.minigames.instance.game.stateless.types.trafficlightrace.TrafficLightRaceFactory;
 | 
				
			||||||
@@ -24,10 +23,7 @@ public enum GameList {
 | 
				
			|||||||
    TOWERDEFENSE(new TowerdefenseFactory(), GameType.PROTOTYPE),
 | 
					    TOWERDEFENSE(new TowerdefenseFactory(), GameType.PROTOTYPE),
 | 
				
			||||||
    BEDWARS(new BedwarsFactory(), GameType.PROTOTYPE),
 | 
					    BEDWARS(new BedwarsFactory(), GameType.PROTOTYPE),
 | 
				
			||||||
    BACKROOMS(new BackroomsFactory(), GameType.PROTOTYPE),
 | 
					    BACKROOMS(new BackroomsFactory(), GameType.PROTOTYPE),
 | 
				
			||||||
 | 
					 | 
				
			||||||
    ANVILRUN(new AnvilRunFactory(), GameType.PROTOTYPE),
 | 
					    ANVILRUN(new AnvilRunFactory(), GameType.PROTOTYPE),
 | 
				
			||||||
    TETRIS(new TetrisFactory(), GameType.PROTOTYPE),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    TNTRUN(new TntRunFactory(), GameType.OTHER),
 | 
					    TNTRUN(new TntRunFactory(), GameType.OTHER),
 | 
				
			||||||
    ACIDRAIN(new AcidRainFactory(), GameType.PVE),
 | 
					    ACIDRAIN(new AcidRainFactory(), GameType.PVE),
 | 
				
			||||||
    ELYTRARACE(new ElytraRaceFactory(), GameType.PVP),
 | 
					    ELYTRARACE(new ElytraRaceFactory(), GameType.PVP),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,111 +0,0 @@
 | 
				
			|||||||
package eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.score.FirstWinsScore;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.util.BatchUtil;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.Dimension;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.world.generator.terrain.CircularPlateTerrainGenerator;
 | 
					 | 
				
			||||||
import net.minestom.server.coordinate.Pos;
 | 
					 | 
				
			||||||
import net.minestom.server.coordinate.Vec;
 | 
					 | 
				
			||||||
import net.minestom.server.entity.Player;
 | 
					 | 
				
			||||||
import net.minestom.server.event.player.PlayerMoveEvent;
 | 
					 | 
				
			||||||
import net.minestom.server.instance.batch.AbsoluteBlockBatch;
 | 
					 | 
				
			||||||
import net.minestom.server.instance.block.Block;
 | 
					 | 
				
			||||||
import org.jetbrains.annotations.NotNull;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.concurrent.CompletableFuture;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class Tetris extends StatelessGame {
 | 
					 | 
				
			||||||
    private final boolean isFast;
 | 
					 | 
				
			||||||
    private final int width = 9;
 | 
					 | 
				
			||||||
    private final int height = 20;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    enum Button {
 | 
					 | 
				
			||||||
        W,
 | 
					 | 
				
			||||||
        A,
 | 
					 | 
				
			||||||
        S,
 | 
					 | 
				
			||||||
        D,
 | 
					 | 
				
			||||||
        mouseLeft,
 | 
					 | 
				
			||||||
        mouseRight,
 | 
					 | 
				
			||||||
        space
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Tetris(boolean isFast) {
 | 
					 | 
				
			||||||
        super(Dimension.THE_END.key, "Tetris", new FirstWinsScore());
 | 
					 | 
				
			||||||
        this.setGenerator(new CircularPlateTerrainGenerator(30).setPlateHeight(0));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        this.isFast = isFast;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    protected void pressedButton(Button button) {
 | 
					 | 
				
			||||||
        switch (button) {
 | 
					 | 
				
			||||||
            case A -> System.out.println("A");
 | 
					 | 
				
			||||||
            case S -> System.out.println("S");
 | 
					 | 
				
			||||||
            case D -> System.out.println("D");
 | 
					 | 
				
			||||||
            case W -> System.out.println("W");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    protected void onLoad(@NotNull CompletableFuture<Void> callback) {
 | 
					 | 
				
			||||||
        AbsoluteBlockBatch batch = new AbsoluteBlockBatch();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for(int y = 45; y <= 45+height; y++) {
 | 
					 | 
				
			||||||
            for(int x = -(width/2)-1; x <= (width/2)+1; x++) {
 | 
					 | 
				
			||||||
                batch.setBlock(x, y, 0, Block.STONE);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for(int y = 45; y <= 45+height; y++) {
 | 
					 | 
				
			||||||
            batch.setBlock(-(width/2)-1, y, 1, Block.GRAY_CONCRETE);
 | 
					 | 
				
			||||||
            batch.setBlock((width/2)+1, y, 1, Block.GRAY_CONCRETE);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        for(int x = -(width/2)-1; x <= (width/2)+1; x++) {
 | 
					 | 
				
			||||||
            batch.setBlock(x, 45, 1, Block.GRAY_CONCRETE);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        BatchUtil.loadAndApplyBatch(batch, this, () -> callback.complete(null));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    protected void onPlayerMove(@NotNull PlayerMoveEvent playerMoveEvent) {
 | 
					 | 
				
			||||||
        super.onPlayerMove(playerMoveEvent);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//        if(playerMoveEvent.getNewPosition().z() < getSpawn().z()) {
 | 
					 | 
				
			||||||
//            pressedButton(Button.W);
 | 
					 | 
				
			||||||
//        }
 | 
					 | 
				
			||||||
//        if(playerMoveEvent.getNewPosition().z() > getSpawn().z()) {
 | 
					 | 
				
			||||||
//            pressedButton(Button.S);
 | 
					 | 
				
			||||||
//        }
 | 
					 | 
				
			||||||
//        if(playerMoveEvent.getNewPosition().x() < getSpawn().x()) {
 | 
					 | 
				
			||||||
//            pressedButton(Button.A);
 | 
					 | 
				
			||||||
//        }
 | 
					 | 
				
			||||||
//        if(playerMoveEvent.getNewPosition().x() > getSpawn().x()) {
 | 
					 | 
				
			||||||
//            pressedButton(Button.D);
 | 
					 | 
				
			||||||
//        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//        playerMoveEvent.getNewPosition().asVec();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Vec movementVector = playerMoveEvent.getPlayer().getPreviousPosition().asVec().sub(playerMoveEvent.getNewPosition());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        System.out.println(movementVector);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//        if(!(playerMoveEvent.getNewPosition().withYaw(0).withPitch(0) == getSpawn().withYaw(0).withPitch(0))) {
 | 
					 | 
				
			||||||
            playerMoveEvent.setNewPosition(getSpawn().withView(playerMoveEvent.getNewPosition()));
 | 
					 | 
				
			||||||
//            return;
 | 
					 | 
				
			||||||
//        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    protected boolean onPlayerJoin(Player p) {
 | 
					 | 
				
			||||||
        p.setNoGravity(true);
 | 
					 | 
				
			||||||
        return super.onPlayerJoin(p);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public Pos getSpawn() {
 | 
					 | 
				
			||||||
        return new Pos(0, 50, 15).withView(180, 0);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,38 +0,0 @@
 | 
				
			|||||||
package eu.mhsl.minenet.minigames.instance.game.stateless.types.tetris;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.Game;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.config.GameFactory;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.config.Option;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.game.stateless.config.ConfigManager;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.instance.room.Room;
 | 
					 | 
				
			||||||
import eu.mhsl.minenet.minigames.message.component.TranslatedComponent;
 | 
					 | 
				
			||||||
import net.minestom.server.item.Material;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class TetrisFactory implements GameFactory {
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public TranslatedComponent name() {
 | 
					 | 
				
			||||||
        return TranslatedComponent.byId("game_Tetris#name");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public TranslatedComponent description() {
 | 
					 | 
				
			||||||
        return TranslatedComponent.byId("game_Tetris#description");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public ConfigManager configuration() {
 | 
					 | 
				
			||||||
        return new ConfigManager();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
 | 
					 | 
				
			||||||
        return new Tetris(false).setParent(parent);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public Material symbol() {
 | 
					 | 
				
			||||||
        return Material.PURPLE_WOOL;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user