Jump to content

Why is my worldgens so rare?


Thor597

Recommended Posts

Ok im gonna get right to it.

 

I have some worldgens(The Ice Castle and the Icicles)

 

and their generating wayy to rarely, the ice castle is never found and the icicles i come across every 5 minutes and the dungeon has been found only 3 times while flying through the dimension

 

Code in chunkprovider:

 

/**
 * Populates chunk with ores etc etc
 */
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
{
	BiomeGenBase biome = worldObj.getWorldChunkManager().getBiomeGenAt(par2, par3);
	int i = par2 * 16;
	int j = par3 * 16;
	BlockSand.fallInstantly = true;
	BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(i + 16, j + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long l = (this.rand.nextLong() / 2L) * 2L + 1L;
	long l1 = (this.rand.nextLong() / 2L) * 2L + 1L;
	this.rand.setSeed((long)par2 * l + (long)par3 * l1 ^ this.worldObj.getSeed());
	boolean flag = false;
	int var6;
	int var7;
	int var8;
	int var9;
	int var10;

	for (var7 = 0; var7 < 6; ++var7)
	{
		int e = i + rand.nextInt(16);
		int r = rand.nextInt(128);
		int b = j + rand.nextInt(16);

		(new AC_GenDungeon()).generate(this.worldObj, this.rand, e, r, b);
	}

	if ((biome instanceof AC_BiomeFrostMountains)){

		for (int x = 0; x < 1; x++)
		{
			int e = i + rand.nextInt(16);
			int r = rand.nextInt(128);
			int b = j + rand.nextInt(16);
			(new AC_GenShip()).generate(worldObj, rand, e, r, b);       

		}
	}

	for (var7 = 0; var7 < 40; ++var7)
	  {
	   int e = i + rand.nextInt(16);
	   int r = rand.nextInt(128);
	   int b = j + rand.nextInt(16);

	   (new AC_GenIceCastle()).generate(this.worldObj, this.rand, e, r, b);
	}

	if ((biome instanceof AC_BiomeFrostMountains) || (biome instanceof AC_BiomeFrostForest))
	{
		var6 = this.rand.nextInt(this.rand.nextInt(14) + 1) + 1;


		for (var7 = 0; var7 < var6; var7++)
		{
			var8 = i + this.rand.nextInt(16) + 8;
			var9 = this.rand.nextInt(128);
			var10 = j + this.rand.nextInt(16) + 8;

			(new AC_GenArcaneStone1(mod_ArcticCraft.ArcaneStone.blockID, 16)).generate(this.worldObj, this.rand, var8, var9, var10);
		}

		for (var7 = 0; var7 < var6; var7++)
		{
			var8 = i + this.rand.nextInt(16) + 8;
			var9 = this.rand.nextInt(128);
			var10 = j + this.rand.nextInt(16) + 8;

			(new AC_GenArcaneStone2(mod_ArcticCraft.ArcaneStone.blockID, 16)).generate(this.worldObj, this.rand, var8, var9, var10);
		}
	}

	for(int x = 0; x < 1; x++)
	{
		int e = i + rand.nextInt(16);
		int r = rand.nextInt(128);
		int b = j + rand.nextInt(16);
		(new AC_GenMinable(mod_ArcticCraft.TektiteOre.blockID, 7, 0)).generate(worldObj, rand, e, r, b);
	}

	for(int x = 0; x < 2; x++)
	{
		int e = i + rand.nextInt(16);
		int r = rand.nextInt(128);
		int b = j + rand.nextInt(16);
		(new AC_GenMinable(mod_ArcticCraft.EscariaOre.blockID, 8, 0)).generate(worldObj, rand, e, r, b);
	}

	for(int x = 0; x < 3; x++)
	{
		int e = i + rand.nextInt(16);
		int r = rand.nextInt(128);
		int b = j + rand.nextInt(16);
		(new AC_GenMinable(mod_ArcticCraft.GlaciansOre.blockID, 8, 0)).generate(worldObj, rand, e, r, b);
	}

	for(int x = 0; x < 40; x++)
	{
		int e = i + rand.nextInt(16);
		int r = rand.nextInt(128);
		int b = j + rand.nextInt(16);
		(new AC_GenMinable(mod_ArcticCraft.FrigusOre.blockID, 20, 0)).generate(worldObj, rand, e, r, b);
	}

	for(int x = 0; x < 20; x++)
	{
		int e = i + rand.nextInt(16);
		int r = rand.nextInt(128);
		int b = j + rand.nextInt(16);
		(new AC_GenMinable(mod_ArcticCraft.RigentemOre.blockID, 8, 0)).generate(worldObj, rand, e, r, b);
	}

	var6 = this.rand.nextInt(this.rand.nextInt(14) + 1) + 1;

	for (var7 = 0; var7 < var6; var7++)
	{
		var8 = i + this.rand.nextInt(16) + 8;
		var9 = this.rand.nextInt(128);
		var10 = j + this.rand.nextInt(16) + 8;

		(new AC_GenIcicle()).generate(this.worldObj, this.rand, var8, var9, var10);
	}

	var6 = this.rand.nextInt(this.rand.nextInt(14) + 1) + 1;
	for (var7 = 0; var7 < var6; var7++)
	{
		var8 = i + this.rand.nextInt(16) + 8;
		var9 = this.rand.nextInt(128);
		var10 = j + this.rand.nextInt(16) + 8;

		(new AC_GenIcicle2()).generate(this.worldObj, this.rand, var8, var9, var10);
	}

	var6 = this.rand.nextInt(this.rand.nextInt(14) + 1) + 1;
	for (var7 = 0; var7 < var6; var7++)
	{
		var8 = i + this.rand.nextInt(16) + 8;
		var9 = this.rand.nextInt(128);
		var10 = j + this.rand.nextInt(16) + 8;

		(new AC_GenIcicle3()).generate(this.worldObj, this.rand, var8, var9, var10);
	}

	var6 = this.rand.nextInt(this.rand.nextInt(14) + 1) + 1;
	for (var7 = 0; var7 < var6; var7++)
	{
		var8 = i + this.rand.nextInt(16) + 8;
		var9 = this.rand.nextInt(128);
		var10 = j + this.rand.nextInt(16) + 8;

		(new AC_GenIcicle4()).generate(this.worldObj, this.rand, var8, var9, var10);
	}


	biomegenbase.decorate(this.worldObj, this.rand, i, j);
	SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand);
	i += 8;
	j += 8;

	for (int k1 = 0; k1 < 16; k1++)
	{
		for (int l2 = 0; l2 < 16; l2++)
		{
			int l3 = this.worldObj.getPrecipitationHeight(i + k1, j + l2);

			if (this.worldObj.isBlockFreezable(k1 + i, l3 - 1, l2 + j))
			{
				this.worldObj.setBlockWithNotify(k1 + i, l3 - 1, l2 + j, Block.ice.blockID);
			}

			if (this.worldObj.canSnowAt(k1 + i, l3, l2 + j))
			{
				this.worldObj.setBlockWithNotify(k1 + i, l3, l2 + j, Block.snow.blockID);
			}
		}
	}

	BlockSand.fallInstantly = false;
}

 

 

