Jump to content

Creating Config for 1.6


DrOlive

Recommended Posts

Hello everyone! I've been developing a mod, but having troubles making the config. I can't find any tutorials for 1.6 and up, and my config causes crashes. Could somebody please help me with config creation or telling me what's wrong with mine? Thanks

 

Here is my main mod class:

package drolive.orenimals;

import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="Orenimals", name="Orenimals", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)

public class Orenimals {

public static CreativeTabs tabOrenimals = new CreativeTabs("tabOrenimals") {
	public ItemStack getIconItemStack() {
		return new ItemStack(Orenimals.ingotChickenium, 1, 0);
		}
};

public static EnumToolMaterial toolPorkite = EnumHelper.addToolMaterial("PORKITE", 1, 260, 5.0F, 1.5F, 10);
public static EnumToolMaterial toolChickenium = EnumHelper.addToolMaterial("CHICKENIUM", 1, 200, 6.2F, 1.5F, 10);
public static EnumToolMaterial toolSteakite = EnumHelper.addToolMaterial("STEAKITE", 1, 200, 5.0F, 2.5F, 10);
public static EnumToolMaterial toolWoolidium = EnumHelper.addToolMaterial("WOOLIDIUM", 1, 200, 5.0F, 1.5F, 16);

public static int ingotPorkiteID;
public static int ingotChickeniumID;
public static int ingotSteakiteID;
public static int ingotWoolidiumID;
public static int pickaxePorkiteID;
public static int pickaxeChickeniumID;
public static int pickaxeSteakiteID;
public static int pickaxeWoolidiumID;
public static int shovelPorkiteID;
public static int shovelChickeniumID;
public static int shovelSteakiteID;
public static int shovelWoolidiumID;
public static int hoePorkiteID;
public static int hoeChickeniumID;
public static int hoeSteakiteID;
public static int hoeWoolidiumID;
public static int axePorkiteID;
public static int axeChickeniumID;
public static int axeSteakiteID;
public static int axeWoolidiumID;
public static int swordPorkiteID;
public static int swordChickeniumID;
public static int swordSteakiteID;
public static int swordWoolidiumID;
public static int orePorkiteID;
public static int oreChickeniumID;
public static int oreSteakiteID;
public static int oreWoolidiumID;

public static final Item ingotPorkite = new OrenimalsItem(ingotPorkiteID, 64, tabOrenimals, "ingotPorkite").func_111206_d("orenimals:ingotPorkite");
public static final Item ingotChickenium = new OrenimalsItem(ingotChickeniumID, 64, tabOrenimals, "ingotChickenium").func_111206_d("orenimals:ingotChickenium");
public static final Item ingotSteakite = new OrenimalsItem(ingotSteakiteID, 64, tabOrenimals, "ingotSteakite").func_111206_d("orenimals:ingotSteakite");
public static final Item ingotWoolidium = new OrenimalsItem(ingotWoolidiumID, 64, tabOrenimals, "ingotWoolididum").func_111206_d("orenimals:ingotWoolidium");
public static final Item pickaxePorkite = new OrenimalsPickaxe(pickaxePorkiteID, toolPorkite, tabOrenimals, "pickaxePorkite").func_111206_d("Orenimals:pickaxePorkite");
public static final Item pickaxeChickenium = new OrenimalsPickaxe(pickaxeChickeniumID, toolChickenium, tabOrenimals, "pickaxeChickenium").func_111206_d("Orenimals:pickaxeChickenium");
public static final Item pickaxeSteakite = new OrenimalsPickaxe(pickaxeSteakiteID, toolSteakite, tabOrenimals, "pickaxeSteakite").func_111206_d("Orenimals:pickaxeSteakite");
public static final Item pickaxeWoolidium = new OrenimalsPickaxe(pickaxeWoolidiumID, toolWoolidium, tabOrenimals, "pickaxeWoolidium").func_111206_d("Orenimals:pickaxeWoolidium");
public static final Item shovelPorkite = new OrenimalsShovel(shovelPorkiteID, toolPorkite, tabOrenimals, "shovelPorkite").func_111206_d("Orenimals:shovelPorkite");
public static final Item shovelChickenium = new OrenimalsShovel(shovelChickeniumID, toolChickenium, tabOrenimals, "shovelChickenium").func_111206_d("Orenimals:shovelChickenium");
public static final Item shovelSteakite = new OrenimalsShovel(shovelSteakiteID, toolSteakite, tabOrenimals, "shovelSteakite").func_111206_d("Orenimals:shovelSteakite");
public static final Item shovelWoolidium = new OrenimalsShovel(shovelWoolidiumID, toolWoolidium, tabOrenimals, "shovelWoolidium").func_111206_d("Orenimals:shovelWoolidium");
public static final Item hoePorkite = new OrenimalsHoe(hoePorkiteID, toolPorkite, tabOrenimals, "hoePorkite").func_111206_d("Orenimals:hoePorkite");
public static final Item hoeChickenium = new OrenimalsHoe(hoeChickeniumID, toolChickenium, tabOrenimals, "hoeChickenium").func_111206_d("Orenimals:hoeChickenium");
public static final Item hoeSteakite = new OrenimalsHoe(hoeSteakiteID, toolSteakite, tabOrenimals, "hoeSteakite").func_111206_d("Orenimals:hoeSteakite");
public static final Item hoeWoolidium = new OrenimalsHoe(hoeWoolidiumID, toolWoolidium, tabOrenimals, "hoeWoolidium").func_111206_d("Orenimals:hoeWoolidium");
public static final Item axePorkite = new OrenimalsAxe(axePorkiteID, toolPorkite, tabOrenimals, "axePorkite").func_111206_d("Orenimals:hatchetPorkite");
public static final Item axeChickenium = new OrenimalsAxe(axeChickeniumID, toolChickenium, tabOrenimals, "axeChickenium").func_111206_d("Orenimals:hatchetChickenium");
public static final Item axeSteakite = new OrenimalsAxe(axeSteakiteID, toolSteakite, tabOrenimals, "axeSteakite").func_111206_d("Orenimals:hatchetSteakite");
public static final Item axeWoolidium = new OrenimalsAxe(axeWoolidiumID, toolWoolidium, tabOrenimals, "axeWoolidium").func_111206_d("Orenimals:hatchetWoolidium");
public static final Item swordPorkite = new OrenimalsSword(swordPorkiteID, toolPorkite, tabOrenimals, "swordPorkite").func_111206_d("Orenimals:swordPorkite");
public static final Item swordChickenium = new OrenimalsSword(swordChickeniumID, toolChickenium, tabOrenimals, "swordChickenium").func_111206_d("Orenimals:swordChickenium");
public static final Item swordSteakite = new OrenimalsSword(swordSteakiteID, toolSteakite, tabOrenimals, "swordSteakite").func_111206_d("Orenimals:swordSteakite");
public static final Item swordWoolidium = new OrenimalsSword(swordWoolidiumID, toolWoolidium, tabOrenimals, "swordWoolidium").func_111206_d("Orenimals:swordWoolidium");

public static final Block orePorkite = new OrenimalsBlock(orePorkiteID, Material.rock, 3.0F, Block.soundStoneFootstep, "orePorkite", tabOrenimals).func_111022_d("orenimals:orePorkite");
public static final Block oreChickenium = new OrenimalsBlock(oreChickeniumID, Material.rock, 3.0F, Block.soundStoneFootstep, "oreChickenium", tabOrenimals).func_111022_d("orenimals:oreChickenium");
public static final Block oreSteakite = new OrenimalsBlock(oreSteakiteID, Material.rock, 3.0F, Block.soundStoneFootstep, "oreSteakite", tabOrenimals).func_111022_d("orenimals:oreSteakite");
public static final Block oreWoolidium = new OrenimalsBlock(oreWoolidiumID, Material.rock, 3.0F, Block.soundStoneFootstep, "oreWoolidium", tabOrenimals).func_111022_d("orenimals:oreWoolidium");

@Instance("Orenimals")
public static Orenimals instance;

@SidedProxy(clientSide="drolive.orenimals.client.ClientProxy", serverSide="drolive.orenimals.CommonProxy")
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event){

		Configuration config = new Configuration(event.getSuggestedConfigurationFile());
		config.load();

		ingotPorkiteID = config.getItem("Porkite Ingot", 26201).getInt();
		ingotChickeniumID = config.getItem("Chickenium Ingot", 26202).getInt();
		ingotSteakiteID = config.getItem("Steakite Ingot", 26203).getInt();
		ingotWoolidiumID = config.getItem("Woolidium Ingot", 26204).getInt();
		pickaxePorkiteID = config.getItem("Porkite Pickaxe", 26205).getInt();
		pickaxeChickeniumID = config.getItem("Chickenium Pickaxe", 26206).getInt();
		pickaxeSteakiteID = config.getItem("Steakite Pickaxe", 26207).getInt();
		pickaxeWoolidiumID = config.getItem("Woolidium Pickaxe", 26208).getInt();
		shovelPorkiteID = config.getItem("Porkite Shovel", 26209).getInt();
		shovelChickeniumID = config.getItem("Chickenium Shovel", 26210).getInt();
		shovelSteakiteID = config.getItem("Steakite Shovel", 26211).getInt();
		shovelWoolidiumID = config.getItem("Woolidium Shovel", 26212).getInt();
		hoePorkiteID = config.getItem("Porkite Hoe", 26213).getInt();
		hoeChickeniumID = config.getItem("Chickenium Hoe", 26214).getInt();
		hoeSteakiteID = config.getItem("Steakite Hoe", 26215).getInt();
		hoeWoolidiumID = config.getItem("Woolidium Hoe", 26216).getInt();
		axePorkiteID = config.getItem("Porkite Axe", 26217).getInt();
		axeChickeniumID = config.getItem("Chickenium Axe", 26218).getInt();
		axeSteakiteID = config.getItem("Steakite Axe", 26219).getInt();
		axeWoolidiumID = config.getItem("Woolidium Axe", 26220).getInt();
		swordPorkiteID = config.getItem("Porkite Sword", 26221).getInt();
		swordChickeniumID = config.getItem("Chickenium Sword", 26222).getInt();
		swordSteakiteID = config.getItem("Steakite Sword", 26223).getInt();
		swordWoolidiumID = config.getItem("Woolidium Sword", 26224).getInt();
		orePorkiteID = config.getBlock("Porkite Ore", 3001).getInt();
		oreChickeniumID = config.getBlock("Chickenium Ore", 3002).getInt();
		oreSteakiteID = config.getBlock("Steakite Ore", 3003).getInt();
		oreWoolidiumID = config.getBlock("Woolidium Ore", 3004).getInt();

		config.save();
}

