[1.8.1] Generating Ores
+6
bottz2
jesshankin22
lcass
groxmapper
ikke009
Strengthowns
10 posters
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
[1.8.1] Generating Ores
Generating Ores
- Spoiler:
- mod_Namehere
- Code:
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < RARITY; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(HEIGHT ABOVE BEDROCK);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Namehere.Namehere.blockID, VEIN SIZE)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
Help: mod_Namehere
1. Put this bit of code outside all of the modloader stuff.
2. RARITY is... how rare it is. For reference coal is 20.
3. HEIGHT ABOVE BEDROCK is self explanatory. If you set it to 20, you can find it generating 20 levels above bedrock.
4. VEIN SIZE is the max amount that it generates together.
5. The mod_Namehere.Namehere.blockID is what block it generates.
6. Enjoy your new generating ore!
Re: [1.8.1] Generating Ores
how does the rarity work? if coal is 20, would diamond be higher or lower?
ikke009- Member
- Posts : 65
Join date : 2011-10-24
Age : 30
Location : The netherlands
Re: [1.8.1] Generating Ores
Strengthowns wrote:Generating Ores
- Spoiler:
mod_Namehere
- Code:
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < RARITY; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(HEIGHT ABOVE BEDROCK);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Namehere.Namehere.blockID, VEIN SIZE)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}Help: mod_Namehere
1. Put this bit of code outside all of the modloader stuff.
2. RARITY is... how rare it is. For reference coal is 20.
3. HEIGHT ABOVE BEDROCK is self explanatory. If you set it to 20, you can find it generating 20 levels above bedrock.
4. VEIN SIZE is the max amount that it generates together.
5. The mod_Namehere.Namehere.blockID is what block it generates.
6. Enjoy your new generating ore!
I would like to note this doesn't work with generateNether because WorldGenMinable replaces smooth stone when placing the ores so you'll need to copy WorldGenMineable and edit that to be netherrack for nether ore spawning.
groxmapper- Member
- Posts : 27
Join date : 2011-10-24
Re: [1.8.1] Generating Ores
I noticed people found generating ores hard so here is the full code with all the fixes
- Code:
package net.minecraft.src;
import java.util.Random;
public class mod_rubyore extends BaseMod
{
public static Block rubyore = new rubyore(195, 0).setHardness(1.0F).setResistance(300.0F).setLightValue(1.0F).setBlockName("rubyore");
public String Version()
{
return "1.8.1";
}
public mod_rubyore()
{
ModLoader.RegisterBlock(rubyore);
rubyore.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/crystal/rubyore.png");
ModLoader.AddName(rubyore, "rubyore");
}
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 6; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(30 );
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_rubyore.rubyore.blockID, 2)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
}
Re: [1.8.1] Generating Ores
hmmm... it says it can't recognize the character "public"...
jesshankin22- Member
- Posts : 47
Join date : 2011-10-24
Re: [1.8.1] Generating Ores
wow you could probably click on the error icon in front of the line number to get a list of things you can change the word public in and click the right one, or if you click the word public itself. that is, if you are using eclipse
ikke009- Member
- Posts : 65
Join date : 2011-10-24
Age : 30
Location : The netherlands
Re: [1.8.1] Generating Ores
you might want to start by making a topic in the help section, posging your code and your problem in the right format.. right now i cant magically tell you like 'oh you have to add a ; to the end of line 7 then itll work..'bottz2 wrote:it wont gen
ikke009- Member
- Posts : 65
Join date : 2011-10-24
Age : 30
Location : The netherlands
Re: [1.8.1] Generating Ores
Oh I know that was when I was a n00b to the site... just disregard that cause I got it all figured out, but thanks anyway.
jesshankin22- Member
- Posts : 47
Join date : 2011-10-24
Re: [1.8.1] Generating Ores
where do i put the code? what do you mean by out side of the modloader stuff?
thedirtyassassin- Member
- Posts : 28
Join date : 2011-10-30
Location : In your dreams!
Re: [1.8.1] Generating Ores
this is the code i use for my titanium ore.
I put it in a new class file called mod_titaniumore, which is needed for every generator if you want to genereate more then 1 ore without getting crashes or getting your code unorganized.
I put it in a new class file called mod_titaniumore, which is needed for every generator if you want to genereate more then 1 ore without getting crashes or getting your code unorganized.
- Code:
package net.minecraft.src;
import java.util.Random;
public class mod_titaniumore extends BaseMod
{
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 5; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(20);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_jasper.titaniumore.blockID, 70)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
public String Version()
{
return "1.8.1";
}
}
ikke009- Member
- Posts : 65
Join date : 2011-10-24
Age : 30
Location : The netherlands
Re: [1.8.1] Generating Ores
rarity values are
diamond : 1
gold : 2
coal : 20
thats all i know
diamond : 1
gold : 2
coal : 20
thats all i know
blackhounter- Member
- Posts : 1
Join date : 2011-10-24
Re: [1.8.1] Generating Ores
ikke009 wrote:this is the code i use for my titanium ore.
I put it in a new class file called mod_titaniumore, which is needed for every generator if you want to genereate more then 1 ore without getting crashes or getting your code unorganized.
- Code:
package net.minecraft.src;
import java.util.Random;
public class mod_titaniumore extends BaseMod
{
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 5; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(20);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_jasper.titaniumore.blockID, 70)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
public String Version()
{
return "1.8.1";
}
}
but where do you put the class file?
thedirtyassassin- Member
- Posts : 28
Join date : 2011-10-30
Location : In your dreams!
Re: [1.8.1] Generating Ores
source of information please?blackhounter wrote:rarity values are
diamond : 1
gold : 2
coal : 20
thats all i know
ikke009- Member
- Posts : 65
Join date : 2011-10-24
Age : 30
Location : The netherlands
Re: [1.8.1] Generating Ores
well in the net.minecraft.src of coursethedirtyassassin wrote:ikke009 wrote:snip
but where do you put the class file?
ikke009- Member
- Posts : 65
Join date : 2011-10-24
Age : 30
Location : The netherlands
Re: [1.8.1] Generating Ores
ikke009 wrote:well in the net.minecraft.src of coursethedirtyassassin wrote:ikke009 wrote:snip
but where do you put the class file?
To put what he said in other words, in the .jar or in a .zip in the mods folder.
EDIT: your not talking about the .class file, your talking about the .java file! The .java file goes in "MCPDIR/src/net/minecraft/src".
groxmapper- Member
- Posts : 27
Join date : 2011-10-24
Re: [1.8.1] Generating Ores
for exaple: if RARITY is 20, the worldgen will try to put the block 20 times per chunkikke009 wrote:how does the rarity work? if coal is 20, would diamond be higher or lower?
if its 3 it will try to place it 3 times per chunk. so diamond RARITY is lower
sammko- Member
- Posts : 5
Join date : 2011-11-01
Re: [1.8.1] Generating Ores
I have one question about this, what .java files exactly would you make? Like, would you make an mod_NameHere for the actual ore, and then make like another mod_WorldGenThingy and would that make the Item you created before automatically generate into the world?
One thing that saddens me is the small amount of descriptiveness Strength puts into his tutorials
One thing that saddens me is the small amount of descriptiveness Strength puts into his tutorials
GodSend- Member
- Posts : 2
Join date : 2011-11-15
Re: [1.8.1] Generating Ores
well you could, but you don't have to. basically what you do is put it in between the brackets
jesshankin22- Member
- Posts : 47
Join date : 2011-10-24
Re: [1.8.1] Generating Ores
Wait, I just figured it out. In the .java file you make for the block you include the whole world generation thingy for that block. Well, I'm recompiling and seeing if it worked.
GodSend- Member
- Posts : 2
Join date : 2011-11-15
Similar topics
» [Answered] Help with generating ores
» [1.8.1] Generating Properties File
» [Answered]Problem with ore generating
» [1.8.1] Generating Properties File
» [Answered]Problem with ore generating
MC Modding :: Modding :: Singleplayer Modding :: Tutorials
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum