Jump to content

[1.12.2] Generate ore in custom dimension of another mod


Garik1303

Recommended Posts

Hello! How generate ore in custom dimension of another mod? (In my case, I'm trying to add generation to the Misty World by @Liahim)

In the generator, in the generate method, I did such checking if

(world.provider.getDimension () == Mist.dimensionID)

 and such if

(world.provider.getDimension () == 69)

Does not work(

 

In general, here is my generator, and I'm trying to add the generation of my ore to a measurement from another mod:

public class MistyThaumcraftWorldGenerator implements IWorldGenerator
{
    private WorldGenerator ore_amber;
  
    public MistyThaumcraftWorldGenerator()
    {
        ore_amber = new WorldGenMinable(RegisterBlocks.ore_amber.getDefaultState(), 9);
    }

    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
    {
        if (world.provider.getDimension() == Mist.dimensionID) {

            runGenerator(ore_amber, world, random, chunkX, chunkZ, 80, 5, 180);     

        }
      
    }
  
    private void runGenerator(WorldGenerator gen, World world, Random rand, int chunkX, int chunkZ, int chance, int minHeight, int maxHeight)
    {
        if(minHeight > maxHeight || minHeight < 0 || maxHeight > 256) throw new IllegalArgumentException("Ore generated out of bounds");
        int heightDiff = maxHeight - minHeight + 1;
      
        for(int i = 0; i < chance; i++)
        {
            int x = chunkX * 8 + rand.nextInt(8);
            int y = minHeight + rand.nextInt(heightDiff);
            int z = chunkZ * 8 + rand.nextInt(8);
          
            gen.generate(world, rand, new BlockPos(x, y, z));
        }
    }
}

 

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.

Announcements



×
×
  • Create New...

Important Information

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