EDIT: The generator for emerald changed quite a bit since Jeb re-added it in 12w22a. Here's the new analysis:
When Jeb re-added emerald ore to the generator, he added it in a different way. Here's the Extreme Hills (and Edge) biome generator class, apb.class as of 12w22a.
import java.util.Random;
public class apb extends ahw
{
protected apb(int i)
{
super(i);
}
public void a(acz acz1, Random random, int i, int j)
{
super.a(acz1, random, i, j);
int k = 3 + random.nextInt(6);
for(int l = 0; l < k; l++)
{
int i1 = i + random.nextInt(16);
int j1 = random.nextInt(28) + 4;
int k1 = j + random.nextInt(16);
int l1 = acz1.a(i1, j1, k1);
if(l1 == tg.t.bX)
acz1.d(i1, j1, k1, tg.bR.bX);
}
}
}
This is rather simple and no longer uses the standard ore generator. For each chunk, 3-8 times, a random coordinate is selected in the chunk. If that coordinate is stone, it is changed to emerald. This can happen anywhere between layers 4 and 31, inclusive.
This means there will be at most 8 emerald per chunk (the same as diamond), but it won't be in a single vein - it can be spread out all over the place. As Jeb said, this is meant to be a nice find, and trading is meant to be for getting emeralds, so it makes sense to have individual blocks of the ore just scattered around. Note that the ore, of course, will still only generate in Extreme Hills and Extreme Hills Edge biomes.
The information below is for historic purposes; it applies to 12w21b and is outdated.
----------------------------------------------------------------------------------------------------------------
Someone told me to make a thread about this, so I did.
I analyzed the code in 12w21b to figure out the rarity of emerald ore. I figured out the ore will only spawn in the biomes Extreme Hills and Extreme Hills Edge. Furthermore, veins of emerald are the same size as veins of lapis (slightly smaller than diamond; one block smaller on average? Someone who better understands the WorldGenMinable class can confirm this for me). Emerald will generate once per chunk, just like diamond and lapis. Emerald will generate between layers 4 and 31, inclusive.
Note that diamond generates between 0 and 15, inclusive, meaning it can fail to generate if it tries generating in the bedrock (only stone, not bedrock, can get replaced by ores). Since emerald generates higher up, and has a bigger range of generation, it's less likely to fall victim to bedrock, and thus there can be more emerald than diamond in a given chunk.
It's tough to guage the actual rarity of emerald. It's roughly the same as diamond, because it's less likely to get lost to bedrock, but veins are smaller. I've found some mountains in MCEdit where emerald is more common than diamond, and some mountains where it is rarer than diamond.
If you're hunting for emerald, bear in mind it can show up as high up as gold, and only exists in Extreme Hills and Extreme Hills Edge. Since it's spread over a larger height than diamond, it may be harder to find, but you don't have to go as deep to have a chance of finding it. Each ore block only drops 1 emerald, so you may want to use Fortune if you have it... Or Silk Touch to have one of the rarest blocks in SMP
Finally, here's my actual analysis of the code; feel free to correct me if I've somehow messed up anywhere:
---------------------------------------------------------------------------------------------------------------------
The BiomeDecorator, adx as of 12w21b, is unchanged. Here's something that is changed:
aou.java:
import java.util.Random;
public class aou extends ahq
{
protected aou(int i)
{
super(i);
R = new gf(tc.bR.bU, 6);
}
public void a(act act, Random random, int i, int j)
{
super.a(act, random, i, j);
int k = i + random.nextInt(16);
int l = random.nextInt(28) + 4;
int i1 = j + random.nextInt(16);
R.a(act, random, k, l, i1);
}
protected oo R;
}
gf is WorldGenMinable, and emerald initializes it with numberOfBlocks 6, the same as lapis. tc.bR is oreEmerald. aou is used for Extreme Hills and Extreme Hills Edge - it is BiomeGenHills. ahq is BiomeGenBase, and the overwritten a method is decorate. Normally, decorate is the following:
public void decorate(World par1World, Random par2Random, int par3, int par4)
{
biomeDecorator.decorate(par1World, par2Random, par3, par4);
}
That is, the normal generation settings for everything. This ordinary generation occurs once, before any emerald ore is even generated, thus all ores, dirt, etc., already exist. Note that ores normally generate before things such as sand and lakes generate, but after dirt and gravel (and only generate inside smoothstone).
The rest of the code in the overwritten method seems to be a copy of the code from BiomeDecorator's genStandardOre1. In this case, the equivalent call, placed in the BiomeDecorator class, would have been genStandardOre1(1, emeraldGen, 4, 32);. Compare with diamond's genStandardOre1(1, diamondGen, 0, 16);, and you'll see the code is attempting to generate emerald ores the same number of times per chunk as diamond (in other words, once), and instead of falling between layers 0 and 15, generation attempts will fall between 4 and 31.
No other biome generators reference tc.bR, thus the Extreme Hills and Extreme Hills Edge biomes are the only ones to generate emerald at all.
As he said, generally levels 4 - 31.
Everything he stated is correct after exploring a while.
I'm really happy at it's rarity, it's just the rarity I wanted.
alright people, screw diamonds, emeralds will be the new valuable trophy for servers.
Rollback Post to RevisionRollBack
if i behave weird in my post; it's not that i am weird actually. I like to pretend being weird just for the satisfaction of me and to make the community feel more normal. herpy herpy derp. btw, comic sans.
Gonna quote myself from the wiki's discussion page:
For a large area (sadly, MCEdit did not save how large it was), there were 6946 diamond ores and zero emerald ores. This was a diverse area, including plains, forests, jungles, taigas, tundras, and rivers. For size reference, it was an area containing 1746191 bedrock. Here's a screencap of the area: http://i1050.photobucket.com/albums/s412/WolfieMario/prettybigcropped.png
Notice the lack of Extreme Hills? I picked another area, containing only Extreme Hills, and it contained 208652 bedrock, 861 diamond ore, and 952 emerald ore.
Another area of Extreme Hills contained 180888 bedrock, 758 diamond ore, and 847 emerald ore.
There's almost 100 more emerald ore than diamond ore in these areas, so it's actually more common than diamond
Rivers will not contain emerald unless they cross through Extreme Hills, it seems. I suppose it's just a quirk in the terrain generation, but it's reassuring to know that rivers cutting through Extreme Hills do not lower the amount of emerald.
On a related note, I figured out why people kept insisting Jungles generate emerald ore. MCEdit lists both emerald ore and cocoa plants as "Future Block!", and these people must have gotten confused. However, MCEdit will also list the block ID, and only 129 corresponds to emerald ore.
Somebody was confused because they found some emerald in a river biome - turns out that can happen, but only if the river cuts through extreme hills. Also, some people thought jungles had emeralds, because they didn't realize MCEdit also displays cocoa plants as "Future Block".
Well this is all unfortunate to hear, as I happen to believe that the Extreme Hills biome is Satan incarnate.
I hope the Emerald Ores will be increased to Lapis Lazuli frequency or around that. I want to see economy become the third sort of aspect to Minecraft, next to crafting and adventuring of course. Shops, price fluctuations and NPC villages acting in sort of countries or some sort are all additions I'd be welcomed to. Judging by the discussion forum though, the backlash would be immense.
Someone told me to make a thread about this, so I did.
I analyzed the code in 12w21b to figure out the rarity of emerald ore. I figured out the ore will only spawn in the biomes Extreme Hills and Extreme Hills Edge. Furthermore, veins of emerald are the same size as veins of lapis (slightly smaller than diamond; one block smaller on average? Someone who better understands the WorldGenMinable class can confirm this for me). Emerald will generate once per chunk, just like diamond and lapis. Emerald will generate between layers 4 and 31, inclusive.
Note that diamond generates between 0 and 15, inclusive, meaning it can fail to generate if it tries generating in the bedrock (only stone, not bedrock, can get replaced by ores). Since emerald generates higher up, and has a bigger range of generation, it's less likely to fall victim to bedrock, and thus there can be more emerald than diamond in a given chunk.
It's tough to guage the actual rarity of emerald. It's roughly the same as diamond, because it's less likely to get lost to bedrock, but veins are smaller. I've found some mountains in MCEdit where emerald is more common than diamond, and some mountains where it is rarer than diamond.
If you're hunting for emerald, bear in mind it can show up as high up as gold, and only exists in Extreme Hills and Extreme Hills Edge. Since it's spread over a larger height than diamond, it may be harder to find, but you don't have to go as deep to have a chance of finding it. Each ore block only drops 1 emerald, so you may want to use Fortune if you have it... Or Silk Touch to have one of the rarest blocks in SMP
Finally, here's my actual analysis of the code; feel free to correct me if I've somehow messed up anywhere:
---------------------------------------------------------------------------------------------------------------------
The BiomeDecorator, adx as of 12w21b, is unchanged. Here's something that is changed:
aou.java:
import java.util.Random;
public class aou extends ahq
{
protected aou(int i)
{
super(i);
R = new gf(tc.bR.bU, 6);
}
public void a(act act, Random random, int i, int j)
{
super.a(act, random, i, j);
int k = i + random.nextInt(16);
int l = random.nextInt(28) + 4;
int i1 = j + random.nextInt(16);
R.a(act, random, k, l, i1);
}
protected oo R;
}
gf is WorldGenMinable, and emerald initializes it with numberOfBlocks 6, the same as lapis. tc.bR is oreEmerald. aou is used for Extreme Hills and Extreme Hills Edge - it is BiomeGenHills. ahq is BiomeGenBase, and the overwritten a method is decorate. Normally, decorate is the following:
public void decorate(World par1World, Random par2Random, int par3, int par4)
{
biomeDecorator.decorate(par1World, par2Random, par3, par4);
}
That is, the normal generation settings for everything. This ordinary generation occurs once, before any emerald ore is even generated, thus all ores, dirt, etc., already exist. Note that ores normally generate before things such as sand and lakes generate, but after dirt and gravel (and only generate inside smoothstone).
The rest of the code in the overwritten method seems to be a copy of the code from BiomeDecorator's genStandardOre1. In this case, the equivalent call, placed in the BiomeDecorator class, would have been genStandardOre1(1, emeraldGen, 4, 32);. Compare with diamond's genStandardOre1(1, diamondGen, 0, 16);, and you'll see the code is attempting to generate emerald ores the same number of times per chunk as diamond (in other words, once), and instead of falling between layers 0 and 15, generation attempts will fall between 4 and 31.
No other biome generators reference tc.bR, thus the Extreme Hills and Extreme Hills Edge biomes are the only ones to generate emerald at all.
Thnaks, i love knowing all the mechanics of mincraft. Its a weird hobey.
how did you get the code? i thought mcp hasent updated for 12w21, i checked and its only 12w17a
Where do you think the MCP team get the code from?
I used 7zip to extract the class files from the 12w21b jar, and used JAD (JAva Decompiler, a free program) to decompile them myself. Of course, the code is obfuscated, meaning all variable names, etc., have been changed to make it hard to read (not to mention, since all class names are different, it would be a nightmare to even find the class you're looking for, if you just checked one-by-one).
There are ways to find a specific class's obfuscated equivalent, however. I created a new project in my MCP Eclipse workspace, containing the obfuscated classes. Eclipse lets you search all files in your workspace using Ctrl+H, with the File Search tab.
Now, what to search for, you ask? If you're lucky, and the class you're looking for contains raw strings (classes which throw special exceptions and classes such as Blocks are examples), you can simply search for that raw string. Stuff like "oreDiamond" can't get obfuscated, or the code might not function correctly, hence raw strings are never obfuscated. Because of this, you can easily track down any class where you see blue text in quotes
Of course, the vast majority of classes don't give you this luxury. It seems, however, that methods and variables are always obfuscated the same, even though class names are not (I may be wrong on this, but it worked for me). To track down BiomeDecorator, I used MCP to obfuscate the class (reobfuscate.bat will look for changed files in the bin directory, and it seems a different "Date Modified" is all it takes for it to think a file has been changed... Even if the contents are the same ). I searched for the obfuscated call "a(20, i, 0, 128);" (that's genStandardOre1(20, dirtGen, 0, 128); when not obfuscated), and it found the same exact code in the 12w21b class for BiomeDecorator.
So basically, you can get MCP to obfuscate the class you're looking for, and search for a line of code from it that has no class names (since, from what I can tell, class names are the only thing that change between different versions' obfuscations). This may not always work - if new methods or variables are added in the same class, then existing variables and methods may be obfuscated differently.
Finally, if you can't find a specific class no matter what you search for, you can try tracking it down by its relationships. Does this class have any child classes? Are there any other classes that reference this class? If you can find the obfuscated versions of one of those classes, you can just find where that class references the class you want, Ctrl-click it in Eclipse, and you have the class you were looking for . For example, to find a specific BiomeGen class, you can first find BiomeGenBase (easy, since it contains raw strings), and then you have access to all the BiomeGen classes it references.
When Jeb re-added emerald ore to the generator, he added it in a different way. Here's the Extreme Hills (and Edge) biome generator class, apb.class as of 12w22a.
This is rather simple and no longer uses the standard ore generator. For each chunk, 3-8 times, a random coordinate is selected in the chunk. If that coordinate is stone, it is changed to emerald. This can happen anywhere between layers 4 and 31, inclusive.
This means there will be at most 8 emerald per chunk (the same as diamond), but it won't be in a single vein - it can be spread out all over the place. As Jeb said, this is meant to be a nice find, and trading is meant to be for getting emeralds, so it makes sense to have individual blocks of the ore just scattered around. Note that the ore, of course, will still only generate in Extreme Hills and Extreme Hills Edge biomes.
The information below is for historic purposes; it applies to 12w21b and is outdated.
----------------------------------------------------------------------------------------------------------------
Someone told me to make a thread about this, so I did.
I analyzed the code in 12w21b to figure out the rarity of emerald ore. I figured out the ore will only spawn in the biomes Extreme Hills and Extreme Hills Edge. Furthermore, veins of emerald are the same size as veins of lapis (slightly smaller than diamond; one block smaller on average? Someone who better understands the WorldGenMinable class can confirm this for me). Emerald will generate once per chunk, just like diamond and lapis. Emerald will generate between layers 4 and 31, inclusive.
Note that diamond generates between 0 and 15, inclusive, meaning it can fail to generate if it tries generating in the bedrock (only stone, not bedrock, can get replaced by ores). Since emerald generates higher up, and has a bigger range of generation, it's less likely to fall victim to bedrock, and thus there can be more emerald than diamond in a given chunk.
It's tough to guage the actual rarity of emerald. It's roughly the same as diamond, because it's less likely to get lost to bedrock, but veins are smaller. I've found some mountains in MCEdit where emerald is more common than diamond, and some mountains where it is rarer than diamond.
If you're hunting for emerald, bear in mind it can show up as high up as gold, and only exists in Extreme Hills and Extreme Hills Edge. Since it's spread over a larger height than diamond, it may be harder to find, but you don't have to go as deep to have a chance of finding it. Each ore block only drops 1 emerald, so you may want to use Fortune if you have it... Or Silk Touch to have one of the rarest blocks in SMP
Finally, here's my actual analysis of the code; feel free to correct me if I've somehow messed up anywhere:
---------------------------------------------------------------------------------------------------------------------
The BiomeDecorator, adx as of 12w21b, is unchanged. Here's something that is changed:
aou.java:
gf is WorldGenMinable, and emerald initializes it with numberOfBlocks 6, the same as lapis. tc.bR is oreEmerald.
aou is used for Extreme Hills and Extreme Hills Edge - it is BiomeGenHills.
ahq is BiomeGenBase, and the overwritten a method is decorate. Normally, decorate is the following:
That is, the normal generation settings for everything. This ordinary generation occurs once, before any emerald ore is even generated, thus all ores, dirt, etc., already exist. Note that ores normally generate before things such as sand and lakes generate, but after dirt and gravel (and only generate inside smoothstone).
The rest of the code in the overwritten method seems to be a copy of the code from BiomeDecorator's genStandardOre1. In this case, the equivalent call, placed in the BiomeDecorator class, would have been genStandardOre1(1, emeraldGen, 4, 32);. Compare with diamond's genStandardOre1(1, diamondGen, 0, 16);, and you'll see the code is attempting to generate emerald ores the same number of times per chunk as diamond (in other words, once), and instead of falling between layers 0 and 15, generation attempts will fall between 4 and 31.
No other biome generators reference tc.bR, thus the Extreme Hills and Extreme Hills Edge biomes are the only ones to generate emerald at all.
Marv
Great. What level?
Marv
Sonic: Emerald Hill Zone
Everything he stated is correct after exploring a while.
I'm really happy at it's rarity, it's just the rarity I wanted.
Marv
Somebody was confused because they found some emerald in a river biome - turns out that can happen, but only if the river cuts through extreme hills. Also, some people thought jungles had emeralds, because they didn't realize MCEdit also displays cocoa plants as "Future Block".
I hope the Emerald Ores will be increased to Lapis Lazuli frequency or around that. I want to see economy become the third sort of aspect to Minecraft, next to crafting and adventuring of course. Shops, price fluctuations and NPC villages acting in sort of countries or some sort are all additions I'd be welcomed to. Judging by the discussion forum though, the backlash would be immense.
Thnaks, i love knowing all the mechanics of mincraft. Its a weird hobey.
Where do you think the MCP team get the code from?
I used 7zip to extract the class files from the 12w21b jar, and used JAD (JAva Decompiler, a free program) to decompile them myself. Of course, the code is obfuscated, meaning all variable names, etc., have been changed to make it hard to read (not to mention, since all class names are different, it would be a nightmare to even find the class you're looking for, if you just checked one-by-one).
There are ways to find a specific class's obfuscated equivalent, however. I created a new project in my MCP Eclipse workspace, containing the obfuscated classes. Eclipse lets you search all files in your workspace using Ctrl+H, with the File Search tab.
Now, what to search for, you ask? If you're lucky, and the class you're looking for contains raw strings (classes which throw special exceptions and classes such as Blocks are examples), you can simply search for that raw string. Stuff like "oreDiamond" can't get obfuscated, or the code might not function correctly, hence raw strings are never obfuscated. Because of this, you can easily track down any class where you see blue text in quotes
Of course, the vast majority of classes don't give you this luxury. It seems, however, that methods and variables are always obfuscated the same, even though class names are not (I may be wrong on this, but it worked for me). To track down BiomeDecorator, I used MCP to obfuscate the class (reobfuscate.bat will look for changed files in the bin directory, and it seems a different "Date Modified" is all it takes for it to think a file has been changed... Even if the contents are the same ). I searched for the obfuscated call "a(20, i, 0, 128);" (that's genStandardOre1(20, dirtGen, 0, 128); when not obfuscated), and it found the same exact code in the 12w21b class for BiomeDecorator.
So basically, you can get MCP to obfuscate the class you're looking for, and search for a line of code from it that has no class names (since, from what I can tell, class names are the only thing that change between different versions' obfuscations). This may not always work - if new methods or variables are added in the same class, then existing variables and methods may be obfuscated differently.
Finally, if you can't find a specific class no matter what you search for, you can try tracking it down by its relationships. Does this class have any child classes? Are there any other classes that reference this class? If you can find the obfuscated versions of one of those classes, you can just find where that class references the class you want, Ctrl-click it in Eclipse, and you have the class you were looking for . For example, to find a specific BiomeGen class, you can first find BiomeGenBase (easy, since it contains raw strings), and then you have access to all the BiomeGen classes it references.