Jump to content

[1.12.2] Biome and Dimension tutorials


ttocskcaj

Recommended Posts

46 minutes ago, Dragonisser said:

Sadly i cant check the code right now.

I bet if TGG, diesieben, jabelar or draco would take a look at it they would probably find it quite fast, but that is not their job.

Just paste your code in if you don't figure it out. Someone will help. Probably start a new thread though :P

Link to comment
Share on other sites

If you dont mind ill post it here: https://github.com/Dragonisser/CobaltMod-2

 

I disabled the dimension light, sky, decoration, spreading of my block, particle effects and its still the exact same issue.

 

 

Changed the CMBiomeProvider to the simplier version of ttocskcaj which drastically increased the fps, but still not good enough.

 

 

And now in normal minecraft

 

 

Edited by Dragonisser
Link to comment
Share on other sites

10 hours ago, Dragonisser said:

If you dont mind ill post it here: https://github.com/Dragonisser/CobaltMod-2

 

I disabled the dimension light, sky, decoration, spreading of my block, particle effects and its still the exact same issue.

 

In your CMWorldProvider class I think you're overriding too many methods. One of the tricks with Minecraft world gen is that the classes and methods are very convoluted and you can run into trouble where you register things but also override methods in ways that don't match.

 

For example, you shouldn't provide the chunk generator directly. It should come from the WorldType (in the terrainType field) automatically. So I don't think you should override the createChunkGenerator() method.

 

You also shouldn't have to provide the biomes. I don't think you should override the getBiomeProvider() method. That should also come from the WorldType automatically. So I don't think you should override the getBiomeProvider() or the getBiomeForCoords() methods.

 

I suggest properly creating a WordType and having those methods automatically give the results in the WorldProvider (using the parent class without overriding), cause I've found mixups that can occur can cause lag.

 

Another thing I notices is that you're using your own "corrupted stone" to fill in the chunk. In your mineable world gen you properly use a predicate that also checks for corrupted stone, but I wonder if there are other features that are struggling because they look for regular stone or something. For example, if a ravine or mineshaft was looking for stone and couldn't find it then I would expect the chunk generation to take longer. For example MapGenCaves looks for specific blocks which may not be present in your case. To isolate this, I recommend commenting out each of the feature generators and see if any of them are causing lag; if so you might need to do a custom version.

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

Link to comment
Share on other sites

19 minutes ago, jabelar said:

Another thing I notices is that you're using your own "corrupted stone" to fill in the chunk. In your mineable world gen you properly use a predicate that also checks for corrupted stone, but I wonder if there are other features that are struggling because they look for regular stone or something. For example, if a ravine or mineshaft was looking for stone and couldn't find it then I would expect the chunk generation to take longer. For example MapGenCaves looks for specific blocks which may not be present in your case. To isolate this, I recommend commenting out each of the feature generators and see if any of them are causing lag; if so you might need to do a custom version.

MapGenCaves uses this method to check if it can replace a block with a cave:

    protected boolean canReplaceBlock(IBlockState p_175793_1_, IBlockState p_175793_2_)
    {
        if (p_175793_1_.getBlock() == Blocks.STONE)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.DIRT)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.GRASS)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.HARDENED_CLAY)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.STAINED_HARDENED_CLAY)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.SANDSTONE)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.RED_SANDSTONE)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.MYCELIUM)
        {
            return true;
        }
        else if (p_175793_1_.getBlock() == Blocks.SNOW_LAYER)
        {
            return true;
        }
        else
        {
            return (p_175793_1_.getBlock() == Blocks.SAND || p_175793_1_.getBlock() == Blocks.GRAVEL) && p_175793_2_.getMaterial() != Material.WATER;
        }
    }


@Dragonisser If it ends up to be your mapgen, you could try override that method?

Link to comment
Share on other sites

Jfyi even the less lag isnt normal, there shouldnt be any at all.

 

 

I completely disabled everything that tries to put something below surface.

Caves are still in there tho, gotta check that.

 

Added a WorldType, but now the chunkgenerator and the rest doesnt work. How can i bind it to my world, i cant find any relations in your code.

 

https://github.com/Dragonisser/CobaltMod-2/commit/03fc2b919b0c61c13bd7a089c0db1bb2db7b20f1

Edited by Dragonisser
Link to comment
Share on other sites

15 minutes ago, Dragonisser said:

Jfyi even the less lag isnt normal, there shouldnt be any at all.

 

 

I completely disabled everything that tries to put something below surface.

Caves are still in there tho, gotta check that.

 

Added a WorldType, but now the chunkgenerator and the rest doesnt work. How can i bind it to my world, i cant find any relations in your code.

 

