Jump to content

slow loading.... ore gen efficiency needed


reapersremorse

Recommended Posts

hello, can anyone help me make my ore gen more efficient?
i am using some mods for ease and comparisons for values and such.
mods list
jei_1.12.2-4.11.0.206
jepb-1.12-1.12.1
journeymap-1.12.2-5.5.2
justenoughbuttons-1.12.2-1.2.2-5
mantle-1.12-1.3.2.24

moartinkers-0.6.0

projecte-1.12-pe1.3.0

tconstruct-1.12.2-2.10.1.87
veinminer-1.12-0.38.2+b31535a
my mod (UTO-Mod-0.5.3)

reason for posting, it takes quite a bit for my world to load, ive played with many mods with a great deal of mods and usually modpacks that add a lot of ores, and i never had to load a world for this long 
my ore gen code, loading an instance is no problem, with this invironment it only takes me 30 seconds to load from hitting play, till it gets to the title screen. so thats not a problem

but when i clock create world, it takes 2:48 in order to get to the menu screen,(i was tabbed out so it went to menu screen)
noticable chunk gen lag aswell, ive played with many mods adding way more ored than this and had no where near as much loading lag as this.
anyone have any suggenstions??
 

package com.reapersremorse.uto.prefabs.worldgen;

import com.reapersremorse.uto.init.blocks.InitiateBlocks.BasicBlockRegistry;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

import java.util.Random;

public class OreGen implements IWorldGenerator {


    private static WorldGenerator T0;
    private static WorldGenerator T1;
    private static WorldGenerator T2;
    private static WorldGenerator T3;
    private static WorldGenerator T4;
    private static WorldGenerator T5;
    private static WorldGenerator T6;
    private static WorldGenerator T7;
    private static WorldGenerator T8;
    private static WorldGenerator T9;
    private static WorldGenerator T10;
    private static WorldGenerator T11;
    private static WorldGenerator T12;
    private static WorldGenerator T13;
    private static WorldGenerator T14;
    public static WorldGenerator T15;


    public OreGen() {

        T0 = new WorldGenMinable(BasicBlockRegistry.T0ORE.getDefaultState(),3);
        T1 = new WorldGenMinable(BasicBlockRegistry.T1ORE.getDefaultState(),3);
        T2 = new WorldGenMinable(BasicBlockRegistry.T2ORE.getDefaultState(),3);
        T3 = new WorldGenMinable(BasicBlockRegistry.T3ORE.getDefaultState(),3);
        T4 = new WorldGenMinable(BasicBlockRegistry.T4ORE.getDefaultState(),3);
        T5 = new WorldGenMinable(BasicBlockRegistry.T5ORE.getDefaultState(),3);
        T6 = new WorldGenMinable(BasicBlockRegistry.T6ORE.getDefaultState(),3);
        T7 = new WorldGenMinable(BasicBlockRegistry.T7ORE.getDefaultState(),3);
        T8 = new WorldGenMinable(BasicBlockRegistry.T8ORE.getDefaultState(),3);
        T9 = new WorldGenMinable(BasicBlockRegistry.T9ORE.getDefaultState(),3);
        T10 = new WorldGenMinable(BasicBlockRegistry.T10ORE.getDefaultState(),3);
        T11 = new WorldGenMinable(BasicBlockRegistry.T11ORE.getDefaultState(),3);
        T12 = new WorldGenMinable(BasicBlockRegistry.T12ORE.getDefaultState(),3);
        T13 = new WorldGenMinable(BasicBlockRegistry.T13ORE.getDefaultState(),3);
        T14 = new WorldGenMinable(BasicBlockRegistry.T14ORE.getDefaultState(),3);
        T15 = new WorldGenMinable(BasicBlockRegistry.T15ORE.getDefaultState(),3);

    }

    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

        switch(world.provider.getDimension()) {
            //overworld
            case 0:

                runGenerator(T0, world, random, chunkX, chunkZ, 100, 60, 64);
                runGenerator(T1, world, random, chunkX, chunkZ, 80, 56, 60);
                runGenerator(T2, world, random, chunkX, chunkZ, 75, 52, 56);
                runGenerator(T3, world, random, chunkX, chunkZ, 70, 48, 52);
                runGenerator(T4, world, random, chunkX, chunkZ, 65, 44, 48);
                runGenerator(T5, world, random, chunkX, chunkZ, 60, 40, 44);
                runGenerator(T6, world, random, chunkX, chunkZ, 55, 36, 40);
                runGenerator(T7, world, random, chunkX, chunkZ, 50, 32, 36);
                runGenerator(T8, world, random, chunkX, chunkZ, 45, 28, 32);
                runGenerator(T9, world, random, chunkX, chunkZ, 40, 24, 28);
                break;
            //end
            case 1:
                runGenerator(T14, world, random, chunkX, chunkZ, 100, 6, 128);
                runGenerator(T15, world, random, chunkX, chunkZ, 100, 6, 128);
                break;
            //Nether
            case -1:
                runGenerator(T10, world, random, chunkX, chunkZ, 50, 65, 69);
                runGenerator(T11, world, random, chunkX, chunkZ, 45, 70, 74);
                runGenerator(T12, world, random, chunkX, chunkZ, 40, 75, 79);
                runGenerator(T13, world, random, chunkX, chunkZ, 35, 80, 84);
                runGenerator(T14, world, random, chunkX, chunkZ, 30, 85, 89);
                runGenerator(T15, world, random, chunkX, chunkZ, 25, 90, 94);
                break;
        }

    }


    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 heighDiff = maxHeight - minHeight + 1;

        for(int i = 0; i < chance; i++) {
            int x = chunkX * 16 + rand.nextInt(16);
            int y = minHeight + rand.nextInt(heighDiff);
            int z = chunkZ * 16 + rand.nextInt(16);

            gen.generate(world, rand, new BlockPos(x, y, z));
        }
    }
}


 

Link to comment
Share on other sites

14 minutes ago, reapersremorse said:

runGenerator(T0, world, random, chunkX, chunkZ, 100, 60, 64);

 

14 minutes ago, reapersremorse said:

