Skip to content

Commit 3326d67

Browse files
committed
Fix stuff and update game portals
1 parent 9dc5f41 commit 3326d67

File tree

16 files changed

+224
-87
lines changed

16 files changed

+224
-87
lines changed

src/main/java/com/hugman/uhc/game/phase/UHCWaiting.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
public record UHCWaiting(GameSpace gameSpace, ServerWorld world, UHCConfig config, TeamManager teamManager) {
2525
public static GameOpenProcedure open(GameOpenContext<UHCConfig> context) {
26-
UHCMap map = UHCMap.of(context.config(), context.server());
26+
UHCMap map = UHCMap.of(context.config());
2727

2828
return context.openWithWorld(map.createRuntimeWorldConfig(), (activity, world) -> {
2929
GameWaitingLobby.addTo(activity, context.config().players());

src/main/java/com/hugman/uhc/map/UHCMap.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
package com.hugman.uhc.map;
22

33
import com.hugman.uhc.config.UHCConfig;
4+
import net.minecraft.client.option.GameOptions;
45
import net.minecraft.server.MinecraftServer;
56
import net.minecraft.world.GameRules;
7+
import net.minecraft.world.gen.GeneratorOptions;
68
import net.minecraft.world.gen.chunk.ChunkGenerator;
79
import xyz.nucleoid.fantasy.RuntimeWorldConfig;
810

911
public class UHCMap {
1012
private final UHCConfig config;
1113
private final ChunkGenerator chunkGenerator;
14+
private final long seed;
1215

13-
public UHCMap(UHCConfig config, MinecraftServer server) {
16+
public UHCMap(UHCConfig config, ChunkGenerator chunkGenerator, long seed) {
1417
this.config = config;
15-
//this.chunkGenerator = config.mapConfig().dimension().chunkGenerator(); // temporary fix
16-
this.chunkGenerator = new ModuledChunkGenerator(server, config);
18+
this.chunkGenerator = chunkGenerator;
19+
this.seed = seed;
20+
}
21+
22+
public static UHCMap of(UHCConfig config) {
23+
long seed = GeneratorOptions.getRandomSeed();
24+
return new UHCMap(config, ModuledChunkGenerator.of(config, seed), seed);
1725
}
1826

1927
public RuntimeWorldConfig createRuntimeWorldConfig() {
2028
return new RuntimeWorldConfig()
29+
.setSeed(this.seed)
2130
.setGenerator(this.chunkGenerator)
2231
.setGameRule(GameRules.NATURAL_REGENERATION, false)
2332
.setGameRule(GameRules.DO_MOB_SPAWNING, true)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"type": "nucleoid_extras:styled/advanced_menu",
3+
"name": {
4+
"translate": "game.uhc"
5+
},
6+
"icon": "minecraft:apple",
7+
"entries": [
8+
{
9+
"type": "plasmid:game",
10+
"icon": "minecraft:red_candle",
11+
"game": "uhc:solo",
12+
"name": {
13+
"translate": "mode.solo"
14+
}
15+
},
16+
{
17+
"type": "plasmid:game",
18+
"icon": "minecraft:lime_candle",
19+
"game": "uhc:duos",
20+
"name": {
21+
"translate": "mode.duos"
22+
}
23+
},
24+
{
25+
"type": "plasmid:game",
26+
"icon": "minecraft:pink_candle",
27+
"game": "uhc:trios",
28+
"name": {
29+
"translate": "mode.trios"
30+
}
31+
},
32+
{
33+
"type": "plasmid:game",
34+
"icon": "minecraft:blue_candle",
35+
"game": "uhc:squads",
36+
"name": {
37+
"translate": "mode.squads"
38+
}
39+
}
40+
]
41+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "nucleoid_extras:styled/advanced_menu",
3+
"name": {
4+
"translate": "game.uhc"
5+
},
6+
"icon": "minecraft:golden_apple",
7+
"entries": [
8+
{
9+
"type": "plasmid:portal",
10+
"portal": "uhc:normal"
11+
},
12+
{
13+
"type": "plasmid:portal",
14+
"portal": "uhcrun:normal"
15+
}
16+
]
17+
}

src/main/resources/data/uhc/games/vanilla/duos.json renamed to src/main/resources/data/uhc/games/duos.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"type": "uhc:uhc",
3-
"translation": "game.uhc.vanilla.duos",
4-
"team_size": 2,
5-
"players": {
6-
"min": 4,
7-
"threshold": 16,
8-
"max": 100
3+
"name": {
4+
"translate": "game.generic.mode",
5+
"with": [
6+
{
7+
"translate": "game.uhc"
8+
},
9+
{
10+
"translate": "mode.duos"
11+
}
12+
]
913
},
1014
"map": {
1115
"dimension": {
@@ -25,6 +29,12 @@
2529
"max": 10000
2630
}
2731
},
32+
"team_size": 2,
33+
"players": {
34+
"min": 4,
35+
"threshold": 16,
36+
"max": 100
37+
},
2838
"chapters": {
2939
"warmup": {
3040
"min": 2700,

src/main/resources/data/uhc/games/vanilla/solo.json renamed to src/main/resources/data/uhc/games/solo.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"type": "uhc:uhc",
3-
"translation": "game.uhc.vanilla.solo",
4-
"team_size": 1,
5-
"players": {
6-
"min": 2,
7-
"threshold": 8,
8-
"max": 100
3+
"name": {
4+
"translate": "game.generic.mode",
5+
"with": [
6+
{
7+
"translate": "game.uhc"
8+
},
9+
{
10+
"translate": "mode.solo"
11+
}
12+
]
913
},
1014
"map": {
1115
"dimension": {
@@ -25,6 +29,12 @@
2529
"max": 10000
2630
}
2731
},
32+
"team_size": 1,
33+
"players": {
34+
"min": 2,
35+
"threshold": 8,
36+
"max": 100
37+
},
2838
"chapters": {
2939
"warmup": {
3040
"min": 2700,

src/main/resources/data/uhc/games/vanilla/squads.json renamed to src/main/resources/data/uhc/games/squads.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"type": "uhc:uhc",
3-
"translation": "game.uhc.vanilla.squads",
3+
"name": {
4+
"translate": "game.generic.mode",
5+
"with": [
6+
{
7+
"translate": "game.uhc"
8+
},
9+
{
10+
"translate": "mode.squads"
11+
}
12+
]
13+
},
414
"team_size": 4,
515
"players": {
616
"min": 8,

src/main/resources/data/uhc/games/vanilla/trios.json renamed to src/main/resources/data/uhc/games/trios.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"type": "uhc:uhc",
3-
"translation": "game.uhc.vanilla.trios",
3+
"name": {
4+
"translate": "game.generic.mode",
5+
"with": [
6+
{
7+
"translate": "game.uhc"
8+
},
9+
{
10+
"translate": "mode.trios"
11+
}
12+
]
13+
},
414
"team_size": 3,
515
"players": {
616
"min": 6,

src/main/resources/data/uhc/lang/en_us.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
2-
"command.uhc.modules.no_modules_activated": "This game has no modules activated!",
3-
"gameType.uhc.uhc": "UHC",
4-
"game.uhc.vanilla.duos": "UHC: Vanilla (Duos)",
5-
"game.uhc.vanilla.solo": "UHC: Vanilla (Solo)",
6-
"game.uhc.vanilla.squads": "UHC: Vanilla (Squads)",
7-
"game.uhc.vanilla.trios": "UHC: Vanilla (Trios)",
2+
"game.generic.mode": "%s - %s",
3+
4+
"game.uhc": "UHC",
5+
6+
"mode.solo": "Solo",
7+
"mode.duos": "Duos",
8+
"mode.trios": "Trios",
9+
"mode.squads": "Squads",
10+
811
"text.uhc.and": "and",
912
"text.uhc.deathmatch": "Deathmatch",
1013
"text.uhc.dropped_players": "Players have been dropped on the map.",
@@ -38,5 +41,7 @@
3841
"text.uhc.vulnerable.countdown_text": "You will be vulnerable to damage in %s.",
3942
"text.uhc.world": "World: %s",
4043
"text.uhc.world_will_shrink": "You will get teleported in %s. The world will then start shrinking and PvP will get enabled.",
41-
"ui.uhc.modules.title": "Active Modules"
44+
45+
"ui.uhc.modules.title": "Active Modules",
46+
"command.uhc.modules.no_modules_activated": "This game has no modules activated!"
4247
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"type": "nucleoid_extras:styled/advanced_menu",
3+
"name": {
4+
"translate": "game.uhcrun"
5+
},
6+
"icon": "minecraft:golden_apple",
7+
"entries": [
8+
{
9+
"type": "plasmid:game",
10+
"icon": "minecraft:red_candle",
11+
"game": "uhcrun:solo",
12+
"name": {
13+
"translate": "mode.solo"
14+
}
15+
},
16+
{
17+
"type": "plasmid:game",
18+
"icon": "minecraft:lime_candle",
19+
"game": "uhcrun:duos",
20+
"name": {
21+
"translate": "mode.duos"
22+
}
23+
},
24+
{
25+
"type": "plasmid:game",
26+
"icon": "minecraft:pink_candle",
27+
"game": "uhcrun:trios",
28+
"name": {
29+
"translate": "mode.trios"
30+
}
31+
},
32+
{
33+
"type": "plasmid:game",
34+
"icon": "minecraft:blue_candle",
35+
"game": "uhcrun:squads",
36+
"name": {
37+
"translate": "mode.squads"
38+
}
39+
}
40+
]
41+
}

0 commit comments

Comments
 (0)