https://github.com/Dragonisser/CobaltMod-2/commit/03fc2b919b0c61c13bd7a089c0db1bb2db7b20f1

Do you wanna try building mine and running it? See if the lag is any less for you.

Link to comment
Share on other sites

6 minutes ago, Dragonisser said:

Jfyi even the less lag isnt normal, there shouldnt be any at all.

 

 

I completely disabled everything that tries to put something below surface.

Caves are still in there tho, gotta check that.

 

Added a WorldType, but now the chunkgenerator and the rest doesnt work. How can i bind it to my world, i cant find any relations in your code.

 

https://github.com/Dragonisser/CobaltMod-2/commit/03fc2b919b0c61c13bd7a089c0db1bb2db7b20f1

 

You can see my example code here: https://github.com/jabelar/ExampleMod-1.12/tree/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/worldgen

 

The way the WorldType works, is you MUST use the super constructor that just takes a string for the name. That constructor will add your custom world type to the available options in the new world creation menu. See https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/worldgen/WorldTypeCloud.java. In that you'll see you need to override the key methods for providing the BiomeProvider and ChunkGenerator.

 

I give a list of the things that need to be hooked together in this tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-modding-custom-dimension.html.

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

Link to comment
Share on other sites

3 hours ago, jabelar said:

 

You can see my example code here: https://github.com/jabelar/ExampleMod-1.12/tree/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/worldgen

 

The way the WorldType works, is you MUST use the super constructor that just takes a string for the name. That constructor will add your custom world type to the available options in the new world creation menu. See https://github.com/jabelar/ExampleMod-1.12/blob/master/src/main/java/com/blogspot/jabelarminecraft/examplemod/worldgen/WorldTypeCloud.java. In that you'll see you need to override the key methods for providing the BiomeProvider and ChunkGenerator.

 

I give a list of the things that need to be hooked together in this tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-modding-custom-dimension.html.

Well, i dont start my world via the new world option. I use a portal to it, thats why i overwrite chunkgenerator and biomeprovider.

 

Edit:

I can try and load it via the world type and see what happens.

 

Edit: Works fine, no lag at all, even with decoration also no decoration and not what i want.

 

Therefore it has nothing to do with the decoration or generation.

 

 

WorldProvider

Minimal Lag and decoration:

public BiomeProvider getBiomeProvider() {
        return new CMBiomeProvider(this.world);
 }

 

I FIXED IT!

Instead of overwriting getBiomeProvider, i simply set it in the init and the lag is completely gone, even on my sort of shitty laptop.
 

protected void init() {
        this.hasSkyLight = true;
        this.biomeProvider = new CMBiomeProvider(this.world);
        this.setAllowedSpawnTypes(false, false);

}

 

https://github.com/Dragonisser/CobaltMod-2/commit/c4663a443573e289b4f5c46af8afeee04f22192f

Edited by Dragonisser
Link to comment
Share on other sites

6 hours ago, Dragonisser said:

 

I FIXED IT!

Instead of overwriting getBiomeProvider, i simply set it in the init and the lag is completely gone, even on my sort of shitty laptop.
 


protected void init() {
        this.hasSkyLight = true;
        this.biomeProvider = new CMBiomeProvider(this.world);
        this.setAllowedSpawnTypes(false, false);

}

 

https://github.com/Dragonisser/CobaltMod-2/commit/c4663a443573e289b4f5c46af8afeee04f22192f

 

Yeah, I guess you were creating a new biomeprovider over and over or something, rather than a single instance that gets referenced again. Usually when I have these problems with world gen I try to simply the amount of overriding and it helps narrow it down. Glad it worked!

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

Link to comment
Share on other sites

3 hours ago, ttocskcaj said:

Just been working on the cave generation. @jabelar it automatically picks the biome blocks to repace as well (topBlock and fillerBlock).

Yes, but I was worried not about the biome filler but about the chunk generator "filler" block. In the chunk generator, such as the vanilla overworld it fills the chunk with STONE. After that the biome might add dirt and grass as filler and top. But the vanilla cave gen uses the canReplaceBlock() method which checks for a bunch of standard stuff including STONE. If you think about it, caves go deeper than the biome filler. If you have your own custom block which is used as tje main block in the chunk generator but not in your biome top or filler, then the caves will have trouble. Of course the solution is to simply override the canReplaceBlock() in your own custom cave generator.

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

Link to comment
Share on other sites

3 hours ago, ttocskcaj said:

Looks ok. But why not just extend MapGenCaves and override the one method you need to?

because i already changed 3 methods and the other will be changed too. bigger caves to be exact.

 

i recommend you to change your WorldProvider like it did to get rid of the lag.

 

 

Edited by Dragonisser
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.