for(int i = 0; i < chance; i++) {

I wonder what these two lines are doing?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

first line, its running the random generation at a 100%chance to spawn at least once between y level 60 and 64

second line, it should be setting an int, then saying if that int is for which ever world, then spawn in that world at the y levels specified in the first line

-1,0,1 for worlds

Edited by reapersremorse
i mispelled and forgot something
Link to comment
Share on other sites

9 minutes ago, reapersremorse said:

first line, its running the random generation at a 100%chance to spawn at least once between y level 60 and 64

Did you write the code for runGenerator? Did you read it? Because if you did you need to learn java or read it again. Your actually telling it to generate a batch of 3 or 100 times per chunk. Between y 69 and 64.

  • Like 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

T0 = new WorldGenMinable(BasicBlockRegistry.T0ORE.getDefaultState(),3);

in this line, im setting the block to spawn, and how many blocks per vein. this is 3 blocks per vein

runGenerator(T0, world, random, chunkX, chunkZ, 100, 60, 64);

int 100 = chance to spawn, int 60 is min height, int 64 is max height.
the case statement uses the code in WorldProvider.java in minecraft

for(int i = 0; i < chance; i++) {

are you referring to the portion of code that has the i++
if so, i couldnt get the game to run without doing that, i do not see the 100x spawn you are talking about. and this i++ is the only mention of 3x in any of the math.

for(int i = 0; i < chance; i++) {
    int x = chunkX * 16 + rand.nextInt(16);
    int y = minHeight + rand.nextInt(heighDiff);
    int z = chunkZ * 16 + rand.nextInt(16);

    gen.generate(world, rand, new BlockPos(x, y, z));
}

this whole portion of code should be making the ore generate in the chunk at a random interval with a chance of atleast 1 spawn and 3 blocks per vein with a random built into the vein size. and it sets the chunk size and uses the function built above this portion of code in order to tell what y level to spawn between.

Link to comment
Share on other sites

7 minutes ago, reapersremorse said:

for(int i = 0; i < chance; i++) {

This line of code will run the code inside of the {} until i >= to chance. And i++ while add one to i every time it is ran. So this will call 

 

7 minutes ago, reapersremorse said:

int x = chunkX * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heighDiff); int z = chunkZ * 16 + rand.nextInt(16);  gen.generate(world, rand, new BlockPos(x, y, z))

chance amount of times.

 

For loop

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

7 minutes ago, reapersremorse said:

oh my, i misunderstood completely, i was under the impression the random function from java was looking to see what chance to spawn once was.

This has nothing to do with the random function from java.

7 minutes ago, reapersremorse said:

i didnt realize i was telling it to spawn 100x

12 minutes ago, Animefan8888 said:

 

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

ive changed my chance on all 16 ores, now it loads from world creation in 26.5 seconds.

switch(world.provider.getDimension()) {
    //overworld
    case 0:

        runGenerator(T0, world, random, chunkX, chunkZ, 15, 60, 64);
        runGenerator(T1, world, random, chunkX, chunkZ, 12, 56, 60);
        runGenerator(T2, world, random, chunkX, chunkZ, 11, 52, 56);
        runGenerator(T3, world, random, chunkX, chunkZ, 10, 48, 52);
        runGenerator(T4, world, random, chunkX, chunkZ, 9, 44, 48);
        runGenerator(T5, world, random, chunkX, chunkZ, 8, 40, 44);
        runGenerator(T6, world, random, chunkX, chunkZ, 7, 36, 40);
        runGenerator(T7, world, random, chunkX, chunkZ, 6, 32, 36);
        runGenerator(T8, world, random, chunkX, chunkZ, 5, 28, 32);
        runGenerator(T9, world, random, chunkX, chunkZ, 4, 24, 28);
        break;
    //end
    case 1:
        runGenerator(T14, world, random, chunkX, chunkZ, 10, 6, 128);
        runGenerator(T15, world, random, chunkX, chunkZ, 10, 6, 128);
        break;
    //Nether
    case -1:
        runGenerator(T10, world, random, chunkX, chunkZ, 8, 65, 69);
        runGenerator(T11, world, random, chunkX, chunkZ, 7, 70, 74);
        runGenerator(T12, world, random, chunkX, chunkZ, 6, 75, 79);
        runGenerator(T13, world, random, chunkX, chunkZ, 5, 80, 84);
        runGenerator(T14, world, random, chunkX, chunkZ, 4, 85, 89);
        runGenerator(T15, world, random, chunkX, chunkZ, 3, 90, 94);
        break;
}
Link to comment
Share on other sites

20 minutes ago, reapersremorse said:

runGenerator(T0, world, random, chunkX, chunkZ, 15, 60, 64);

This would still be too much. This would be 15 veins of approximately 3 blocks between y values 60-64.

20 minutes ago, reapersremorse said:

runGenerator(T1, world, random, chunkX, chunkZ, 12, 56, 60);

This would still be too much. This would be 12 veins of approximately 3 blocks between y values 56-60.

 

All per chunk.

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

i used a catalyst from projecte and i mined out a 67x67x9 area and i have
231 iron ore
109 tier0 ore(my mod)

27 tier 1
in my mod, iron is technically tier 2 ore. ill lower the values a bit, ut i would like t0 to have the highest count of all my ores and i do not want them to be impossible to find

y level at the top is 64
y level at the bottom is 58

my aim is to make it so no matter what biome you start in, you do not need wood and you do not need iron to start. my t0 is basically a throwaway ore, it only mines at hand level (0) but its much faster and has infinate durability. it will have ok armor that will protect against knockback hopefully but it will be basic, im also making it so you need the previous tier to make the next one so you will need a lot of this ore in the future. especially when i get into making machines.

 

if you believe this is still too op i can change it to be lower, im not good at judging these values yet. i also do not want to impeed on other ore generation from other mods...

2018-08-13_01.42.34.png

2018-08-13_01.42.41.png

Link to comment
Share on other sites

6 minutes ago, reapersremorse said:

i also do not want to impeed on other ore generation from other mods...

It will most likely do this.

  • Like 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 hours ago, reapersremorse said:

ill lower the chance and up the vein count.

Can I suggest upping the chance (a lot) and lowering the vein count and vein size?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

1 minute ago, Cadiboo said:

Can I suggest upping the chance (a lot)

The chance variable means how many possible chances the vein has to spawn in a chunk, not a percent chance.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

1 minute ago, reapersremorse said:

i do not know what values i want to add but i have it where the world loads in about 25 seconds

If you want to decrease this you could increase the vein size, and decrease the chances to spawn in a chunk.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

3 minutes ago, Animefan8888 said:

The chance variable means how many possible chances the vein has to spawn in a chunk, not a percent chance.

I meant upping the percentage chance, sorry. 

This can be done by upping the chance variable, but you should do this by having a low chance variable (between 5-15 for all ores I recommend) and a low vein count & vein size (this also lessens the chance of cascading world-get from large veins going into neighbouring chunks). Thats personal preference though, I like to have rare, small deposits of high value ores. If you want something else, have a look at granite generation, iron generation & lapis generation. They're in the class

net.minecraft.world.biome.BiomeDecorator [lines: 106 - 118] - decorate(World, Random, Biome, BlockPos)    

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

6 minutes ago, Animefan8888 said:

The chance variable means how many possible chances the vein has to spawn in a chunk, not a percent chance.

my inital post was loading the oregen in 2:48
my system is as follows
amd Ryzen 7 2700x eight core
32gigs (7271mb allocated to minecraft)

gforce gtx 1060 6gb gpu

the fact that it took that long is insane
this is what i changed it to and i havent looked in world yet, ill need to tweak it till its right.

 

package com.reapersremorse.uto.prefabs.worldgen;

import com.reapersremorse.uto.init.blocks.InitiateBlocks.BasicBlockRegistry;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

import java.util.Random;

public class OreGen implements IWorldGenerator {


    private static WorldGenerator T0;
    private static WorldGenerator T1;
    private static WorldGenerator T2;
    private static WorldGenerator T3;
    private static WorldGenerator T4;
    private static WorldGenerator T5;
    private static WorldGenerator T6;
    private static WorldGenerator T7;
    private static WorldGenerator T8;
    private static WorldGenerator T9;
    private static WorldGenerator T10;
    private static WorldGenerator T11;
    private static WorldGenerator T12;
    private static WorldGenerator T13;
    private static WorldGenerator T14;
    public static WorldGenerator T15;


    public OreGen() {

        T0 = new WorldGenMinable(BasicBlockRegistry.T0ORE.getDefaultState(),7);
        T1 = new WorldGenMinable(BasicBlockRegistry.T1ORE.getDefaultState(),6);
        T2 = new WorldGenMinable(BasicBlockRegistry.T2ORE.getDefaultState(),5);
        T3 = new WorldGenMinable(BasicBlockRegistry.T3ORE.getDefaultState(),4);
        T4 = new WorldGenMinable(BasicBlockRegistry.T4ORE.getDefaultState(),3);
        T5 = new WorldGenMinable(BasicBlockRegistry.T5ORE.getDefaultState(),3);
        T6 = new WorldGenMinable(BasicBlockRegistry.T6ORE.getDefaultState(),3);
        T7 = new WorldGenMinable(BasicBlockRegistry.T7ORE.getDefaultState(),3);
        T8 = new WorldGenMinable(BasicBlockRegistry.T8ORE.getDefaultState(),3);
        T9 = new WorldGenMinable(BasicBlockRegistry.T9ORE.getDefaultState(),3);
        T10 = new WorldGenMinable(BasicBlockRegistry.T10ORE.getDefaultState(),3);
        T11 = new WorldGenMinable(BasicBlockRegistry.T11ORE.getDefaultState(),3);
        T12 = new WorldGenMinable(BasicBlockRegistry.T12ORE.getDefaultState(),3);
        T13 = new WorldGenMinable(BasicBlockRegistry.T13ORE.getDefaultState(),3);
        T14 = new WorldGenMinable(BasicBlockRegistry.T14ORE.getDefaultState(),3);
        T15 = new WorldGenMinable(BasicBlockRegistry.T15ORE.getDefaultState(),3);

    }

    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

        switch(world.provider.getDimension()) {
            //overworld
            case 0:

                runGenerator(T0, world, random, chunkX, chunkZ, 1, 60, 64);
                runGenerator(T1, world, random, chunkX, chunkZ, 1, 56, 60);
                runGenerator(T2, world, random, chunkX, chunkZ, 1, 52, 56);
                runGenerator(T3, world, random, chunkX, chunkZ, 1, 48, 52);
                runGenerator(T4, world, random, chunkX, chunkZ, 1, 44, 48);
                runGenerator(T5, world, random, chunkX, chunkZ, 1, 40, 44);
                runGenerator(T6, world, random, chunkX, chunkZ, 1, 36, 40);
                runGenerator(T7, world, random, chunkX, chunkZ, 1, 32, 36);
                runGenerator(T8, world, random, chunkX, chunkZ, 1, 28, 32);
                runGenerator(T9, world, random, chunkX, chunkZ, 1, 24, 28);
                break;
            //end
            case 1:
                runGenerator(T14, world, random, chunkX, chunkZ, 5, 6, 128);
                runGenerator(T15, world, random, chunkX, chunkZ, 5, 6, 128);
                break;
            //Nether
            case -1:
                runGenerator(T10, world, random, chunkX, chunkZ, 1, 65, 69);
                runGenerator(T11, world, random, chunkX, chunkZ, 1, 70, 74);
                runGenerator(T12, world, random, chunkX, chunkZ, 1, 75, 79);
                runGenerator(T13, world, random, chunkX, chunkZ, 1, 80, 84);
                runGenerator(T14, world, random, chunkX, chunkZ, 1, 85, 89);
                runGenerator(T15, world, random, chunkX, chunkZ, 1, 90, 94);
                break;
        }

    }


    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 heighDiff = maxHeight - minHeight + 1;

        for(int i = 0; i < chance; i++) {
            int x = chunkX * 16 + rand.nextInt(16);
            int y = minHeight + rand.nextInt(heighDiff);
            int z = chunkZ * 16 + rand.nextInt(16);

            gen.generate(world, rand, new BlockPos(x, y, z));
        }
    }
}