@EventHandler
public void load(FMLInitializationEvent event){
		proxy.registerRenderers();

		GameRegistry.registerWorldGenerator(new OrenimalsWorldGen());

		LanguageRegistry.instance().addStringLocalization("itemGroup.tabOrenimals", "en_US", "Orenimals");

		ItemStack st = new ItemStack(Item.stick);
		ItemStack po = new ItemStack(Orenimals.ingotPorkite);
		ItemStack ch = new ItemStack(Orenimals.ingotChickenium);
		ItemStack ste = new ItemStack(Orenimals.ingotSteakite);
		ItemStack wo = new ItemStack(Orenimals.ingotWoolidium);

		LanguageRegistry.addName(ingotPorkite, "Porkite Ingot");
		GameRegistry.addSmelting(Orenimals.ingotPorkite.itemID, new ItemStack(Item.porkCooked), 0f);

		LanguageRegistry.addName(ingotChickenium, "Chickenium Ingot");
		GameRegistry.addSmelting(Orenimals.ingotChickenium.itemID, new ItemStack(Item.chickenCooked), 0f);

		LanguageRegistry.addName(ingotSteakite, "Steakite Ingot");
		GameRegistry.addSmelting(Orenimals.ingotSteakite.itemID, new ItemStack(Item.beefCooked), 0f);

		LanguageRegistry.addName(ingotWoolidium, "Woolidium Ingot");
		GameRegistry.addSmelting(Orenimals.ingotWoolidium.itemID, new ItemStack(Block.cloth), 0f);

		LanguageRegistry.addName(pickaxePorkite, "Porkite Pickaxe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.pickaxePorkite), "xxx", " y ", " y ", 'x', po, 'y', st);

		LanguageRegistry.addName(pickaxeChickenium, "Chickenium Pickaxe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.pickaxeChickenium), "xxx", " y ", " y ", 'x', ch, 'y', st);

		LanguageRegistry.addName(pickaxeSteakite, "Steakite Pickaxe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.pickaxeSteakite), "xxx", " y ", " y ", 'x', ste, 'y', st);

		LanguageRegistry.addName(pickaxeWoolidium, "Woolidium Pickaxe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.pickaxeWoolidium), "xxx", " y ", " y ", 'x', wo, 'y', st);

		LanguageRegistry.addName(shovelPorkite, "Porkite Shovel");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.shovelPorkite), "x", "y", "y", 'x', po, 'y', st);

		LanguageRegistry.addName(shovelChickenium, "Chickenium Shovel");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.shovelChickenium), "x", "y", "y", 'x', ch, 'y', st);

		LanguageRegistry.addName(shovelSteakite, "Steakite Shovel");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.shovelSteakite), "x", "y", "y", 'x', ste, 'y', st);

		LanguageRegistry.addName(shovelWoolidium, "Woolidium Shovel");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.shovelWoolidium), "x", "y", "y", 'x', wo, 'y', st);

		LanguageRegistry.addName(hoePorkite, "Porkite Hoe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.hoePorkite), "xx", " y", " y", 'x', po, 'y', st);

		LanguageRegistry.addName(hoeChickenium, "Chickenium Hoe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.hoeChickenium), "xx", " y", " y", 'x', ch, 'y', st);

		LanguageRegistry.addName(hoeSteakite, "Steakite Hoe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.hoeSteakite), "xx", " y", " y", 'x', ste, 'y', st);

		LanguageRegistry.addName(hoeWoolidium, "Woolidium Hoe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.hoeWoolidium), "xx", " y", " y", 'x', wo, 'y', st);

		LanguageRegistry.addName(axePorkite, "Porkite Axe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.axePorkite), "xx", "xy", " y", 'x', po, 'y', st);

		LanguageRegistry.addName(axeChickenium, "Chickenium Axe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.axeChickenium), "xx", "xy", " y", 'x', ch, 'y', st);

		LanguageRegistry.addName(axeSteakite, "Steakite Axe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.axeSteakite), "xx", "xy", " y", 'x', ste, 'y', st);

		LanguageRegistry.addName(axeWoolidium, "Woolidium Axe");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.axeWoolidium), "xx", "xy", " y", 'x', wo, 'y', st);

		LanguageRegistry.addName(swordPorkite, "Porkite Sword");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.swordPorkite), "x", "x", "y", 'x', po, 'y', st);

		LanguageRegistry.addName(swordChickenium, "Chickenium Sword");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.swordChickenium), "x", "x", "y", 'x', ch, 'y', st);

		LanguageRegistry.addName(swordSteakite, "Steakite Sword");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.swordSteakite), "x", "x", "y", 'x', ste, 'y', st);

		LanguageRegistry.addName(swordWoolidium, "Woolidium Sword");
		GameRegistry.addShapedRecipe(new ItemStack(Orenimals.swordWoolidium), "x", "x", "y", 'x', wo, 'y', st);

		LanguageRegistry.addName(orePorkite, "Porkite Ore");
		GameRegistry.registerBlock(orePorkite, "orePorkite");
		MinecraftForge.setBlockHarvestLevel(orePorkite, "pickaxe", 1);
		GameRegistry.addSmelting(Orenimals.orePorkite.blockID, new ItemStack(Orenimals.ingotPorkite), 0.5f);

		LanguageRegistry.addName(oreChickenium, "Chickenium Ore");
		GameRegistry.registerBlock(oreChickenium, "oreChickenium");
		MinecraftForge.setBlockHarvestLevel(oreChickenium, "pickaxe", 1);
		GameRegistry.addSmelting(Orenimals.oreChickenium.blockID, new ItemStack(Orenimals.ingotChickenium), 0.5f);

		LanguageRegistry.addName(oreSteakite, "Steakite Ore");
		GameRegistry.registerBlock(oreSteakite, "oreSteakite");
		MinecraftForge.setBlockHarvestLevel(oreSteakite, "pickaxe", 1);
		GameRegistry.addSmelting(Orenimals.oreSteakite.blockID, new ItemStack(Orenimals.ingotSteakite), 0.5f);

		LanguageRegistry.addName(oreWoolidium, "Woolidium Ore");
		GameRegistry.registerBlock(oreWoolidium, "oreWoolidium");
		MinecraftForge.setBlockHarvestLevel(oreWoolidium, "pickaxe", 1);
		GameRegistry.addSmelting(Orenimals.oreWoolidium.blockID, new ItemStack(Orenimals.ingotWoolidium), 0.5f);

}

