[Answered]Nether generation
3 posters
MC Modding :: Modding :: Singleplayer Modding :: Requests
Page 1 of 1
[Answered]Nether generation
Could someone please do a tutorial on how to make an ore that randomly generates only in the nether? That would be great and help me a ton.
Last edited by the undecided t on Sun Nov 06, 2011 7:09 am; edited 1 time in total
Re: [Answered]Nether generation
I think you just needs to be changed, "GenerateSurface" to "GenerateNether"
KiraBee- Member
- Posts : 12
Join date : 2011-11-03
Age : 26
Location : Peru
Re: [Answered]Nether generation
This is what i want an answere too to
thedirtyassassin- Member
- Posts : 28
Join date : 2011-10-30
Location : In your dreams!
Re: [Answered]Nether generation
hey i think i got it
Save this as WorldGenNether.java
And then in the mod_NameHere.java change:
to:
Save this as WorldGenNether.java
- Code:
package net.minecraft.src;
import java.util.Random;
public class WorldGenNether extends WorldGenerator
{
public WorldGenNether(int i, int j)
{
minableBlockId = i;
numberOfBlocks = j;
}
public boolean generate(World world, Random random, int i, int j, int k)
{
float f = random.nextFloat() * 3.141593F;
double d = (float)(i + 8) + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F;
double d1 = (float)(i + 8) - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F;
double d2 = (float)(k + 8) + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F;
double d3 = (float)(k + 8) - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F;
double d4 = (j + random.nextInt(3)) - 2;
double d5 = (j + random.nextInt(3)) - 2;
for(int l = 0; l <= numberOfBlocks; l++)
{
double d6 = d + ((d1 - d) * (double)l) / (double)numberOfBlocks;
double d7 = d4 + ((d5 - d4) * (double)l) / (double)numberOfBlocks;
double d8 = d2 + ((d3 - d2) * (double)l) / (double)numberOfBlocks;
double d9 = (random.nextDouble() * (double)numberOfBlocks) / 16D;
double d10 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
double d11 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
int i1 = MathHelper.floor_double(d6 - d10 / 2D);
int j1 = MathHelper.floor_double(d7 - d11 / 2D);
int k1 = MathHelper.floor_double(d8 - d10 / 2D);
int l1 = MathHelper.floor_double(d6 + d10 / 2D);
int i2 = MathHelper.floor_double(d7 + d11 / 2D);
int j2 = MathHelper.floor_double(d8 + d10 / 2D);
for(int k2 = i1; k2 <= l1; k2++)
{
double d12 = (((double)k2 + 0.5D) - d6) / (d10 / 2D);
if(d12 * d12 >= 1.0D)
{
continue;
}
for(int l2 = j1; l2 <= i2; l2++)
{
double d13 = (((double)l2 + 0.5D) - d7) / (d11 / 2D);
if(d12 * d12 + d13 * d13 >= 1.0D)
{
continue;
}
for(int i3 = k1; i3 <= j2; i3++)
{
double d14 = (((double)i3 + 0.5D) - d8) / (d10 / 2D);
if(d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlockId(k2, l2, i3) == Block.netherrack.blockID)
{
world.setBlock(k2, l2, i3, minableBlockId);
}
}
}
}
}
return true;
}
private int minableBlockId;
private int numberOfBlocks;
}
And then in the mod_NameHere.java change:
- Code:
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int i = 0; i < 20; i++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(120);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_TheDirty.dirtyore.blockID, 30)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
to:
- Code:
public void GenerateNether(World world, Random random, int i, int j)
{
for(int 14 = 14; < 20; 14++)
{
int j7 = i + random.nextInt(16);
int k10 = random.nextInt(128);
int j13 = j + random.nextInt(16);
(new WorldGenNether(mod_NameHere.NameHere.blockID, 30)).generate(world, random, j7, k10, j13;
}
}
thedirtyassassin- Member
- Posts : 28
Join date : 2011-10-30
Location : In your dreams!
Re: [Answered]Nether generation
cool
no problem!
Glad i could help.
no problem!
Glad i could help.
thedirtyassassin- Member
- Posts : 28
Join date : 2011-10-30
Location : In your dreams!
Similar topics
» [Answered]Ore Generation Error
» [Answered] Tut on smelting
» [Answered]Reobfuscate
» [answered] Help with crashing
» [answered] What do i do when the coding is done?
» [Answered] Tut on smelting
» [Answered]Reobfuscate
» [answered] Help with crashing
» [answered] What do i do when the coding is done?
MC Modding :: Modding :: Singleplayer Modding :: Requests
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum