Mise à jour README.md version 2.1.5

- Documentation de la dépendance obligatoire KubeJS
- Création automatique du script de suppression des minerais vanilla
- Nouvel onglet créatif personnalisé
- Changelog complet de la version 2.1.5
- Architecture mise à jour avec KubeJSIntegration et ShardDiamondArmorMaterial

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
feldenr
2026-01-07 14:18:04 +01:00
parent 11d596b788
commit 93cfa0dfe3
2 changed files with 125 additions and 68 deletions
@@ -1,11 +1,9 @@
package net.mcreator.customoregen;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.event.level.LevelEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.LogicalSide;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.storage.LevelResource;
import java.io.File;
import java.io.IOException;
@@ -13,47 +11,70 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
@Mod.EventBusSubscriber(modid = CustomOreGenMod.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE)
@Mod.EventBusSubscriber(modid = CustomOreGenMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class KubeJSIntegration {
private static final String SCRIPT_FILE_NAME = "custom_ore_gen_remove_vanilla_ores.js";
private static boolean hasCreatedScript = false;
@SubscribeEvent
public static void onServerLoad(LevelEvent.Load event) {
// Only run on server side and only once
if (event.getLevel().isClientSide() || hasCreatedScript) {
return;
}
if (!(event.getLevel() instanceof ServerLevel serverLevel)) {
public static void onCommonSetup(FMLCommonSetupEvent event) {
// Only run once
if (hasCreatedScript) {
return;
}
hasCreatedScript = true;
// Get the server's kubejs directory
File kubeJsDir = new File(serverLevel.getServer().getServerDirectory(), "kubejs/startup_scripts");
CustomOreGenMod.LOGGER.info("============================================");
CustomOreGenMod.LOGGER.info("Custom Ore Gen: FMLCommonSetupEvent FIRED!");
CustomOreGenMod.LOGGER.info("============================================");
// Get the game directory (where .minecraft is)
File gameDir = new File(".");
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Game directory: " + gameDir.getAbsolutePath());
File kubeJsDir = new File(gameDir, "kubejs/startup_scripts");
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Target KubeJS directory: " + kubeJsDir.getAbsolutePath());
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Directory exists? " + kubeJsDir.exists());
// Create directory if it doesn't exist
if (!kubeJsDir.exists()) {
CustomOreGenMod.LOGGER.info("KubeJS directory not found. Skipping script creation.");
return;
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Directory does not exist, creating...");
boolean created = kubeJsDir.mkdirs();
CustomOreGenMod.LOGGER.info("Custom Ore Gen: mkdirs() returned: " + created);
if (!created) {
CustomOreGenMod.LOGGER.error("Custom Ore Gen: FAILED to create KubeJS directory!");
return;
}
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Successfully created directory");
}
File scriptFile = new File(kubeJsDir, SCRIPT_FILE_NAME);
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Script file path: " + scriptFile.getAbsolutePath());
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Script file exists? " + scriptFile.exists());
// Only create if it doesn't exist
if (scriptFile.exists()) {
CustomOreGenMod.LOGGER.info("KubeJS script already exists: " + scriptFile.getPath());
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Script already exists, skipping creation");
return;
}
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Script does not exist, creating now...");
try {
createKubeJSScript(scriptFile.toPath());
CustomOreGenMod.LOGGER.info("Successfully created KubeJS script: " + scriptFile.getPath());
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Script creation completed successfully!");
CustomOreGenMod.LOGGER.info("Custom Ore Gen: File exists after creation? " + scriptFile.exists());
CustomOreGenMod.LOGGER.info("Custom Ore Gen: File size: " + scriptFile.length() + " bytes");
} catch (IOException e) {
CustomOreGenMod.LOGGER.error("Failed to create KubeJS script", e);
CustomOreGenMod.LOGGER.error("Custom Ore Gen: FAILED to create KubeJS script!", e);
e.printStackTrace();
}
CustomOreGenMod.LOGGER.info("============================================");
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Script creation process finished");
CustomOreGenMod.LOGGER.info("============================================");
}
private static void createKubeJSScript(Path scriptPath) throws IOException {
@@ -87,5 +108,6 @@ WorldgenEvents.remove(event => {
""";
Files.writeString(scriptPath, scriptContent, StandardOpenOption.CREATE_NEW);
CustomOreGenMod.LOGGER.info("Custom Ore Gen: Files.writeString() completed");
}
}