@EventHandler
public void postInit(FMLPostInitializationEvent event){
}

}

Link to comment
Share on other sites

Your config file set looks fine to me.

Don't expect it to change anything though.

All of your blocks and items are final, and all your ids are initialized at 0 (default), which is probably a huge source of errors.

You should set your blocks and items after getting ids from the config.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The future of Bitcoin recovery is a topic of great interest and excitement, particularly with the emergence of innovative companies like Dexdert Net Pro Recovery leading the charge. As the cryptocurrency market continues to evolve and face new challenges, the need for effective solutions to help users recover lost or stolen Bitcoin has become increasingly critical. Dexdert Net Pro, a specialized firm dedicated to this very purpose, has positioned itself at the forefront of this emerging field. Through their proprietary techniques and deep expertise in blockchain technology, Dexdert Net Pro has developed a comprehensive approach to tracking down and retrieving misplaced or compromised Bitcoin, providing a lifeline to individuals and businesses who have fallen victim to the inherent risks of the digital currency landscape. Their team of seasoned investigators and cryptography experts employ a meticulous, multi-pronged strategy, leveraging advanced data analysis, forensic techniques, and collaborative partnerships with law enforcement to painstakingly trace the movement of lost or stolen coins, often recovering funds that would otherwise be considered irrecoverable. This pioneering work not only restores financial assets but also helps to bolster confidence and trust in the long-term viability of Bitcoin, cementing Dexdert Net Pro role as a crucial player in shaping the future of cryptocurrency recovery and security. As the digital finance ecosystem continues to evolve, the importance of innovative solutions like those offered by Dexdert Net Pro will only grow, ensuring that users can navigate the complexities of Bitcoin with greater peace of mind and protection. Call Dexdert Net Pro now     
    • I'm developing a dimension, but it's kinda resource intensive so some times during player teleporting it lags behind making the player phase down into the void, so im trying to implement some kind of pregeneration to force the game loading a small set of chunks in the are the player will teleport to. Some of the things i've tried like using ServerLevel and ServerChunkCache methods like getChunk() dont actually trigger chunk generation if the chunk isn't already on persistent storage (already generated) or placing tickets, but that doesn't work either. Ideally i should be able to check when the task has ended too. I've peeked around some pregen engines, but they're too complex for my current understanding of the system of which I have just a basic understanding (how ServerLevel ,ServerChunkCache  and ChunkMap work) of. Any tips or other classes I should be looking into to understand how to do this correctly?
    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.