Skip to content

Commit

Permalink
Fix stuff and update game portals
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugman76 committed Aug 13, 2023
1 parent 9dc5f41 commit 3326d67
Show file tree
Hide file tree
Showing 16 changed files with 224 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/hugman/uhc/game/phase/UHCWaiting.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

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

return context.openWithWorld(map.createRuntimeWorldConfig(), (activity, world) -> {
GameWaitingLobby.addTo(activity, context.config().players());
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/com/hugman/uhc/map/UHCMap.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
package com.hugman.uhc.map;

import com.hugman.uhc.config.UHCConfig;
import net.minecraft.client.option.GameOptions;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.GameRules;
import net.minecraft.world.gen.GeneratorOptions;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import xyz.nucleoid.fantasy.RuntimeWorldConfig;

public class UHCMap {
private final UHCConfig config;
private final ChunkGenerator chunkGenerator;
private final long seed;

public UHCMap(UHCConfig config, MinecraftServer server) {
public UHCMap(UHCConfig config, ChunkGenerator chunkGenerator, long seed) {
this.config = config;
//this.chunkGenerator = config.mapConfig().dimension().chunkGenerator(); // temporary fix
this.chunkGenerator = new ModuledChunkGenerator(server, config);
this.chunkGenerator = chunkGenerator;
this.seed = seed;
}

public static UHCMap of(UHCConfig config) {
long seed = GeneratorOptions.getRandomSeed();
return new UHCMap(config, ModuledChunkGenerator.of(config, seed), seed);
}

public RuntimeWorldConfig createRuntimeWorldConfig() {
return new RuntimeWorldConfig()
.setSeed(this.seed)
.setGenerator(this.chunkGenerator)
.setGameRule(GameRules.NATURAL_REGENERATION, false)
.setGameRule(GameRules.DO_MOB_SPAWNING, true)
Expand Down
41 changes: 41 additions & 0 deletions src/main/resources/data/uhc/game_portals/normal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"type": "nucleoid_extras:styled/advanced_menu",
"name": {
"translate": "game.uhc"
},
"icon": "minecraft:apple",
"entries": [
{
"type": "plasmid:game",
"icon": "minecraft:red_candle",
"game": "uhc:solo",
"name": {
"translate": "mode.solo"
}
},
{
"type": "plasmid:game",
"icon": "minecraft:lime_candle",
"game": "uhc:duos",
"name": {
"translate": "mode.duos"
}
},
{
"type": "plasmid:game",
"icon": "minecraft:pink_candle",
"game": "uhc:trios",
"name": {
"translate": "mode.trios"
}
},
{
"type": "plasmid:game",
"icon": "minecraft:blue_candle",
"game": "uhc:squads",
"name": {
"translate": "mode.squads"
}
}
]
}
17 changes: 17 additions & 0 deletions src/main/resources/data/uhc/game_portals/root.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"type": "nucleoid_extras:styled/advanced_menu",
"name": {
"translate": "game.uhc"
},
"icon": "minecraft:golden_apple",
"entries": [
{
"type": "plasmid:portal",
"portal": "uhc:normal"
},
{
"type": "plasmid:portal",
"portal": "uhcrun:normal"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"type": "uhc:uhc",
"translation": "game.uhc.vanilla.duos",
"team_size": 2,
"players": {
"min": 4,
"threshold": 16,
"max": 100
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhc"
},
{
"translate": "mode.duos"
}
]
},
"map": {
"dimension": {
Expand All @@ -25,6 +29,12 @@
"max": 10000
}
},
"team_size": 2,
"players": {
"min": 4,
"threshold": 16,
"max": 100
},
"chapters": {
"warmup": {
"min": 2700,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"type": "uhc:uhc",
"translation": "game.uhc.vanilla.solo",
"team_size": 1,
"players": {
"min": 2,
"threshold": 8,
"max": 100
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhc"
},
{
"translate": "mode.solo"
}
]
},
"map": {
"dimension": {
Expand All @@ -25,6 +29,12 @@
"max": 10000
}
},
"team_size": 1,
"players": {
"min": 2,
"threshold": 8,
"max": 100
},
"chapters": {
"warmup": {
"min": 2700,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"type": "uhc:uhc",
"translation": "game.uhc.vanilla.squads",
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhc"
},
{
"translate": "mode.squads"
}
]
},
"team_size": 4,
"players": {
"min": 8,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"type": "uhc:uhc",
"translation": "game.uhc.vanilla.trios",
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhc"
},
{
"translate": "mode.trios"
}
]
},
"team_size": 3,
"players": {
"min": 6,
Expand Down
19 changes: 12 additions & 7 deletions src/main/resources/data/uhc/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"command.uhc.modules.no_modules_activated": "This game has no modules activated!",
"gameType.uhc.uhc": "UHC",
"game.uhc.vanilla.duos": "UHC: Vanilla (Duos)",
"game.uhc.vanilla.solo": "UHC: Vanilla (Solo)",
"game.uhc.vanilla.squads": "UHC: Vanilla (Squads)",
"game.uhc.vanilla.trios": "UHC: Vanilla (Trios)",
"game.generic.mode": "%s - %s",

"game.uhc": "UHC",

"mode.solo": "Solo",
"mode.duos": "Duos",
"mode.trios": "Trios",
"mode.squads": "Squads",

"text.uhc.and": "and",
"text.uhc.deathmatch": "Deathmatch",
"text.uhc.dropped_players": "Players have been dropped on the map.",
Expand Down Expand Up @@ -38,5 +41,7 @@
"text.uhc.vulnerable.countdown_text": "You will be vulnerable to damage in %s.",
"text.uhc.world": "World: %s",
"text.uhc.world_will_shrink": "You will get teleported in %s. The world will then start shrinking and PvP will get enabled.",
"ui.uhc.modules.title": "Active Modules"

"ui.uhc.modules.title": "Active Modules",
"command.uhc.modules.no_modules_activated": "This game has no modules activated!"
}
41 changes: 41 additions & 0 deletions src/main/resources/data/uhcrun/game_portals/normal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"type": "nucleoid_extras:styled/advanced_menu",
"name": {
"translate": "game.uhcrun"
},
"icon": "minecraft:golden_apple",
"entries": [
{
"type": "plasmid:game",
"icon": "minecraft:red_candle",
"game": "uhcrun:solo",
"name": {
"translate": "mode.solo"
}
},
{
"type": "plasmid:game",
"icon": "minecraft:lime_candle",
"game": "uhcrun:duos",
"name": {
"translate": "mode.duos"
}
},
{
"type": "plasmid:game",
"icon": "minecraft:pink_candle",
"game": "uhcrun:trios",
"name": {
"translate": "mode.trios"
}
},
{
"type": "plasmid:game",
"icon": "minecraft:blue_candle",
"game": "uhcrun:squads",
"name": {
"translate": "mode.squads"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"type": "uhc:uhc",
"translation": "game.uhcrun.vanilla.duos",
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhcrun"
},
{
"translate": "mode.duos"
}
]
},
"team_size": 2,
"players": {
"min": 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"type": "uhc:uhc",
"translation": "game.uhcrun.vanilla.solo",
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhcrun"
},
{
"translate": "mode.solo"
}
]
},
"team_size": 1,
"players": {
"min": 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"type": "uhc:uhc",
"translation": "game.uhcrun.vanilla.squads",
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhcrun"
},
{
"translate": "mode.squads"
}
]
},
"team_size": 4,
"players": {
"min": 8,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"type": "uhc:uhc",
"translation": "game.uhcrun.vanilla.trios",
"name": {
"translate": "game.generic.mode",
"with": [
{
"translate": "game.uhcrun"
},
{
"translate": "mode.trios"
}
]
},
"team_size": 3,
"players": {
"min": 6,
Expand Down
Loading

0 comments on commit 3326d67

Please sign in to comment.