Jump to content

Procedural Structure Generation


Reika

Recommended Posts

I have several questions related to procedural structure generation (piece-wise multi-chunk structures like Strongholds, Nether Fortresses, and many Twilight Forest structures, not single-pass isolated structures like dungeons, jungle temples, and anything generated in an IWorldGenerator).

 

How do I go about adding my own kind? I assume I extend MapGenStructure, but how do I register it? ChunkProvider classes seem to hardcode what generators they use, with no obvious Forge hooks aside from a PopulateChunkEvent.Pre, but that seems not to be the intended process, and some of the parameters, like the coordinates, seem off.

 

Also, how does the structure generator work? I see that structures have pieces and a StructureStart, but what are the requirements on those pieces, such as dimensions (for example, must each piece be a 16x16 (or other size) square?), and how do I get pieces to plug into each other properly?

Link to comment
Share on other sites

I remember looking at it once and going "how the fuck does this even work?"  I was never able to back-trace the parts that I understood (each segment) back to another piece I understood (the world generator).

 

I wish you luck.

  • Haha 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

When you say your structure generation, does this include the cave generation and stuff generated inside the chunk provider at world generation? I've been looking in to it a bit and have a little bit of an understanding how some of it works.

 

From what I've been doing, I would assume to add your own structure generation that you would have to make your own Chunk Provider and add them in there, I spent a few days perusing the internet and the best I could find was IWorldGenerators which will not work for things like nether fortresses.

 

The structure start for a Mineshaft, if I remember correctly, are the big dirt based rooms that you encounter, and they generate say 7 paths off of themselves. These paths keep generating until they collide with another path or itself. During my perusal of the internet I happened across a technique called "perlin worms", and these seem very close to what is going on inside here. The conceptual block I've been having with this is if I pick a start point for my perlin worm, how would I know if it ended up inside another chunk, and how would I manage to hollow out the chunk next door without generating the chunk it started in?

 

The villager center is the well structure, I think, I'm not sure if that ends up being a 16x16, but I would not be surprised if the start component was a full chunk, I believe that would make it easy to generate the structures than a smaller one, but once you figure out how to generate the structure, I doubt it matters as long as your method is designed to work in that manner.

 

