Added Backrooms gamemode

This commit is contained in:
MineTec committed 2023-05-18 21:18:08 +02:00
1 parent 7c5d610803
commit 671857b9e4
16 files changed
+140 -6

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -7,7 +7,7 @@
<pattern value="eu.mhsl.minenet.minigames.util.InventoryItemAlignment.ItemOffset" method="getX" /> <pattern value="eu.mhsl.minenet.minigames.util.InventoryItemAlignment.ItemOffset" method="getX" />
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Minigames.main.iml" filepath="$PROJECT_DIR$/.idea/modules/Minigames.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Minigames.test.iml" filepath="$PROJECT_DIR$/.idea/modules/Minigames.test.iml" />
</modules>
</component>
</project>
+7 -4
View File
@@ -32,18 +32,21 @@ dependencies {
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
//https://jitpack.io/#Minestom/Minestom //https://jitpack.io/#Minestom/Minestom
implementation 'com.github.Minestom:Minestom:aa621021e2' //implementation 'com.github.Minestom:Minestom:aa621021e2'
implementation 'com.github.Minestom.Minestom:Minestom:79ce9570ea'
//Tools //Tools
implementation 'com.github.articdive:jnoise:2.1.0' //implementation 'com.github.Articdive.JNoise:jnoise-core:4.0.0'
implementation 'de.articdive:jnoise:3.0.2'
// implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4.2' // implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4.2'
// implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4' // implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.4'
implementation 'org.yaml:snakeyaml:1.33' implementation 'org.yaml:snakeyaml:2.0'
implementation 'net.md-5:bungeecord-config:1.19-R0.1-SNAPSHOT' implementation 'net.md-5:bungeecord-config:1.19-R0.1-SNAPSHOT'
//PvP //PvP
implementation 'com.github.TogAr2:MinestomPvP:135ec9e2b7' implementation 'com.github.TogAr2:MinestomPvP:35e5661'
//implementation 'com.github.TogAr2:MinestomPvP:135ec9e2b7'
// Hephaestus engine // Hephaestus engine
Binary file not shown.
@@ -1,6 +1,7 @@
package eu.mhsl.minenet.minigames.instance.game; package eu.mhsl.minenet.minigames.instance.game;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.GameFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.config.GameFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.backrooms.BackroomsFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.bedwars.BedwarsFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.bedwars.BedwarsFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.deathcube.DeathcubeFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.deathcube.DeathcubeFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.types.minerun.MinerunFactory; import eu.mhsl.minenet.minigames.instance.game.stateless.types.minerun.MinerunFactory;
@@ -14,7 +15,8 @@ public enum GameList {
MINERUN(new MinerunFactory(), GameType.PVE), MINERUN(new MinerunFactory(), GameType.PVE),
TRAFFICLIGHTRACE(new TrafficLightRaceFactory(), GameType.OTHER), TRAFFICLIGHTRACE(new TrafficLightRaceFactory(), GameType.OTHER),
TOWERDEFENSE(new TowerdefenseFactory(), GameType.PVE), TOWERDEFENSE(new TowerdefenseFactory(), GameType.PVE),
BEDWARS(new BedwarsFactory(), GameType.PVP); BEDWARS(new BedwarsFactory(), GameType.PVP),
BACKROOMS(new BackroomsFactory(), GameType.PVE);
private final GameFactory factory; private final GameFactory factory;
private final GameType type; private final GameType type;
@@ -0,0 +1,14 @@
package eu.mhsl.minenet.minigames.instance.game.stateless.types.backrooms;
import eu.mhsl.minenet.minigames.instance.Dimension;
import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
public class Backrooms extends StatelessGame {
public Backrooms() {
super(Dimension.NETHER.DIMENSION, "Backrooms");
BackroomsGenerator generator = new BackroomsGenerator();
setGenerator(unit -> generator.generateRoom(unit, 50));
}
}
@@ -0,0 +1,20 @@
package eu.mhsl.minenet.minigames.instance.game.stateless.types.backrooms;
import eu.mhsl.minenet.minigames.instance.game.stateless.StatelessGame;
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.message.component.TranslatedComponent;
import java.util.Map;
public class BackroomsFactory implements GameFactory {
@Override
public TranslatedComponent name() {
return TranslatedComponent.byId("gameBackrooms");
}
@Override
public StatelessGame manufacture(Map<String, Option<?>> configuration) throws Exception {
return new Backrooms();
}
}
@@ -0,0 +1,86 @@
package eu.mhsl.minenet.minigames.instance.game.stateless.types.backrooms;
import net.minestom.server.instance.block.Block;
import net.minestom.server.instance.generator.GenerationUnit;
import net.minestom.server.instance.generator.UnitModifier;
import java.util.concurrent.ThreadLocalRandom;
public class BackroomsGenerator {
public void generateRoom(GenerationUnit unit, int y) {
var modifier = unit.modifier();
var start = unit.absoluteStart();
var yPos = start.blockY() + y;
for (int x = 0; x < unit.size().blockX(); x++) {
for (int z = 0; z < unit.size().blockZ(); z++) {
var xPos = start.blockX() + x;
var zPos = start.blockZ() + z;
modifier.setBlock(xPos, yPos - 1, zPos, Block.BEDROCK);
modifier.setBlock(xPos, yPos + 5, zPos, Block.BEDROCK);
modifier.setBlock(xPos, yPos, zPos, Block.LIGHT_GRAY_WOOL);
modifier.setBlock(xPos, yPos + 4, zPos, Block.SMOOTH_STONE_SLAB);
// idk man... dont ask about this
if (
(x - 2) % 4 == 0 && (
((z - 2) % 8 == 0) ||
((z - 2) % 8 == 1) ||
((z - 2) % 8 == 3) ||
((z - 2) % 8 == 4)
)
) {
modifier.setBlock(xPos, yPos + 4, zPos, Block.SEA_LANTERN);
}
}
}
generateWalls(modifier, start.blockX() + 0, yPos + 1, start.blockZ() + 0);
generateWalls(modifier, start.blockX() + 8, yPos + 1, start.blockZ() + 0);
generateWalls(modifier, start.blockX() + 0, yPos + 1, start.blockZ() + 8);
generateWalls(modifier, start.blockX() + 8, yPos + 1, start.blockZ() + 8);
}
private void generateWalls(UnitModifier modifier, int xPos, int yPos, int zPos) {
generatePillar(modifier, xPos, yPos, zPos, Block.CHISELED_SANDSTONE);
var random = ThreadLocalRandom.current();
var wall1 = random.nextInt(4) != 0;
var wall2 = random.nextInt(4) != 0;
var door1 = random.nextInt(2) != 0;
var door2 = random.nextInt(2) != 0;
var door1pos = random.nextInt(2, 6);
var door2pos = random.nextInt(2, 6);
if (wall1) {
for (int x = xPos; x < xPos + 8; x++) {
generatePillar(modifier, x, yPos, zPos, Block.SMOOTH_SANDSTONE);
}
}
if (wall2) {
for (int z = zPos; z < zPos + 8; z++) {
generatePillar(modifier, xPos, yPos, z, Block.SMOOTH_SANDSTONE);
}
}
if (door1 && wall1) {
generatePillar(modifier, xPos + door1pos, yPos, zPos, Block.AIR);
generatePillar(modifier, xPos + door1pos + 1, yPos, zPos, Block.AIR);
}
if (door2 && wall2) {
generatePillar(modifier, xPos, yPos, zPos + door2pos, Block.AIR);
generatePillar(modifier, xPos, yPos, zPos + door2pos + 1, Block.AIR);
}
}
private void generatePillar(UnitModifier modifier, int xPos, int yPos, int zPos, Block material) {
for (int y = yPos; y < yPos + 3; y++) {
modifier.setBlock(xPos, y, zPos, material);
}
}
}