i basically did as animefan8888 said, i changed the spawn chance and upped the vein count, its at 25 seconds load time now, but it takes 24 seconds without any mods

Link to comment
Share on other sites

1 minute ago, reapersremorse said:

my inital post was loading the oregen in 2:48
my system is as follows
amd Ryzen 7 2700x eight core
32gigs (7271mb allocated to minecraft)

gforce gtx 1060 6gb gpu

the fact that it took that long is insane
this is what i changed it to and i havent looked in world yet, ill need to tweak it till its right.

 


package com.reapersremorse.uto.prefabs.worldgen;

import com.reapersremorse.uto.init.blocks.InitiateBlocks.BasicBlockRegistry;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

import java.util.Random;

public class OreGen implements IWorldGenerator {


    private static WorldGenerator T0;
    private static WorldGenerator T1;
    private static WorldGenerator T2;
    private static WorldGenerator T3;
    private static WorldGenerator T4;
    private static WorldGenerator T5;
    private static WorldGenerator T6;
    private static WorldGenerator T7;
    private static WorldGenerator T8;
    private static WorldGenerator T9;
    private static WorldGenerator T10;
    private static WorldGenerator T11;
    private static WorldGenerator T12;
    private static WorldGenerator T13;
    private static WorldGenerator T14;
    public static WorldGenerator T15;