One thing to note, when it calls the method to begin generating your structure, like caves, the MapGenBase FORCES the random to be initialized with the worlds seed. With this you MUST generate a new seed for the random you pass to the actual method to generate the structure. The joy of this is as long as your method generates a consistent seed (which should be super easy seeing as the MapGenBase does it for you) you would be able to generate extremely consistent structures. Once again, how does one figure out when it pierces your chunk? Do you set a limit of say 6 chunk range (or 8 maybe if that's what that means?) and chunk all chunks and generate EVERY structure that exists to fully build it's components that may hit your chunk?

 

Let me know if that was English. Sounded good while I typed it.

Link to comment
Share on other sites

Depending on why and how you want it to generate, if you're making totally new stuff I'd probably suggest not hooking into the existing generation but rather just make your own grounds-up generation code.  I've found that with structure generation, the procedural part is very dependent on what kind of structure you're talking about.  A regular structure can be done with loops and interchangeable parts while an irregular structure might need to basically just read from a set of schematics. 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Depending on why and how you want it to generate, if you're making totally new stuff I'd probably suggest not hooking into the existing generation but rather just make your own grounds-up generation code.  I've found that with structure generation, the procedural part is very dependent on what kind of structure you're talking about.  A regular structure can be done with loops and interchangeable parts while an irregular structure might need to basically just read from a set of schematics.

When you say your structure generation, does this include the cave generation and stuff generated inside the chunk provider at world generation? I've been looking in to it a bit and have a little bit of an understanding how some of it works.

 

From what I've been doing, I would assume to add your own structure generation that you would have to make your own Chunk Provider and add them in there, I spent a few days perusing the internet and the best I could find was IWorldGenerators which will not work for things like nether fortresses.

 

The structure start for a Mineshaft, if I remember correctly, are the big dirt based rooms that you encounter, and they generate say 7 paths off of themselves. These paths keep generating until they collide with another path or itself. During my perusal of the internet I happened across a technique called "perlin worms", and these seem very close to what is going on inside here. The conceptual block I've been having with this is if I pick a start point for my perlin worm, how would I know if it ended up inside another chunk, and how would I manage to hollow out the chunk next door without generating the chunk it started in?

 

The villager center is the well structure, I think, I'm not sure if that ends up being a 16x16, but I would not be surprised if the start component was a full chunk, I believe that would make it easy to generate the structures than a smaller one, but once you figure out how to generate the structure, I doubt it matters as long as your method is designed to work in that manner.

 

One thing to note, when it calls the method to begin generating your structure, like caves, the MapGenBase FORCES the random to be initialized with the worlds seed. With this you MUST generate a new seed for the random you pass to the actual method to generate the structure. The joy of this is as long as your method generates a consistent seed (which should be super easy seeing as the MapGenBase does it for you) you would be able to generate extremely consistent structures. Once again, how does one figure out when it pierces your chunk? Do you set a limit of say 6 chunk range (or 8 maybe if that's what that means?) and chunk all chunks and generate EVERY structure that exists to fully build it's components that may hit your chunk?

 

Let me know if that was English. Sounded good while I typed it.

 

As it happens, yes, these will be going in a custom dimension which allows me control over the ChunkProviders, but this does not help me actually figure out how the system works; there seems to be an internal automatic algorithm Minecraft uses to generate structures like these.

Link to comment
Share on other sites

I would forget any premade stuff and create my structure using IWorldGenerator.

Here is an example of what my code would look like. However, its 01 am here in Austria right now, don't expect that this actually works.

 

 

 



IWorldGenerator:

int chancesNeighbourRooms = 400; //400 % chance that there are rooms next to this one
GenerationPortalShrine.generate(random, x + random.nextInt(16), z + random.nextInt(16), chancesNeighbourRooms, null, 0){



Generation Class:

generate(Random rand, int x, int z, int chancesNeighbourRooms, int[][] usedLocations, int side):


/*
*
*side 0 not set
*1 north
*2 east
*3 south
*4 west
*/


if(Random.nextInt(100) > chancesNeighbourRooms){

CLOSE DOOR

} else {
     boolean canGenerate = true;

     
     Room room = Rooms.getRooms().get(RANDOMNUMBER);

     CHECK IF ROOM HAS DOORS AT THE REQUIRED SIDE, IF NOT LOOK FOR NEW ROOM
     
     for(LOOP THROUGH usedLocations AND CHECK IF THE POSITION AND SIZE OF THE NEW ROOMS ARE OVERLAPPING WITH AN OLD ONE){

          canGenerate=false

     }


    if(canGenerate){

     GENARTION STARTS AT THE SET DOOR, POSITION HAS TO BE RESET DEPENDING ON SIDE AND SIZE OF THE NEW ROOM (+ door offset?)
     x=
     y=

     room.generate(x,y)

     ADD ALL NOW ALREADY SET BLOCKS TO USED LOCATIONS
     
     if(room.getSides.getSize()>1){

     for(int i = 0; i< room.getSides.getSize(); i++){

      if(room.getSides.get(i) != side){

        GET SIDE OF NEW ROOM AND NEW X AND Z LOCATIONS
        GenerationPortalShrine.generate(random, x, z, chancesNeighbourRooms-20, usedLocations, newSide);
      }

     }
    }

}

 

 

 

Here could be your advertisement!

Link to comment
Share on other sites

I would forget any premade stuff and create my structure using IWorldGenerator.

Here is an example of what my code would look like. However, its 01 am here in Austria right now, don't expect that this actually works.

 

 

 



IWorldGenerator:

int chancesNeighbourRooms = 400; //400 % chance that there are rooms next to this one
GenerationPortalShrine.generate(random, x + random.nextInt(16), z + random.nextInt(16), chancesNeighbourRooms, null, 0){



Generation Class:

generate(Random rand, int x, int z, int chancesNeighbourRooms, int[][] usedLocations, int side):


/*
*
*side 0 not set
*1 north
*2 east
*3 south
*4 west
*/


if(Random.nextInt(100) > chancesNeighbourRooms){

CLOSE DOOR

} else {
     boolean canGenerate = true;

     
     Room room = Rooms.getRooms().get(RANDOMNUMBER);

     CHECK IF ROOM HAS DOORS AT THE REQUIRED SIDE, IF NOT LOOK FOR NEW ROOM
     
     for(LOOP THROUGH usedLocations AND CHECK IF THE POSITION AND SIZE OF THE NEW ROOMS ARE OVERLAPPING WITH AN OLD ONE){

          canGenerate=false

     }


    if(canGenerate){

     GENARTION STARTS AT THE SET DOOR, POSITION HAS TO BE RESET DEPENDING ON SIDE AND SIZE OF THE NEW ROOM (+ door offset?)
     x=
     y=

     room.generate(x,y)

     ADD ALL NOW ALREADY SET BLOCKS TO USED LOCATIONS
     
     if(room.getSides.getSize()>1){

     for(int i = 0; i< room.getSides.getSize(); i++){

      if(room.getSides.get(i) != side){

        GET SIDE OF NEW ROOM AND NEW X AND Z LOCATIONS
        GenerationPortalShrine.generate(random, x, z, chancesNeighbourRooms-20, usedLocations, newSide);
      }

     }
    }

}

 

 

Just generating things is really easy... see this: https://github.com/VapourDrive/ExpandedWorld

Trying to register things as structures seems to be such a massive pain in the ass that I abandoned all hope and moved on to a different project. I had a dungeon based off of spherical rooms that had a chance to recursively generate another room in a row with connecting hallways and it looked quite nice. The issue ran into the size of the structure, without actually registering it as a structure the game doesn't care about where it generates and things can get really messy.

I'll keep watching this thread for any updates....

Link to comment
Share on other sites

Yeah, thats why i use an int to decrease the chance for new rooms.

But i doubt that the user will really notice how your structure was generated if its underground and dark enough.

Btw, did you generate the rooms and the hallways at the same time or did you first generate the rooms and once they were all generated the hallways?

Here could be your advertisement!

Link to comment
Share on other sites

The problem lies in that if you don't register a structure properly, for all you know the game will end up throwing your generated "thing" in randomly and it can interfere with other legit structures, such as overlap a stronghold for example.

As for the rooms and hallways, a room generates initially, then there is a chance for another room to generate and if it does, a connecting hallway gets generated immediately after.

The process always goes: roomA -> roomB -> hallwayAB, if roomB calls another room then the process is repeated as roomB -> roomC -> hallwayBC

Generating the rooms first allowed me to make all of the sides solid and then the hallways force openings into the room. Getting the size of the rooms variable took a lot of fiddling around because they needed to be generated at different distances apart from each other. It was all pretty fun but "organizing" the world was hard with structures so big. Something like a vanilla dungeon doesn't matter because it never exceeds the bounds of its chunk (afaik).

Link to comment
Share on other sites

Yeah, but you could write your own function to check if there are bricks or planks nearby to determine if there are already dungeons there.

 

I recommended to have rooms with predefined doors because this way you have more control about the design of the room.

Here could be your advertisement!

Link to comment
Share on other sites

here is some code for adding village structures in 1.7.10

 

during FMLPreInitializationEvent call

 

VillagerRegistry.instance().registerVillageCreationHandler(new StoreHandler());

MapGenStructureIO.func_143031_a(ComponentShop.class, VillageIdiot.modid+":vibss");

 

 

StoreHandler  class

package me.el.VillageIdiot;

import java.util.List;
import java.util.Random;

import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;

public class StoreHandler implements IVillageCreationHandler {

@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
	 return new PieceWeight(ComponentShop.class, 9, 1);
}

@Override
public Class<?> getComponentClass() {
	return ComponentShop.class;
}

@Override
public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) {
	return ComponentShop.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
}

 

ComponentShop class

package me.el.VillageIdiot;

import java.util.List;
import java.util.Random;

import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;

public class ComponentShop   extends StructureVillagePieces.House1{
private int averageGroundLevel=-1;
private static Random rng=new Random();
private static BlockSelector basment;

public ComponentShop()
{
}

/**
 * @param villagePiece  
 * @param par2 
 */
public ComponentShop(Start villagePiece, int par2, Random rnd, StructureBoundingBox sbb, int cbs){
	super();
	this.coordBaseMode = cbs;
	this.boundingBox = sbb;
}

public static ComponentShop buildComponent (Start villagePiece, List<?> pieces, Random random, int x, int y, int z, int cbs, int p5){
	//System.out.println("ComponentEtchStore buildComponent "+x+" "+y+" "+z);
	StructureBoundingBox nbb = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, -2, 0, 10, 4, 7, cbs);
	//System.out.println("ComponentEtchStore buildComponent "+nbb.toString());
	ComponentShop r= canVillageGoDeeper(nbb) && StructureComponent.findIntersecting(pieces, nbb) == null ? new ComponentShop(villagePiece, p5, random, nbb, cbs) : null;
	//System.out.println("ComponentEtchStore buildComponent "+r+" "+nbb);
	return r;
}

@Override
public boolean addComponentParts (World world, Random random, StructureBoundingBox nsbb){
	//System.out.println("ComponentDJStore addComponentParts "+this+" "+nsbb+" "+averageGroundLevel);
	StructureBoundingBox sbb= new StructureBoundingBox(nsbb);
	if (this.averageGroundLevel < 0){
		this.averageGroundLevel = this.getAverageGroundLevel(world, nsbb);

		if (this.averageGroundLevel < 0){
			return true;
		}

		this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 2, 0);
	}

	int s2 = getMetadataWithOffset(Blocks.oak_stairs, 2);
	int s3 = getMetadataWithOffset(Blocks.oak_stairs, 3);

	int ld= getMetadataWithOffset(Blocks.ladder, 5);

	fillWithRandomizedBlocks(world, sbb, 0, -3, 0, 9, 1, 6, false, rng, basment);
	fillWithBlocks(world, sbb, 1, 1, 1, 8, 1, 5, Blocks.planks, Blocks.planks, false);
	fillWithBlocks(world, sbb, 0,2,0 , 9, 5, 6, Blocks.planks, Blocks.planks, false);

	fillWithBlocks(world, sbb, 0, 3, 3 , 9, 3, 3, Blocks.glass_pane, Blocks.glass_pane, false);
	fillWithBlocks(world, sbb, 2, 3, 0 , 3, 3, 6, Blocks.glass_pane, Blocks.glass_pane, false);
	fillWithBlocks(world, sbb, 6, 3, 6 , 7, 3, 6, Blocks.glass_pane, Blocks.glass_pane, false);

	fillWithAir(world, sbb, 1, 2, 1, 8, 4, 5);
	fillWithAir(world, sbb, 1, -2, 1, 8, -1, 5);
	fillWithMetadataBlocks(world, sbb, 1, -2, 3, 1, 2, 3, Blocks.ladder, ld, Blocks.ladder, ld, false);

	fillWithBlocks(world, sbb, 0, 6, 2, 9, 7, 4, Blocks.planks, Blocks.planks, false);
	fillWithMetadataBlocks(world, sbb, 0, 8, 3, 9, 8, 3, Blocks.wooden_slab, 5, Blocks.wooden_slab, 5, false);

	for (int t=0;t<3;t++){
		fillWithMetadataBlocks(world, sbb, 0, 5+t, 0+t, 9, 5+t, 0+t, Blocks.dark_oak_stairs, s3, Blocks.dark_oak_stairs, s3, false);
		fillWithMetadataBlocks(world, sbb, 0, 5+t, 6-t, 9, 5+t, 6-t, Blocks.dark_oak_stairs, s2, Blocks.dark_oak_stairs, s2, false);
	}
	placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 5, 3, 0, sbb);
	placeDoorAtCurrentPosition(world, sbb, rng, 7, 2, 0, getMetadataWithOffset(Blocks.wooden_door, 1));
	placeBlockAtCurrentPosition(world, Blocks.stone_stairs, s3, 7, 1, -1, sbb);

	placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 4, 1, sbb);
	placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 4, 1, sbb);
	placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 4, 5, sbb);
	placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 4, 5, sbb);
	spawnVillagers(world, sbb, 3, 2, 4, 2);
	return true;
}

