-
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
60b11f1
commit 3a657e1
Showing
39 changed files
with
589 additions
and
882 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
### 3.2.2 | ||
### 3.3.0 | ||
|
||
- Blacklist Enlightened End mod | ||
- Rewrite mod to better support modded / custom ores | ||
- Added /jamd reload to reload the config | ||
- Added configs jamd/overworld.json, jamd/nether.json, jamd/end.json | ||
- Configs now completely controls the world generation | ||
- Added support for ore multipliers | ||
- Added Mekanism support |
21 changes: 21 additions & 0 deletions
21
common/src/generated/resources/data/jamd/recipes/end_portal_block.json
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,21 @@ | ||
{ | ||
"type": "minecraft:crafting_shaped", | ||
"category": "misc", | ||
"key": { | ||
"O": { | ||
"item": "minecraft:end_stone" | ||
}, | ||
"P": { | ||
"item": "minecraft:diamond_pickaxe" | ||
} | ||
}, | ||
"pattern": [ | ||
"OOO", | ||
"OPO", | ||
"OOO" | ||
], | ||
"result": { | ||
"item": "jamd:end_portal" | ||
}, | ||
"show_notification": true | ||
} |
21 changes: 21 additions & 0 deletions
21
common/src/generated/resources/data/jamd/recipes/nether_portal_block.json
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,21 @@ | ||
{ | ||
"type": "minecraft:crafting_shaped", | ||
"category": "misc", | ||
"key": { | ||
"O": { | ||
"item": "minecraft:nether_bricks" | ||
}, | ||
"P": { | ||
"item": "minecraft:netherite_pickaxe" | ||
} | ||
}, | ||
"pattern": [ | ||
"OOO", | ||
"OPO", | ||
"OOO" | ||
], | ||
"result": { | ||
"item": "jamd:nether_portal" | ||
}, | ||
"show_notification": true | ||
} |
21 changes: 21 additions & 0 deletions
21
common/src/generated/resources/data/jamd/recipes/portal_block.json
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,21 @@ | ||
{ | ||
"type": "minecraft:crafting_shaped", | ||
"category": "misc", | ||
"key": { | ||
"O": { | ||
"item": "minecraft:obsidian" | ||
}, | ||
"P": { | ||
"item": "minecraft:diamond_pickaxe" | ||
} | ||
}, | ||
"pattern": [ | ||
"OOO", | ||
"OPO", | ||
"OOO" | ||
], | ||
"result": { | ||
"item": "jamd:portal_block" | ||
}, | ||
"show_notification": true | ||
} |
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
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,89 +1,35 @@ | ||
package com.unrealdinnerbone.jamd; | ||
|
||
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.mojang.logging.LogUtils; | ||
import com.unrealdinnerbone.jamd.api.FeatureTypeRegistry; | ||
import com.unrealdinnerbone.jamd.compact.MinecraftOreCompact; | ||
import com.unrealdinnerbone.jamd.util.OreRegistry; | ||
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 net.minecraft.server.MinecraftServer; | ||
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); | ||
|
||
private static final Logger LOGGER = LogUtils.getLogger(); | ||
public static final Path CONFIG_FOLDER = Services.PLATFORM.getConfigPath().resolve("jamd"); | ||
public static final String MOD_ID = "jamd"; | ||
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); | ||
} | ||
|
||
} | ||
FeatureTypeRegistry.register("minecraft", MinecraftOreCompact::new); | ||
} | ||
|
||
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); | ||
} | ||
public static void onServerStart(MinecraftServer server) { | ||
OreRegistry.REGISTERED_FEATURES.clear(); | ||
for (WorldType type : WorldType.TYPES) { | ||
try { | ||
type.exportIfNotExist(server); | ||
} catch (IOException e) { | ||
LOGGER.error("Failed to export config for world type: {}", type.getName(), e); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
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
Oops, something went wrong.