    public OreGen() {

        T0 = new WorldGenMinable(BasicBlockRegistry.T0ORE.getDefaultState(),7);
        T1 = new WorldGenMinable(BasicBlockRegistry.T1ORE.getDefaultState(),6);
        T2 = new WorldGenMinable(BasicBlockRegistry.T2ORE.getDefaultState(),5);
        T3 = new WorldGenMinable(BasicBlockRegistry.T3ORE.getDefaultState(),4);
        T4 = new WorldGenMinable(BasicBlockRegistry.T4ORE.getDefaultState(),3);
        T5 = new WorldGenMinable(BasicBlockRegistry.T5ORE.getDefaultState(),3);
        T6 = new WorldGenMinable(BasicBlockRegistry.T6ORE.getDefaultState(),3);
        T7 = new WorldGenMinable(BasicBlockRegistry.T7ORE.getDefaultState(),3);
        T8 = new WorldGenMinable(BasicBlockRegistry.T8ORE.getDefaultState(),3);
        T9 = new WorldGenMinable(BasicBlockRegistry.T9ORE.getDefaultState(),3);
        T10 = new WorldGenMinable(BasicBlockRegistry.T10ORE.getDefaultState(),3);
        T11 = new WorldGenMinable(BasicBlockRegistry.T11ORE.getDefaultState(),3);
        T12 = new WorldGenMinable(BasicBlockRegistry.T12ORE.getDefaultState(),3);
        T13 = new WorldGenMinable(BasicBlockRegistry.T13ORE.getDefaultState(),3);
        T14 = new WorldGenMinable(BasicBlockRegistry.T14ORE.getDefaultState(),3);
        T15 = new WorldGenMinable(BasicBlockRegistry.T15ORE.getDefaultState(),3);

    }

    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

