-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e6603d
commit 60b11f1
Showing
38 changed files
with
999 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
common/src/generated/resources/.cache/12b48ce80665160388e37efcbe6ffc9c320247a7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// 1.20.1 2023-08-20T09:33:14.6325483 Just Another Mining Dimension/Language (en_us) | ||
4d0b94d0ebdcaaafe16d0133c0028cf20bec5a5f assets\jamd\lang\en_us.json |
10 changes: 10 additions & 0 deletions
10
common/src/generated/resources/.cache/1d8aa9c5d04d534625d05e0315fa2dfc314eb45b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// 1.20.1 2023-08-20T09:33:14.6340461 Just Another Mining Dimension/Model Definitions | ||
bf3a9f8231659d8cbc7ea68a7cdde8e3b029071f assets\jamd\blockstates\end_portal.json | ||
7e626048016ba0c9d3b92a12b89eb0ec4d6fe677 assets\jamd\models\block\nether_portal.json | ||
2d9db6c9191663e8106bc53141670ea054209f9a assets\jamd\models\block\portal_block.json | ||
6b50f23823f194ff35bcec0e1694e77efd20e385 assets\jamd\blockstates\nether_portal.json | ||
c43b79f0a1988c4d812f8e77f1c7506d596430a0 assets\jamd\models\item\end_portal.json | ||
098aa69a37ff6ca1b266436f24e891314007f976 assets\jamd\blockstates\portal_block.json | ||
76633e08f2190391221ca5bc14b6536cda1b87a9 assets\jamd\models\item\nether_portal.json | ||
6048ff3f9c71f641213c1d7aa6d605d9b23fed72 assets\jamd\models\block\end_portal.json | ||
155f13040d10cd90e514a56c4d7338c0db232883 assets\jamd\models\item\portal_block.json |
7 changes: 7 additions & 0 deletions
7
common/src/generated/resources/.cache/2a895680709e271705f445e2c6f6dbca16550c92
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// 1.20.1 2023-08-20T09:33:14.633546 Just Another Mining Dimension/JAMD World Data | ||
e022cecafe8e7e93c9e3e503c46197cf1fb33450 data\jamd\dimension_type\mining.json | ||
9493a2c0221f086efbb4263f171937a72c6d6992 data\jamd\worldgen\biome\end.json | ||
ac9e79911103955c5e8d0b82bd377f175796afac data\jamd\worldgen\biome\mining.json | ||
5015669d20cfba456749215c51c22bc7ace1d4b3 data\jamd\dimension_type\nether.json | ||
cbc1941a40b6da486531a2010be4e6db0866e4f4 data\jamd\dimension_type\end.json | ||
9eb37f0889d455d2929fd947bb4667057ba1b0fe data\jamd\worldgen\biome\nether.json |
3 changes: 3 additions & 0 deletions
3
common/src/generated/resources/.cache/3803046a7d7b7ce0a060be8ae0299aa98c17094c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// 1.20.1 2023-08-20T09:33:14.6345452 Just Another Mining Dimension/Tags for minecraft:block | ||
d21a5dcdd4b5cd0b493217e7e9e4aa477a755db8 data\minecraft\tags\blocks\mineable\pickaxe.json | ||
d21a5dcdd4b5cd0b493217e7e9e4aa477a755db8 data\minecraft\tags\blocks\needs_diamond_tool.json |
7 changes: 7 additions & 0 deletions
7
common/src/generated/resources/.cache/4b9da48b48cbb77fa11342e113f8c9a9cb9c99c1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// 1.20.1 2023-08-20T09:33:14.6350463 Just Another Mining Dimension/Recipes | ||
6a1227f9e0b372e3546b782215347c8c76dd6f4f data\jamd\advancements\recipes\transportation\nether_portal_block.json | ||
be575abba95e7f591761941b8ce7b15805dd16f5 data\jamd\advancements\recipes\transportation\end_portal_block.json | ||
64a379634715c9f4ea69b6fc5a330a0008cbb33f data\jamd\recipes\portal_block.json | ||
351ba1cdc449781ef49cc5cdb4bfdd5bc5722a13 data\jamd\recipes\nether_portal_block.json | ||
a202bbb60a616a623a317c3b0902f18436701002 data\jamd\recipes\end_portal_block.json | ||
8be629b04926b089b8c6acc497e9fed86ca0ae1b data\jamd\advancements\recipes\transportation\portal_block.json |
4 changes: 4 additions & 0 deletions
4
common/src/generated/resources/.cache/e360e4cfe8a52d2933ccfa99feb357854d82856f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// 1.20.1 2023-08-20T09:33:14.633546 Just Another Mining Dimension/Block Loot Tables | ||
d02ea46f3e4060ea18cb73c3b3fe1f1738d4e47c data\jamd\loot_tables\blocks\portal_block.json | ||
8f213054226c115851779a7dd3fb5e0cfb8323f9 data\jamd\loot_tables\blocks\end_portal.json | ||
d4122e44c4d0d50740cfa507d4d05078c7163a7d data\jamd\loot_tables\blocks\nether_portal.json |
21 changes: 0 additions & 21 deletions
21
common/src/generated/resources/data/jamd/recipes/end_portal_block.json
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
common/src/generated/resources/data/jamd/recipes/nether_portal_block.json
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
common/src/generated/resources/data/jamd/recipes/portal_block.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
common/src/main/java/com/unrealdinnerbone/jamd/ConfigCodec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.unrealdinnerbone.jamd; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
|
||
import java.util.List; | ||
|
||
public record ConfigCodec(List<OresCodec> ores) { | ||
public static final Codec<ConfigCodec> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
Codec.list(OresCodec.CODEC).fieldOf("ores").forGetter(ConfigCodec::ores) | ||
).apply(instance, ConfigCodec::new)); | ||
} |
41 changes: 0 additions & 41 deletions
41
common/src/main/java/com/unrealdinnerbone/jamd/DefaultConfig.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,89 @@ | ||
package com.unrealdinnerbone.jamd; | ||
|
||
import com.unrealdinnerbone.config.ConfigManager; | ||
import com.unrealdinnerbone.trenzalore.api.config.ConfigManger; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonParser; | ||
import com.mojang.serialization.DataResult; | ||
import com.mojang.serialization.JsonOps; | ||
import com.unrealdinnerbone.jamd.util.Transformers; | ||
import com.unrealdinnerbone.trenzalore.api.platform.Services; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.biome.Biome; | ||
import net.minecraft.world.level.levelgen.placement.PlacedFeature; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.*; | ||
|
||
public class JAMD { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(JAMD.class); | ||
|
||
public static final Path CONFIG_FOLDER = Services.PLATFORM.getConfigPath().resolve("jamd"); | ||
public static final String MOD_ID = "jamd"; | ||
private static final ConfigManager CONFIG_MANAGER = ConfigManger.createConfigManager(MOD_ID); | ||
public static final JamdConfig CONFIG = CONFIG_MANAGER.loadConfig("general", JamdConfig::new); | ||
public static final Map<ResourceKey<Biome>, Map<String, PlacedFeature>> REGISTERED_FEATURES = new HashMap<>(); | ||
|
||
|
||
private static final List<String> DIM_TYPES = Arrays.asList("mining", "nether", "end"); | ||
|
||
public static void init() { | ||
try { | ||
createFiles(); | ||
}catch (IOException e) { | ||
LOGGER.error("Failed to create config files", e); | ||
return; | ||
} | ||
for (String dimType : DIM_TYPES) { | ||
try { | ||
String jsonString = Files.readString(CONFIG_FOLDER.resolve(dimType + ".json")); | ||
JsonElement parse = new JsonParser().parse(jsonString); | ||
DataResult<ConfigCodec> data = ConfigCodec.CODEC.parse(JsonOps.INSTANCE, parse); | ||
if(data.error().isPresent()) { | ||
LOGGER.error("Failed to parse config: {}", data.error().get().message()); | ||
return; | ||
} | ||
Optional<ConfigCodec> result = data.result(); | ||
if(result.isPresent()) { | ||
Map<String, PlacedFeature> placedFeatureMap = new HashMap<>(); | ||
ConfigCodec configCodec = result.get(); | ||
for (OresCodec ore : configCodec.ores()) { | ||
if(placedFeatureMap.containsKey(ore.id())) { | ||
LOGGER.error("Duplicate ore: {} found in config {}", ore.id(), dimType); | ||
continue; | ||
} | ||
placedFeatureMap.put(ore.id(), Transformers.fromConfigCodec(ore)); | ||
LOGGER.debug("Registered ore: {} for dim type: {}", ore.id(), dimType); | ||
} | ||
REGISTERED_FEATURES.put(ResourceKey.create(Registries.BIOME, new ResourceLocation(MOD_ID, dimType)), placedFeatureMap); | ||
} | ||
}catch (IOException e) { | ||
LOGGER.error("Failed to load config for dim type: {}", dimType, e); | ||
} | ||
|
||
} | ||
} | ||
|
||
private static void createFiles() throws IOException { | ||
if(!Files.exists(CONFIG_FOLDER)) { | ||
Files.createDirectories(CONFIG_FOLDER); | ||
} | ||
for (String dimType : DIM_TYPES) { | ||
Path path = CONFIG_FOLDER.resolve(dimType + ".json"); | ||
if(!Files.exists(path)) { | ||
InputStream defaultConfig = JAMD.class.getResourceAsStream("/defaults/" + dimType + ".json"); | ||
if(defaultConfig != null) { | ||
Files.copy(defaultConfig, path); | ||
}else { | ||
throw new IOException("Failed to find default config for: " + dimType); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
common/src/main/java/com/unrealdinnerbone/jamd/JamdConfig.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.