@Override
protected int getVillagerType(int n) {
	VillageIdiot.log("getVillagerType"+n);
	if ((n&1)==0){
		return VillageIdiot.proxy.idiot_b;
	}else{
		return VillageIdiot.proxy.idiot_s;
	}
}

static{
	basment=new BlockSelector(){
		@Override
		public void selectBlocks(Random rng, int x, int y, int z, boolean b) {
			field_151562_a=Blocks.stonebrick;
		}
		@Override
		public int getSelectedBlockMetaData() {
			int r = rng.nextInt(5);
			if (r>2)r=0;
			return r;
		}
	};
};

}

 

you might find some errors as it will try to spawn villagers with professions you don't have as i skipped there code, but it should be easily fixed

 

 

 

 

Link to comment
Share on other sites

  • 9 years later...

Is it possible for someone to not only create Procedural generation, but randomize all over again at a certain interval? an example I think of is Vault Hunters, but I'm not sure if that's the same.  want a constantly changing dungeon.

Link to comment
Share on other sites

On 8/17/2024 at 12:48 PM, 3ds_Parakeet said:

Is it possible for someone to not only create Procedural generation, but randomize all over again at a certain interval? an example I think of is Vault Hunters, but I'm not sure if that's the same.  want a constantly changing dungeon.

That sounds like an interesting challenge. You could try regenerating the structure on-the-go using a Jigsaw block, or something similar, but that might not be what you want. We'd need to know more (end goal, Minecraft version, what you've got done so far, etc.) to figure out what the best strategy would be. Also, as AlphaIceCube said, you should probably start a new post since this one's pretty old.

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

    • 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 
    • When I came across the 'Exit Code: I got a 1 error in my Minecraft mods, so I decided to figure out what was wrong. First, I took a look at the logs. In the mods folder (usually where you'd find logs or crash reports), I found the latest.log file or the corresponding crash report. I read it through carefully, looking for any lines with errors or warnings. Then I checked the Minecraft Forge support site, where you can often find info on what causes errors and how to fix them. I then disabled half of my mods and tried running the game. If the error disappeared, it meant that the problem was with the disabled mod. I repeated this several times to find the problem mod.
  • Topics

×
×
  • Create New...

Important Information

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