        switch(world.provider.getDimension()) {
            //overworld
            case 0:

                runGenerator(T0, world, random, chunkX, chunkZ, 1, 60, 64);
                runGenerator(T1, world, random, chunkX, chunkZ, 1, 56, 60);
                runGenerator(T2, world, random, chunkX, chunkZ, 1, 52, 56);
                runGenerator(T3, world, random, chunkX, chunkZ, 1, 48, 52);
                runGenerator(T4, world, random, chunkX, chunkZ, 1, 44, 48);
                runGenerator(T5, world, random, chunkX, chunkZ, 1, 40, 44);
                runGenerator(T6, world, random, chunkX, chunkZ, 1, 36, 40);
                runGenerator(T7, world, random, chunkX, chunkZ, 1, 32, 36);
                runGenerator(T8, world, random, chunkX, chunkZ, 1, 28, 32);
                runGenerator(T9, world, random, chunkX, chunkZ, 1, 24, 28);
                break;
            //end
            case 1:
                runGenerator(T14, world, random, chunkX, chunkZ, 5, 6, 128);
                runGenerator(T15, world, random, chunkX, chunkZ, 5, 6, 128);
                break;
            //Nether
            case -1:
                runGenerator(T10, world, random, chunkX, chunkZ, 1, 65, 69);
                runGenerator(T11, world, random, chunkX, chunkZ, 1, 70, 74);
                runGenerator(T12, world, random, chunkX, chunkZ, 1, 75, 79);
                runGenerator(T13, world, random, chunkX, chunkZ, 1, 80, 84);
                runGenerator(T14, world, random, chunkX, chunkZ, 1, 85, 89);
                runGenerator(T15, world, random, chunkX, chunkZ, 1, 90, 94);
                break;
        }

    }


    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 heighDiff = maxHeight - minHeight + 1;

        for(int i = 0; i < chance; i++) {
            int x = chunkX * 16 + rand.nextInt(16);
            int y = minHeight + rand.nextInt(heighDiff);
            int z = chunkZ * 16 + rand.nextInt(16);

            gen.generate(world, rand, new BlockPos(x, y, z));
        }
    }
}

i basically did as animefan8888 said, i changed the spawn chance and upped the vein count, its at 25 seconds load time now, but it takes 24 seconds without any mods

please post your code in a spoiler, or even better as a GitHub repository

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • im stuck in a problem whit BlockEntities i cannot solve so im trying to work around it but in the less complex way possible  i think is posible to store data to the minecraft world  in older versions people talk about  WordDataSave i dont find anything about it for 1.20.4  i find a tutorial for player capability in 1.19    here is an event      //########## ########## ########## ##########     @SubscribeEvent     public static void onAttachCapabilitiesPlayer(AttachCapabilitiesEvent<Entity> event) {         if(event.getObject() instanceof Player) {             if(!event.getObject().getCapability(PlayerThirstProvider.PLAYER_THIRST).isPresent()) {                 event.addCapability(new ResourceLocation(mercmod.MOD_ID, "properties"), new PlayerThirstProvider());             }         }     }  soo i made this      //########## ########## ########## ##########     @SubscribeEvent     public static void onAttachCapabilitiesLevel(AttachCapabilitiesEvent<Level> event) {     } i think i can do some witchcraft  here  but is many things don't understand  to start whit i dont get yet how to recall the saved data from a BlockEntity  the handler still in progress the plan is to make a Map to store nbt data using the block coordinates as index later store that map as a big nbt      ########## any way the question is if theres alredy a tutorial for 1.20.4 for this ?? or some alredy working code from someone else doing something similar ?           
    • I tried this, and found out that Oculus is the mod that is crashing the game. I have removed it, and it now works fine! Thanks!
    • Hi @DanielderErbauer, I arrived here as I have the "as it does not exist in Block{minecraft:air}" error in a modpack I am trying to start. It's a long-shot, I know, but as the post that led this to being solved is missing, can I ask if you may recall what it said? Thanks in advance
    • Hm yeah sorry, not seeing anything else that's sticking out, I'd need to debug myself probably. Do you have a github or bitbucket repo? I could poke around when I have time to see what the problem might be.
    • looking around for the capabilities thing i found a piece of code and find this piece of code  //########## ########## ########## ########## @SubscribeEvent public static void addCustomTrades(VillagerTradesEvent event) { if(event.getType() == VillagerProfession.FLETCHER) { System.out.println("\n\n### VillagerProfession.FLETCHER \n\n");//<----------- Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades(); ItemStack stack = new ItemStack(ItemInit.ARROW_STEEL.get(), 16); int villagerLevel = 1; trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer( new ItemStack(Items.EMERALD, 2), stack,1,3,0.02F)); } if(event.getType() == VillagerProfession.TOOLSMITH) { System.out.println("\n\n### VillagerProfession.TOOLSMITH \n\n");//<----------- Int2ObjectMap<List<VillagerTrades.ItemListing>> trades = event.getTrades(); ItemStack stack = new ItemStack(ItemInit.INGOT_STEEL.get(), 1); int villagerLevel = 1; trades.get(villagerLevel).add((trader, rand) -> new MerchantOffer( new ItemStack(Items.EMERALD, 2), stack,10,8,0.02F)); } } //########## ########## ########## ########## the event is aknoledge and execute when the maps load  ### VillagerProfession.FLETCHER  ### VillagerProfession.TOOLSMITH  //########## But is not working      is a random piece of code is not working  could it be than this code is old 1.18 and no valid anymore for 1.20.4 or the thing are this numbers  stack,10,8,0.02F));  i dont know what this numbers means    ########## the question is ¿how to add things to the villager traders    thanks for your attention               
  • Topics

×
×
  • Create New...

Important Information

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