AC_GenDungeon

 

package net.minecraft.src;

import java.util.Random;

import net.minecraft.src.forge.MinecraftForge;

public class AC_GenDungeon extends WorldGenerator
{
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
	byte var6 = 3;
	int var7 = par2Random.nextInt(2) + 2;
	int var8 = par2Random.nextInt(2) + 2;
	int var9 = 0;
	int var10;
	int var11;
	int var12;

	for (var10 = par3 - var7 - 1; var10 <= par3 + var7 + 1; ++var10)
	{
		for (var11 = par4 - 1; var11 <= par4 + var6 + 1; ++var11)
		{
			for (var12 = par5 - var8 - 1; var12 <= par5 + var8 + 1; ++var12)
			{
				Material var13 = par1World.getBlockMaterial(var10, var11, var12);

				if (var11 == par4 - 1 && !var13.isSolid())
				{
					return false;
				}

				if (var11 == par4 + var6 + 1 && !var13.isSolid())
				{
					return false;
				}

				if ((var10 == par3 - var7 - 1 || var10 == par3 + var7 + 1 || var12 == par5 - var8 - 1 || var12 == par5 + var8 + 1) && var11 == par4 && par1World.isAirBlock(var10, var11, var12) && par1World.isAirBlock(var10, var11 + 1, var12))
				{
					++var9;
				}
			}
		}
	}

