Some Coding issues...

Nolwest

New Member
Jul 29, 2019
5
0
0
I am trying to program a 1.7.10 mod, and add in some ores. I have come across one major error, explained at the bottom of the page. I am not the one using this code, yet trying to make it work for a friend, thus there are some notes added in. Keep in mind that I am using Eclipse Mars.

package Test2;

import java.util.Random;

import com.jcraft.jorbis.Block;

import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;

public class RubyGeneration implements IWorldGenerator {

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
switch (world.provider.dimensionId) {
case -1:
generateNether(world, random, chunkX, chunkZ);
break;
case 0:
generateOverworld(world, random, chunkX, chunkZ);
break;
case 1:
generateEnd(world, random, chunkX, chunkZ);
break;
}
}

public void generateNether(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 0, Blocks.stone);
}// And example here is Test.RubyOre for above

public void generateOverworld(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 20, Blocks.stone);
}// Change around the 2 and 16, 2 is min vein size, and 16 is max. 10 is how common it is, you just have to mess around with that, I'm not sure how it works. The 0 and 20 are standing for min Y level and max.

public void generateEnd(World world, Random rand, int x, int z) {
generateOre(ModName.ModBlock, world, rand, x, z, 2, 16, 10, 0, 0, Blocks.stone);
}

public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY, Block generateIn) {
int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
int heightRange = maxY - minY;
WorldGenMinable gen = new WorldGenMinable(block, vienSize, generateIn);
for(int i = 0; i< chance; i++){
int xRand = chunkX * 16 + random.nextInt(16);
int yRand = random.nextInt(heightRange) + minY;
int zRand = chunkZ * 16 + random.nextInt(16);
gen.generate(world, random, xRand, yRand, zRand);
}
}
}


//In PreInit, put GameRegistry.registerWorldGenerator(new RubyGeneration(), 0);


My main issue with this is the WorldGenMinable(block, vienSize, generateIn);. It is saying the constructor WorldGenMinable(int, Block, Int) is not found. Vien is spelled that way on purpose. I am also posting this on the general chat forums, so you may also see it there.
 

Tbsc

New Member
Jul 29, 2019
22
0
0
Replace the first int variable with with the block variable. vienSize is probably an integer and block is definitely a block type.

Sent from my phone to this forum
 

Nolwest

New Member
Jul 29, 2019
5
0
0
What do you mean? I'm new to modding, started 3 days ago, and I'm not quite understanding what you said.


Sent from my MotoE2(4G-LTE) using Tapatalk
 

Tbsc

New Member
Jul 29, 2019
22
0
0
I need to see how do you use the code. Maybe upload the class to pastebin?

Sent from my phone to this forum
 

Chaka

FTB Team
Mod Developer
Retired Staff
Dec 24, 2013
928
323
103
New Jersey
I need to see how do you use the code. Maybe upload the class to pastebin?

Sent from my phone to this forum
I would suggest a github repo instead. Then we can see everything. It will be a lot easier to debug.
 

Nolwest

New Member
Jul 29, 2019
5
0
0
I think o found my issue. I imported the wrong Block, and know the error has cleared up.

Sent from my MotoE2(4G-LTE) using Tapatalk
 

Nolwest

New Member
Jul 29, 2019
5
0
0
I guess I should say I imported the right block after, then it workes

Sent from my MotoE2(4G-LTE) using Tapatalk