	if (var9 >= 1 && var9 <= 5)
	{
		for (var10 = par3 - var7 - 1; var10 <= par3 + var7 + 1; ++var10)
		{
			for (var11 = par4 + var6; var11 >= par4 - 1; --var11)
			{
				for (var12 = par5 - var8 - 1; var12 <= par5 + var8 + 1; ++var12)
				{
					if (var10 != par3 - var7 - 1 && var11 != par4 - 1 && var12 != par5 - var8 - 1 && var10 != par3 + var7 + 1 && var11 != par4 + var6 + 1 && var12 != par5 + var8 + 1)
					{
						par1World.setBlockWithNotify(var10, var11, var12, 0);
					}
					else if (var11 >= 0 && !par1World.getBlockMaterial(var10, var11 - 1, var12).isSolid())
					{
						par1World.setBlockWithNotify(var10, var11, var12, 0);
					}
					else if (par1World.getBlockMaterial(var10, var11, var12).isSolid())
					{
						if (var11 == par4 - 1 && par2Random.nextInt(4) != 0)
						{
							par1World.setBlockWithNotify(var10, var11, var12, mod_ArcticCraft.FrostMossyCobble.blockID);
						}
						else
						{
							par1World.setBlockWithNotify(var10, var11, var12, mod_ArcticCraft.FrostCobble.blockID);
						}
					}
				}
			}
		}

		var10 = 0;

		while (var10 < 2)
		{
			var11 = 0;

			while (true)
			{
				if (var11 < 3)
				{
					label210:
					{
					var12 = par3 + par2Random.nextInt(var7 * 2 + 1) - var7;
					int var14 = par5 + par2Random.nextInt(var8 * 2 + 1) - var8;

					if (par1World.isAirBlock(var12, par4, var14))
					{
						int var15 = 0;

						if (par1World.getBlockMaterial(var12 - 1, par4, var14).isSolid())
						{
							++var15;
						}

						if (par1World.getBlockMaterial(var12 + 1, par4, var14).isSolid())
						{
							++var15;
						}

						if (par1World.getBlockMaterial(var12, par4, var14 - 1).isSolid())
						{
							++var15;
						}

						if (par1World.getBlockMaterial(var12, par4, var14 + 1).isSolid())
						{
							++var15;
						}

						if (var15 == 1)
						{
							par1World.setBlockWithNotify(var12, par4, var14, Block.chest.blockID);
							TileEntityChest var16 = (TileEntityChest)par1World.getBlockTileEntity(var12, par4, var14);

							if (var16 != null)
							{
								for (int var17 = 0; var17 < MinecraftForge.getDungeonLootTries(); ++var17)
								{
									ItemStack var18 = MinecraftForge.getRandomDungeonLoot(par2Random);

									if (var18 != null)
									{
										var16.setInventorySlotContents(par2Random.nextInt(var16.getSizeInventory()), var18);
									}
								}
							}

							break label210;
						}
					}

					++var11;
					continue;
					}
				}

				++var10;
				break;
			}
		}

		par1World.setBlockWithNotify(par3, par4, par5, Block.mobSpawner.blockID);
		TileEntityMobSpawner var19 = (TileEntityMobSpawner)par1World.getBlockTileEntity(par3, par4, par5);

		if (var19 != null)
		{
			var19.setMobID(this.pickMobSpawner(par2Random));
		}
		else
		{
			System.err.println("Failed to fetch mob spawner entity at (" + par3 + ", " + par4 + ", " + par5 + ")");
		}

		return true;
	}
	else
	{
		return false;
	}
}

/**
 * Picks potentially a random item to add to a dungeon chest.
 */
private ItemStack pickCheckLootItem(Random par1Random)
{
	int var2 = par1Random.nextInt(11);

	return var2 == 0 ? new ItemStack(mod_ArcticCraft.cookedBoarMeat) : (var2 == 1 ? new ItemStack(mod_ArcticCraft.RigentemIngot, par1Random.nextInt(4) + 1)
	: (var2 == 2 ? new ItemStack(mod_ArcticCraft.GlacierFruit) : (var2 == 3 ? new ItemStack(mod_ArcticCraft.whiteBerrySeeds, par1Random.nextInt(4) + 1)
	: (var2 == 4 ? new ItemStack(Block.ice, par1Random.nextInt(4) + 1) : (var2 == 5 ? new ItemStack(Item.silk, par1Random.nextInt(4) + 1) :
		(var2 == 6 ? new ItemStack(Item.bucketEmpty) : (var2 == 7 && par1Random.nextInt(50) == 0 ? new ItemStack(Item.appleGold) :
			(var2 == 8 && par1Random.nextInt(2) == 0 ? new ItemStack(mod_ArcticCraft.FrigusGem, par1Random.nextInt(4) + 1)
			: (var2 == 9 && par1Random.nextInt(10) == 0 ? new ItemStack(Item.itemsList[item.record13.shiftedIndex + par1Random.nextInt(2)]) :
				(var2 == 11 && par1Random.nextInt(100) == 0 ? new ItemStack(mod_ArcticCraft.MysticalSnow) : null))))))))));
}

/**
 * Randomly decides which spawner to use in a dungeon
 */
private String pickMobSpawner(Random par1Random)
{
	int var2 = par1Random.nextInt(1);
	return var2 == 0 ? "IceCreeper" : "";
}
}

 

 

AC_GenIceCastle(I removed all the setBlock lines because theres sooo many)

 

package net.minecraft.src;
import java.util.Random;

public class AC_GenIceCastle extends WorldGenerator
{
protected int[] GetValidSpawnBlocks() {
	return new int[] {
		Block.ice.blockID
	};
}

public boolean LocationIsValidSpawn(World world, int i, int j, int k){
	int distanceToAir = 0;
	int checkID = world.getBlockId(i, j, k);

	while (checkID != 0){
		distanceToAir++;
		checkID = world.getBlockId(i, j + distanceToAir, k);
	}

	if (distanceToAir > 0){
		return false;
	}
	j += distanceToAir - 1;

	int blockID = world.getBlockId(i, j, k);
	int blockIDAbove = world.getBlockId(i, j+1, k);
	int blockIDBelow = world.getBlockId(i, j-1, k);
	for (int x : GetValidSpawnBlocks()){
		if (blockIDAbove != 0){
			return false;
		}
		if (blockID == x){
			return true;
		}else if (blockID == Block.snow.blockID && blockIDBelow == x){
			return true;
		}
	}
	return false;
}

public AC_GenIceCastle() { }

public boolean generate(World world, Random rand, int i, int j, int k) {
	//check that each corner is one of the valid spawn blocks
	if(!LocationIsValidSpawn(world, i, j, k) || !LocationIsValidSpawn(world, i + 47, j, k) || !LocationIsValidSpawn(world, i + 47, j, k + 65) || !LocationIsValidSpawn(world, i, j, k + 65))
	{
		return false;
	}

}

 

 

AC_GenIcicle(all the icicle ones are the same exept they have more icicles coming off the bottom)

 

/*
*** MADE BY MITHION'S .SCHEMATIC TO JAVA CONVERTING TOOLv0.1 ***
*/

package net.minecraft.src;
import java.util.Random;

import net.minecraft.src.forge.MinecraftForge;

public class AC_GenIcicle extends WorldGenerator
{
public AC_GenIcicle() { }

public boolean generate(World world, Random rand, int i, int j, int k) {

	if (!world.isAirBlock(i, j, k))
	{
		return false;
	}
	else if (world.getBlockId(i, j + 1, k) != mod_ArcticCraft.FrostStone.blockID)
	{
		return false;
	}

	int l = mod_ArcticCraft.Icicle.blockID;
	world.setBlockWithNotify(i, j, k, l);		
	return true;
}

}

 

 

Please Help!

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



×
×
  • Create New...

Important Information

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