Jump to content

[1.7.10] Game lags a ton when generating blocks in the sky


Eternaldoom

Recommended Posts

Hi,

 

A dimension for a mod I'm working on requires worldgen in the sky. XolovA (the creator of the mod) apparently had to remove two dimensions from his new mod for this reason. He said that Forge changed how chunks are generated and split it into four vertical sections. The chunks are generating fine, but the worldgen is making the game completely unplayable. Do you know of a way to fix this?

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

The ChunkProvider:

public class ChunkProviderVethea implements IChunkProvider {

private Random rand;
private NoiseGeneratorOctaves noiseGen1;
private NoiseGeneratorOctaves noiseGen2;
private NoiseGeneratorOctaves noiseGen3;
private NoiseGeneratorPerlin noiseGen4;
public NoiseGeneratorOctaves noiseGen5;
public NoiseGeneratorOctaves noiseGen6;
public NoiseGeneratorOctaves mobSpawnerNoise;
private World worldObj;
private double[] noiseArray;
private double[] stoneNoise = new double[256];
private MapGenBase caveGenerator = new MapGenFloorCrystals();
private BiomeGenBase[] biomesForGeneration;
private final ArrayList<WorldGenerator> items;
private final ArrayList<WorldGenerator> lamps;
private final ArrayList<WorldGenerator> floatingTrees;
private final ArrayList<WorldGenerator> crypts;
private final ArrayList<WorldGenerator> l1Trees;
private final ArrayList<WorldGenerator> pyramids;
private final ArrayList<WorldGenerator> l2Trees;
private final ArrayList<WorldGenerator> l3Trees;
private final ArrayList<WorldGenerator> l4Trees;
private final ArrayList<WorldGenerator> l3Altars;
private final ArrayList<WorldGenerator> l4Altars;
//private final WorldGenerator layer3TreeBig;
private final WorldGenConeUp ceilingTexture;
private final WorldGenerator pillar;
private final WorldGenerator cracklespikes;
private final WorldGenerator fernites;
private final WorldGenerator bulatobes;
private final WorldGenerator shinegrass;
//private final WorldGenerator shimmers;
//private final WorldGenerator dreamglows;
private final WorldGenerator greenGemTops;
//private final WorldGenerator purpleGemTops;
private final WorldGenerator yellowDulahs;
private final WorldGenerator greenDulahs;
private final WorldGenerator infusion;

double[] noise3;
double[] noise1;
double[] noise2;
double[] noise5;
double[] noise6;

float[] parabolicField;
int[][] field_73219_j = new int[32][32];

public ChunkProviderVethea(World par1World, long par2) {
	this.worldObj = par1World;
	this.rand = new Random(par2);
	this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16);
	this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16);
	this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, ;
	this.noiseGen4 = new NoiseGeneratorPerlin(this.rand, 4);
	this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
	this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
	this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, ;

	NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise};
	this.noiseGen4 = (NoiseGeneratorPerlin)noiseGens[3];
	this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6];

	this.items = new ArrayList(;
	items.add(new Bow());
	items.add(new Hook());
	items.add(new Mushroom());
	items.add(new Pickaxe());
	items.add(new Pointedsquare());
	items.add(new Ring());
	items.add(new Sword());
	items.add(new Trident());

	this.lamps = new ArrayList(2);
	lamps.add(new Lamp1());
	lamps.add(new Lamp2());

	this.floatingTrees = new ArrayList(7);
	floatingTrees.add(new TreeFloating1());
	floatingTrees.add(new TreeFloating2());
	floatingTrees.add(new TreeFloating3());
	floatingTrees.add(new FloatingTree4());
	floatingTrees.add(new FloatingTree5());
	floatingTrees.add(new FloatingTree6());
	floatingTrees.add(new FloatingTree7());

	this.l1Trees = new ArrayList(3);
	l1Trees.add(new Tree4());
	l1Trees.add(new Tree5());
	l1Trees.add(new Tree6());

	this.l2Trees = new ArrayList(2);
	l1Trees.add(new Tree3());
	l1Trees.add(new Tree6());

	this.crypts = new ArrayList(2);
	crypts.add(new Crypt1());
	crypts.add(new Crypt2());     

	ceilingTexture = new WorldGenConeUp();
	pillar = new WorldGenVetheanPillar();
	infusion = new InfusionOutpost();

	this.pyramids = new ArrayList(3);
	pyramids.add(new Pyramid1());
	pyramids.add(new Pyramid2());
	pyramids.add(new HiveNest());

	this.l3Trees = new ArrayList(3);
	l3Trees.add(new Tree7());
	l3Trees.add(new Tree8());
	l3Trees.add(new WorldGenLayer3SmallTree(false));

	this.l3Altars = new ArrayList(2);
	l3Altars.add(new QuadroticPost());
	l3Altars.add(new KarosMadhouse());

	this.l4Altars = new ArrayList(3);
	l4Altars.add(new Evergarden());
	l4Altars.add(new RaglokChamber());
	l4Altars.add(new WreckHall());

	this.l4Trees = new ArrayList(2);
	l4Trees.add(new Tree1());
	l4Trees.add(new Tree2());


	//layer3TreeBig = new WorldGenLayer3BigTree(false);

	cracklespikes = new WorldGenVetheanFlower(VetheaBlocks.cracklespike);
	fernites = new WorldGenVetheanFlower(VetheaBlocks.fernite);
	bulatobes = new WorldGenVetheanFlower(VetheaBlocks.bulatobe);
	shinegrass = new WorldGenVetheanFlower(VetheaBlocks.shineGrass);
	//shimmers = new WorldGenVetheanFlower(VetheaBlocks.shimmer);
	//dreamglows = new WorldGenVetheanFlower(VetheaBlocks.dreamglow);
	greenGemTops = new WorldGenVetheanFlower(VetheaBlocks.gemtopGreen);
	//purpleGemTops = new WorldGenVetheanFlower(VetheaBlocks.gemtopPurple);
	yellowDulahs = new WorldGenVetheanFlower(VetheaBlocks.yellowDulah);
	greenDulahs = new WorldGenVetheanFlower(VetheaBlocks.greenDulah);

}

public void generateTerrain(int i, int j, Block[] b) {
	for(int column = 0; column < 256; column++){
		for(int vert = 0; vert < 256; vert++){
			if((vert>0 && vert<16) || (vert>48 && vert < 64) || (vert>96 && vert<112) || (vert>144 && vert<160))b[vert+(column*256)] = VetheaBlocks.dreamStone;
		}
	}
}

private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) {
	ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY)
		return event.noisefield;

	if (par1ArrayOfDouble == null) {
		par1ArrayOfDouble = new double[par5 * par6 * par7];
	}

	if (this.parabolicField == null) {
		this.parabolicField = new float[25];

		for (int var8 = -2; var8 <= 2; ++var8) {
			for (int var9 = -2; var9 <= 2; ++var9) {
				float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F);
				this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10;
			}
		}
	}

	double var44 = 684.412D;
	double var45 = 684.412D;
	this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par3, par4, par5, par6, par7, var44, var45, var44);
	this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par3, par4, par5, par6, par7, var44, var45, var44);
	this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44, var45, var44);
	this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44);
	this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44);
	boolean var43 = false;
	boolean var42 = false;
	int var12 = 0;
	int var13 = 0;

	for (int var14 = 0; var14 < par5; ++var14) {
		for (int var15 = 0; var15 < par7; ++var15) {
			float var16 = 0.0F;
			float var17 = 0.0F;
			float var18 = 0.0F;
			byte var19 = 2;
			BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)];

			for (int var21 = -var19; var21 <= var19; ++var21) {
				for (int var22 = -var19; var22 <= var19; ++var22) {
					BiomeGenBase var23 = this.biomesForGeneration[var14 + var21 + 2 + (var15 + var22 + 2) * (par5 + 5)];
					float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (var23.rootHeight + 2.0F);

					if (var23.rootHeight > var20.heightVariation) {
						var24 /= 3.0F;
					}

					var16 += var23.rootHeight * var24;
					var17 += var23.rootHeight * var24;
					var18 += var24;
				}
			}

			var16 /= var18;
			var17 /= var18;
			var16 = var16 * 0.9F + 0.1F;
			var17 = (var17 * 4.0F - 1.0F) / 8.0F;
			double var47 = this.noise6[var13] / 8000.0D;

			if (var47 < 0.0D) {
				var47 = -var47 * 0.3D;
			}

			var47 = var47 * 3.0D - 2.0D;

			if (var47 < 0.0D) {
				var47 /= 2.0D;

				if (var47 < -1.0D) {
					var47 = -1.0D;
				}

				var47 /= 1.4D;
				var47 /= 2.0D;
			} else {
				if (var47 > 1.0D) {
					var47 = 1.0D;
				}

				var47 /= 8.0D;
			}

			++var13;

			for (int var46 = 0; var46 < par6; ++var46) {
				double var48 = (double)var17;
				double var26 = (double)var16;
				var48 += var47 * 0.2D;
				var48 = var48 * (double)par6 / 16.0D;
				double var28 = (double)par6 / 2.0D + var48 * 4.0D;
				double var30 = 0.0D;
				double var32 = ((double)var46 - var28) * 12.0D * 128.0D / 128.0D / var26;

				if (var32 < 0.0D) {
					var32 *= 4.0D;
				}

				double var34 = this.noise1[var12] / 512.0D;
				double var36 = this.noise2[var12] / 512.0D;
				double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D;

				if (var38 < 0.0D) {
					var30 = var34;
				}
				else if (var38 > 1.0D) {
					var30 = var36;
				} else {
					var30 = var34 + (var36 - var34) * var38;
				}

				var30 -= var32;

				if (var46 > par6 - 4) {
					double var40 = (double)((float)(var46 - (par6 - 4)) / 3.0F);
					var30 = var30 * (1.0D - var40) + -10.0D * var40;
				}

				par1ArrayOfDouble[var12] = var30;
				++var12;
			}
		}
	}

	return par1ArrayOfDouble;
}

public void replaceBlocksForBiome(int i, int j, Block[] ba, byte[] by, BiomeGenBase[] b) {
	double d0 = 0.03125D;
	this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (double)(i * 16), (double)(j * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

	for(int k = 0; k < 16; ++k) {
		for(int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = b[l + k * 16];
			genBiomeTerrain(this.worldObj, this.rand, ba, by, i * 16 + k, j * 16 + l, this.stoneNoise[l + k * 16], biomegenbase);
		}
	}
}

public final void genBiomeTerrain(World p_150560_1_, Random p_150560_2_, Block[] p_150560_3_, byte[] p_150560_4_, int p_150560_5_, int p_150560_6_, double p_150560_7_, BiomeGenBase b) {
	boolean flag = true;
	Block block = b.topBlock;
	byte b0 = (byte)(b.field_150604_aj & 255);
	Block block1 = b.fillerBlock;
	int k = -1;
	int l = (int)(p_150560_7_ / 3.0D + 3.0D + p_150560_2_.nextDouble() * 0.25D);
	int i1 = p_150560_5_ & 15;
	int j1 = p_150560_6_ & 15;
	int k1 = p_150560_3_.length / 256;

	for (int l1 = 255; l1 >= 0; --l1) {
		int i2 = (j1 * 16 + i1) * k1 + l1;

		if (l1 <= 0 + p_150560_2_.nextInt(5)) {
			p_150560_3_[i2] = VetheaBlocks.dreamStone;
		} else {
			Block block2 = p_150560_3_[i2];

			if (block2 != null && block2.getMaterial() != Material.air) {
				if (block2 == VetheaBlocks.dreamStone) {
					if (k == -1) {
						if (l <= 0) {
							block = null;
							b0 = 0;
							block1 = VetheaBlocks.dreamStone;
						}
						else if (l1 >= 59 && l1 <= 64) {
							block = b.topBlock;
							b0 = (byte)(b.field_150604_aj & 255);
							block1 = b.topBlock;
						}

						if (l1 < 63 && (block == null || block.getMaterial() == Material.air)) {
							if (b.getFloatTemperature(p_150560_5_, l1, p_150560_6_) < 0.15F) {
								block = b.topBlock;
								b0 = 0;
							}
						}

						k = l;

						if (l1 >= 62) {
							p_150560_3_[i2] = block;
							p_150560_4_[i2] = b0;
						}
						else if (l1 < 56 - l) {
							block = null;
							block1 = b.topBlock;
							p_150560_3_[i2] = b.topBlock;
						} else {
							p_150560_3_[i2] = block1;
						}
					}
					else if (k > 0) {
						--k;
						p_150560_3_[i2] = block1;

						if (k == 0 && block1 == VetheaBlocks.dreamStone) {
							k = p_150560_2_.nextInt(4) + Math.max(0, l1 - 63);
							block1 = VetheaBlocks.dreamStone;
						}
					}
				}
			} else {
				k = -1;
			}
		}
	}
}

@Override
public Chunk loadChunk(int par1, int par2) {
	return this.provideChunk(par1, par2);
}

@Override
public Chunk provideChunk(int par1, int par2) {
	this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
	Block[] block = new Block[65536];
	byte[] by = new byte[65536];
	this.generateTerrain(par1, par2, block);
	this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
	this.replaceBlocksForBiome(par1, par2, block, by, this.biomesForGeneration);
	Chunk var4 = new Chunk(this.worldObj, block, by, par1, par2);
	byte[] var5 = var4.getBiomeArray();
	for (int var6 = 0; var6 < var5.length; ++var6) {
		var5[var6] = (byte)this.biomesForGeneration[var6].biomeID;
	}

	var4.generateSkylightMap();
	return var4;
}

public boolean chunkExists(int par1, int par2) {
	return true;
}

@Override
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {

	int var4 = par2 * 16;
	int var5 = par3 * 16;
	BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16);
	this.rand.setSeed(this.worldObj.getSeed());
	long var7 = this.rand.nextLong() / 2L * 2L + 1L;
	long var9 = this.rand.nextLong() / 2L * 2L + 1L;
	this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed());
	boolean var11 = false;
	int var12;
	int var13;
	int var14;


	for (int i = 0; i < 3; i++) {
		var12 = var4 + this.rand.nextInt(16) + 8;
		var13 = 64;

		var14 = var5 + this.rand.nextInt(16) + 8;
		(new WorldGenConeUp()).generate(this.worldObj, this.rand, var12, var13, var14, this.rand.nextInt(3)+1);
	}

	//greenGemTops.generate(worldObj, rand, var4, 0, var5);
			//purpleGemTops.generate(worldObj, rand, var4, 0, var5);
			//yellowDulahs.generate(worldObj, rand, var4, 0, var5);
			//greenDulahs.generate(worldObj, rand, var4, 0, var5);

			if (this.rand.nextInt(16) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20 - this.rand.nextInt(2);
				var14 = var5 + this.rand.nextInt(16) + 8;
				(new WorldGenVetheanPillar()).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			for(int i = 0; i < 2; i++) {
				var12 = 16;
				var13 = 20;
				var14 = 16;
				(new WorldGenMinable(VetheaBlocks.dreamGrass, 16, VetheaBlocks.dreamStone)).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			for(int i = 0; i < 1; i++) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = rand.nextInt(256);
				var14 = var5 + this.rand.nextInt(16) + 8;
				(new WorldGenMinable(VetheaBlocks.fireCrystal, 90, VetheaBlocks.dreamGrass)).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(32) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(this.worldObj.isAirBlock(var12, var13, var14))
					var13--;
				infusion.generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(32) == 0) {
	            var12 = var4 + this.rand.nextInt(16);
	            var13 = 20 - this.rand.nextInt(2);
	            var14 = var5 + this.rand.nextInt(16);
	            (this.items.get(this.rand.nextInt(7))).generate(this.worldObj, this.rand, var12, var13, var14);
	        }

			for (int i = 0; i < 1; ++i) {
	            var12 = var4 + this.rand.nextInt(16) + 8;
	            var13 = 30;
	            var14 = var5 + this.rand.nextInt(16) + 8;
	            (this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, this.rand, var12, var13, var14);
	        }

	        if (this.rand.nextInt(2) == 0) {
	            var12 = var4 + this.rand.nextInt(16) + 8;
	            var13 = 20;
	            var14 = var5 + this.rand.nextInt(16) + 8;
	            (this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);
	        }
	        
	        if (this.rand.nextInt(500) == 0) {
	            var12 = var4 + this.rand.nextInt(16) + 8;
	            var13 = 40;
	            var14 = var5 + this.rand.nextInt(16) + 8;
	            (new WorldGenVillageIsland()).generate(this.worldObj, this.rand, var12, var13, var14);//TODO add hunger
	        }

	        for (int i = 0; i < 1; i++) {
	            var12 = var4 + this.rand.nextInt(16) + 8;
	            var13 = 20;
	            var14 = var5 + this.rand.nextInt(16) + 8;
	            (new WorldGenLayer1Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);
	        }
	        
	        if (this.rand.nextInt(250) == 0) {
	            var12 = var4 + this.rand.nextInt(16) + 8;
	            var13 = 15;
	            var14 = var5 + this.rand.nextInt(16) + 8;
	            (crypts.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13, var14);//TODO add crypt keeper
	        }
	        
	        if (this.rand.nextInt(250) == 0) {
	            var12 = var4 + this.rand.nextInt(16) + 8;
	            var13 = 15;
	            var14 = var5 + this.rand.nextInt(16) + 8;
	            (l1Trees.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13, var14);
	        }
	        
			/*
			 * Layer 2
			 */
			for (int i = 0; i < 3; i++) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 128;
				var14 = var5 + this.rand.nextInt(16) + 8;
				 (ceilingTexture).generate(this.worldObj, this.rand, var12, var13, var14, this.rand.nextInt(3)+1);
			}

			if (this.rand.nextInt(16) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 84 - this.rand.nextInt(2);
				var14 = var5 + this.rand.nextInt(16) + 8;
				pillar.generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if(this.rand.nextInt(32) == 0) {
				var12 = var4 + rand.nextInt(16);
				var13 = 84;
				var14 = var5 + rand.nextInt(16);
				(this.items.get(this.rand.nextInt(6))).generate(this.worldObj, rand, var12, var13, var14);
			}

			if (this.rand.nextInt(32) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 85;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(this.worldObj.isAirBlock(var12, var13, var14)) {
					var13--;
				}
				infusion.generate(this.worldObj, this.rand, var12, var13, var14);
			}

			for (int i = 0; i < 3; ++i) {
				var12 = var4 + this.rand.nextInt(16);
				var13 = 90;
				var14 = var5 + this.rand.nextInt(16);
				(this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, rand, var12, var13, var14);
			}

			if (this.rand.nextInt(2) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 80;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(!this.worldObj.isAirBlock(var12, var13, var14)) {
					var13++;
				}
				 (this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);
			}

			if (this.rand.nextInt(250) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 80;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(!this.worldObj.isAirBlock(var12, var13, var14)) {
					var13++;
				}
				(pyramids.get(this.rand.nextInt(3))).generate(this.worldObj, this.rand, var12, var13, var14);//Add the mobs
			}

			for (int i = 0; i < 3; i++) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 84;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(new WorldGenLayer2Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20 + 64;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(fernites).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20 + 64;
				var14 = var5 + this.rand.nextInt(16) + 8;
				//(dreamglows).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20 + 64;
				var14 = var5 + this.rand.nextInt(16) + 8;
				//(shimmers).generate(this.worldObj, this.rand, var12, var13, var14);
			}


			/*
			  * layer 3
			  */
			for (int i = 0; i < 3; i++) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 192;
				var14 = var5 + this.rand.nextInt(16) + 8;
				//(ceilingTexture).generate(this.worldObj, this.rand, var12, var13, var14, this.rand.nextInt(3)+1);
			}

			if (this.rand.nextInt(16) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 148;
				var14 = var5 + this.rand.nextInt(16) + 8;
				pillar.generate(this.worldObj, this.rand, var12, var13, var14);
			}

			for (int i = 0; i < 3; i++) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 148;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(new WorldGenLayer1Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(32) == 0) {
				var12 = var4 + rand.nextInt(16);
				var13 = 148;
				var14 = var5 + rand.nextInt(16);
				(this.items.get(this.rand.nextInt(7))).generate(this.worldObj, rand, var12, var13, var14);
			}


			if (this.rand.nextInt(32) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 148;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(this.worldObj.isAirBlock(var12, var13, var14)) {
					var13--;
				}
				infusion.generate(this.worldObj, this.rand, var12, var13, var14);
			}

			for (int i = 0; i < 3; ++i) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 158;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(2) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 19 + 128;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(!this.worldObj.isAirBlock(var12, var13, var14)) {
					var13++;
				}
				(this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);
			}

			if (this.rand.nextInt(250) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 144 ;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(!this.worldObj.isAirBlock(var12, var13, var14)) {
					var13++;
				}
				(l3Altars.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20 + 128;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(shinegrass).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20 + 128;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(cracklespikes).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 20 + 128;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(bulatobes).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			/*
			   * Layer 4
			   */
			if (this.rand.nextInt(32) == 0) {
				var12 = var4 + rand.nextInt(16);
				var13 = 212;
				var14 = var5 + rand.nextInt(16);
				(this.items.get(this.rand.nextInt(7))).generate(this.worldObj, rand, var12, var13, var14);
			}

			if (this.rand.nextInt(32) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 212;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(this.worldObj.isAirBlock(var12, var13, var14)) {
					var13--;
				}
				infusion.generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(2) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 210;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(!this.worldObj.isAirBlock(var12, var13, var14)) {
					var13++;
				}
				(this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);
			}

			for (int i = 0; i < 5; i++) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 212;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(new WorldGenLayer2Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			for (int i = 0; i < 3; ++i) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 222 + this.rand.nextInt(23);
				var14 = var5 + this.rand.nextInt(16) + 8;
				(this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(150) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 210 ;
				var14 = var5 + this.rand.nextInt(16) + 8;
				while(!this.worldObj.isAirBlock(var12, var13, var14)) {
					var13++;
				}
				(l4Altars.get(this.rand.nextInt(3))).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			/*if (this.rand.nextInt(150) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 19 + 196;
				var14 = var5 + this.rand.nextInt(16) + 8;  
				while(!this.worldObj.isAirBlock(var12, var13, var14)) {
					var13++;
				}
				(new Layer4MassiveTree(false)).generate(this.worldObj, this.rand, var12, var13, var14);
			}*/

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 212;
				var14 = var5 + this.rand.nextInt(16) + 8;
				//(shimmers).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 212;
				var14 = var5 + this.rand.nextInt(16) + 8;
				(shinegrass).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			if (this.rand.nextInt(10) == 0) {
				var12 = var4 + this.rand.nextInt(16) + 8;
				var13 = 212;
				var14 = var5 + this.rand.nextInt(16) + 8;
				//(dreamglows).generate(this.worldObj, this.rand, var12, var13, var14);
			}

			MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, var11));
			BlockSand.fallInstantly = false;
}

public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) {
	return true;
}

public boolean canSave() {
	return true;
}

public String makeString() {
	return "Vethea";
}

@Override
public List getPossibleCreatures(EnumCreatureType enumcreaturetype, int i, int j, int k) {
	BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(i, k);
	return var5 == null ? null : var5.getSpawnableList(enumcreaturetype);
}

public int getLoadedChunkCount() {
	return 0;
}

public void recreateStructures(int par1, int par2) { }

@Override
public boolean unloadQueuedChunks() {
	return false;
}

@Override
public void saveExtraData() { }

@Override
public ChunkPosition func_147416_a(World var1, String var2, int var3, int var4, int var5) {
	return null;
}
}

 

The dimension consists of 4 layers. Each of them have a few different structures and different mobs, but overall they are pretty much the same. Yes, I realize that generating that many structures does create lag, and the dimension has never been particularly smooth, but it has been playable without making the game completely lag out. When I comment out the code for the 3rd and 4th layer, it runs quite smoothly.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

Well I can tell you one thing that's causing issues, it's a segment like this:

 

for(int i = 0; i < 2; i++) {
var12 = 16;
var13 = 20;
var14 = 16;
(new WorldGenMinable(VetheaBlocks.dreamGrass, 16, VetheaBlocks.dreamStone)).generate(this.worldObj, this.rand, var12, var13, var14);
}

 

WorldGenMinable is itself a generator, you can reuse it instead of creating a new one every time you need an ore cluster generated.

 

Otherwise, you will be creating new WorldGenMinable objects like crazy, which I would guess is a huge source of your observed lag. Instead, create a single static WorldGenMinable object for a particular type of worldgen and call it at all the appropriate points. This will avoid the massive amount of object allocation-deallocation you would have going on with the above.

Link to comment
Share on other sites

Huh! I did not know the JIT was clever enough to deal with stuff like that. I just assumed that it would unthinkingly make a new object when explicitly told to in the source, not knowing whether the programmer had special handling in the constructor and would therefore truly want a new object. Never mind then, and thanks for the info, diesieben!

Link to comment
Share on other sites

Would you mind terribly pointing me towards some literature to that effect, then? I know that this is not "java school" but I have always thought that the "new" keyword will always allocate a new object, and looking it up now I can't find anything that contradicts that.

 

I also just wrote a little for-loop that does nothing but instantiate a new object and print its identity hashcode, and it is most certainly making new allocations when I use the new keyword. Under what conditions does the compiler optimize that away?

Link to comment
Share on other sites

Yes, it is the populate method, I know that it is causing the problem.

 

 

@Override

public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {

 

int var4 = par2 * 16;

int var5 = par3 * 16;

BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16);

this.rand.setSeed(this.worldObj.getSeed());

long var7 = this.rand.nextLong() / 2L * 2L + 1L;

long var9 = this.rand.nextLong() / 2L * 2L + 1L;

this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed());

boolean var11 = false;

int var12;

int var13;

int var14;

 

 

for (int i = 0; i < 3; i++) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

 

var14 = var5 + this.rand.nextInt(16) + 8;

(ceilingTexture).generate(this.worldObj, this.rand, var12, var13, var14, this.rand.nextInt(3)+1);

}

 

//greenGemTops.generate(worldObj, rand, var4, 0, var5);

//purpleGemTops.generate(worldObj, rand, var4, 0, var5);

//yellowDulahs.generate(worldObj, rand, var4, 0, var5);

//greenDulahs.generate(worldObj, rand, var4, 0, var5);

 

if (this.rand.nextInt(16) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 16 - this.rand.nextInt(2);

var14 = var5 + this.rand.nextInt(16) + 8;

(pillar).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

for(int i = 0; i < 2; i++) {

var12 = 16;

var13 = 16;

var14 = 16;

(grassClusters).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

for(int i = 0; i < 1; i++) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = rand.nextInt(256);

var14 = var5 + this.rand.nextInt(16) + 8;

(firecrystals).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(32) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 16;

var14 = var5 + this.rand.nextInt(16) + 8;

while(this.worldObj.isAirBlock(var12, var13, var14))

var13--;

infusion.generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(32) == 0) {

            var12 = var4 + this.rand.nextInt(16);

            var13 = 16 - this.rand.nextInt(2);

            var14 = var5 + this.rand.nextInt(16);

            (this.items.get(this.rand.nextInt(7))).generate(this.worldObj, this.rand, var12, var13, var14);

        }

 

for (int i = 0; i < 1; ++i) {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = 30;

            var14 = var5 + this.rand.nextInt(16) + 8;

            (this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, this.rand, var12, var13, var14);

        }

 

        if (this.rand.nextInt(2) == 0) {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = 16;

            var14 = var5 + this.rand.nextInt(16) + 8;

            (this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);

        }

       

        if (this.rand.nextInt(500) == 0) {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = 40;

            var14 = var5 + this.rand.nextInt(16) + 8;

            (hungerVillages).generate(this.worldObj, this.rand, var12, var13, var14);//TODO add hunger

        }

 

        for (int i = 0; i < 1; i++) {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = 16;

            var14 = var5 + this.rand.nextInt(16) + 8;

            (new WorldGenLayer1Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);

        }

       

        if (this.rand.nextInt(250) == 0) {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = 15;

            var14 = var5 + this.rand.nextInt(16) + 8;

            (crypts.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13, var14);//TODO add crypt keeper

        }

       

        if (this.rand.nextInt(250) == 0) {

            var12 = var4 + this.rand.nextInt(16) + 8;

            var13 = 15;

            var14 = var5 + this.rand.nextInt(16) + 8;

            (l1Trees.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13, var14);

        }

       

// Layer 2

 

for (int i = 0; i < 3; i++) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 96;

var14 = var5 + this.rand.nextInt(16) + 8;

(ceilingTexture).generate(this.worldObj, this.rand, var12, var13, var14, this.rand.nextInt(3)+1);

}

 

if (this.rand.nextInt(16) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64 - this.rand.nextInt(2);

var14 = var5 + this.rand.nextInt(16) + 8;

pillar.generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if(this.rand.nextInt(32) == 0) {

var12 = var4 + rand.nextInt(16);

var13 = 64;

var14 = var5 + rand.nextInt(16);

(this.items.get(this.rand.nextInt(6))).generate(this.worldObj, rand, var12, var13, var14);

}

 

if (this.rand.nextInt(32) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

var14 = var5 + this.rand.nextInt(16) + 8;

while(this.worldObj.isAirBlock(var12, var13, var14)) {

var13--;

}

infusion.generate(this.worldObj, this.rand, var12, var13, var14);

}

 

for (int i = 0; i < 3; ++i) {

var12 = var4 + this.rand.nextInt(16);

var13 = 75;

var14 = var5 + this.rand.nextInt(16);

(this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, rand, var12, var13, var14);

}

 

if (this.rand.nextInt(2) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

var14 = var5 + this.rand.nextInt(16) + 8;

while(!this.worldObj.isAirBlock(var12, var13, var14)) {

var13++;

}

(this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);

}

 

if (this.rand.nextInt(250) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

var14 = var5 + this.rand.nextInt(16) + 8;

while(!this.worldObj.isAirBlock(var12, var13, var14)) {

var13++;

}

(pyramids.get(this.rand.nextInt(3))).generate(this.worldObj, this.rand, var12, var13, var14);//Add the mobs

}

 

for (int i = 0; i < 3; i++) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

var14 = var5 + this.rand.nextInt(16) + 8;

(new WorldGenLayer2Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

var14 = var5 + this.rand.nextInt(16) + 8;

(fernites).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

var14 = var5 + this.rand.nextInt(16) + 8;

//(dreamglows).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 64;

var14 = var5 + this.rand.nextInt(16) + 8;

//(shimmers).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

 

/*

  * layer 3

  */

/*for (int i = 0; i < 3; i++) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 192;

var14 = var5 + this.rand.nextInt(16) + 8;

//(ceilingTexture).generate(this.worldObj, this.rand, var12, var13, var14, this.rand.nextInt(3)+1);

}

 

if (this.rand.nextInt(16) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 148;

var14 = var5 + this.rand.nextInt(16) + 8;

pillar.generate(this.worldObj, this.rand, var12, var13, var14);

}

 

for (int i = 0; i < 3; i++) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 148;

var14 = var5 + this.rand.nextInt(16) + 8;

(new WorldGenLayer1Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(32) == 0) {

var12 = var4 + rand.nextInt(16);

var13 = 148;

var14 = var5 + rand.nextInt(16);

(this.items.get(this.rand.nextInt(7))).generate(this.worldObj, rand, var12, var13, var14);

}

 

 

if (this.rand.nextInt(32) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 148;

var14 = var5 + this.rand.nextInt(16) + 8;

while(this.worldObj.isAirBlock(var12, var13, var14)) {

var13--;

}

infusion.generate(this.worldObj, this.rand, var12, var13, var14);

}

 

for (int i = 0; i < 3; ++i) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 158;

var14 = var5 + this.rand.nextInt(16) + 8;

(this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(2) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 19 + 128;

var14 = var5 + this.rand.nextInt(16) + 8;

while(!this.worldObj.isAirBlock(var12, var13, var14)) {

var13++;

}

(this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);

}

 

if (this.rand.nextInt(250) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 144 ;

var14 = var5 + this.rand.nextInt(16) + 8;

while(!this.worldObj.isAirBlock(var12, var13, var14)) {

var13++;

}

(l3Altars.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 20 + 128;

var14 = var5 + this.rand.nextInt(16) + 8;

(shinegrass).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 20 + 128;

var14 = var5 + this.rand.nextInt(16) + 8;

(cracklespikes).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 20 + 128;

var14 = var5 + this.rand.nextInt(16) + 8;

(bulatobes).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

  //Layer 4

 

if (this.rand.nextInt(32) == 0) {

var12 = var4 + rand.nextInt(16);

var13 = 212;

var14 = var5 + rand.nextInt(16);

(this.items.get(this.rand.nextInt(7))).generate(this.worldObj, rand, var12, var13, var14);

}

 

if (this.rand.nextInt(32) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 212;

var14 = var5 + this.rand.nextInt(16) + 8;

while(this.worldObj.isAirBlock(var12, var13, var14)) {

var13--;

}

infusion.generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(2) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 210;

var14 = var5 + this.rand.nextInt(16) + 8;

while(!this.worldObj.isAirBlock(var12, var13, var14)) {

var13++;

}

(this.lamps.get(this.rand.nextInt(2))).generate(this.worldObj, this.rand, var12, var13 - 2, var14);

}

 

for (int i = 0; i < 5; i++) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 212;

var14 = var5 + this.rand.nextInt(16) + 8;

(new WorldGenLayer2Forest(false)).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

for (int i = 0; i < 3; ++i) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 222 + this.rand.nextInt(23);

var14 = var5 + this.rand.nextInt(16) + 8;

(this.floatingTrees.get(this.rand.nextInt(6))).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(150) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 210 ;

var14 = var5 + this.rand.nextInt(16) + 8;

while(!this.worldObj.isAirBlock(var12, var13, var14)) {

var13++;

}

(l4Altars.get(this.rand.nextInt(3))).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

/*if (this.rand.nextInt(150) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 19 + 196;

var14 = var5 + this.rand.nextInt(16) + 8; 

while(!this.worldObj.isAirBlock(var12, var13, var14)) {

var13++;

}

(new Layer4MassiveTree(false)).generate(this.worldObj, this.rand, var12, var13, var14);

}*/

 

/*if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 212;

var14 = var5 + this.rand.nextInt(16) + 8;

//(shimmers).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 212;

var14 = var5 + this.rand.nextInt(16) + 8;

(shinegrass).generate(this.worldObj, this.rand, var12, var13, var14);

}

 

if (this.rand.nextInt(10) == 0) {

var12 = var4 + this.rand.nextInt(16) + 8;

var13 = 212;

var14 = var5 + this.rand.nextInt(16) + 8;

//(dreamglows).generate(this.worldObj, this.rand, var12, var13, var14);

}*/

 

MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, var11));

BlockSand.fallInstantly = false;

}

 

 

 

I'm just not sure why the higher layers are being especially slow.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

Hi

 

A couple of thoughts

1) I helped to optimise another mod once which was generating blocks (spheres) in the sky.  The lag was awful.  The reason turned out to be the lighting calculations. Adding blocks in the sky caused a cascading series of updates to the skylight map- each update of a block's lighting value affects all its neighbours, which affects all their neighbours, and so on.  The solution was to provide a better initialisation of the lighting map instead of just having them all set to 15.

2) You can enable profiling by typing /debug start in the chat:

On success, starts or stops the debug session. While active, includes notifications about potential performance bottlenecks in the console. When stopped, creates a profiler results file in the folder "debug".  You can even add your own sections similar to the vanilla ones.

Minecraft.getMinecraft().mcProfiler.endStartSection("startOfMyCode");

 

 

3) You could also add your own profiling code to narrow down where the time is being spent eg

startTime  = System.nanoTime();

// do stuff

timeSpent = System.nanoTime() - startTime;

System.out.println("Time spent in xxx (ms)" + timeSpent / 1000000);

 

-TGG

Link to comment
Share on other sites

I tried the debug feature, and only about 20-30% of it was lighting. 3/4 of the gen is not exposed to the sky. It might be the sheer volume of the structures. Here's a screenshot:

c64fde50-6c22-11e4-9e58-b7a71f77f127.png

If so, is there any way I could make this less laggy (aside from writing a system that creates them in generateTerrain)?

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Link to comment
Share on other sites

If a majority of those are leaf blocks, which it looks like they may be, then that would be a HUGE source of lag - consider how bad dense jungles lag, and then look at what you are doing there.

 

Of course if those aren't leaf blocks, then my guess is simply that your generation code is not very optimized. It's very easy to write poorly optimized generation code, given the penchant for many recursive and looping calls.

Link to comment
Share on other sites

Relatively few of the blocks are transparent, and the little generation code that does use loops never creates objects in them. And it's not that the game just lags a lot, all of the mobs freeze and the integrated server completely freezes up. Are you sure Forge didn't change any chunk loading code? This worked fine in earlier Forge versions.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hi fellow minecrafter,   We've got exciting news from the Pacific Laboratory for Artificial Intelligence (PLAI) at UBC! We're merging the worlds of Minecraft and AI research, and you're invited to join through our platform, plaicraft.ai, to aid our data collection process. It's not just playing games; it's contributing to cutting-edge AI research.   BetterStructures and more!!: We want to make the server as fun as possible for everyone so we recently added a bunch of structural plugins that adds over a hundred of new structures and sites for you to explore and challenge. We are also working on PVP, bedwars and skyblock content, which will make the server even more fun!   Here’s how you can get involved! -Register on plaicraft.ai with your email(you can fake one, as long as you can receive email from it it's fine). -Complete a consent form. -Play Minecraft and contribute to science! (all you need is a Chrome browser and a steady internet, you'll be playing on VM)   Why You Should Participate? -Support AI Research: Your gameplay directly contributes to important AI advancements.  -Free Minecraft Access: Enjoy the game without any cost. -We have shaders and a bunch of cool mods loaded on our instances  -Great Community: Our server currently has a fantastic community, with many awesome players you can meet.   Elephant in the room: Now I want to address some obvious concerns, I sure did a good job making us sound like a scam by the above content. I know that the "free Minecraft" thing has always been taboo in the Minecraft community. So how can I prove to you that this is not a scam? - The easiest way and most official way is that we are approved by the University of British Columbia ethics board, our BREB number is H23-02389. You can verify this case number yourself. - The harder way is that I'll explain the technical details of this project and why we choose to provide free Minecraft. So the goal of this project is very similar to the paper MineDojo or MineRL, we want to collect a multi-modal dataset that consists of video, audio, keyboard and mouse movement. Minecraft has been a very important simulation environment for the ML community and there are tons of papers related to it. Now we obviously don't have enough money like those big tech companies who can just pay people to play, so we have to turn to the Minecraft community. To record all the data mentioned, there needs to be a lot of setup and coding, and it's definitely impossible for us to ask people to run these recording programs on their personal computers. So we carefully configured the AWS EC2 instance to run Minecraft alongside the programs. And that's where and why we also provide you with free Minecraft licenses, of course, we are not giving the account to you, just allowing you to be able to play Minecraft on these instances. You might ask, "Why can't I log in with my account on the instances?", that's because first login with your personal Minecraft account is another privacy risk; second not all our target audiences have an account; and lastly we restricted a lot on what you can do on the instance, basically all you can do is play Minecraft and that's all the data we want, allowing you to log in will make things complicated to control.   For more information on the project and the team, visit Dr. Frank Wood’s website or follow @frankdonaldwood on Twitter. You can also learn more about PLAI lab research on our website (just search ubc plai). Join us in transforming your gaming experience into a meaningful contribution to AI research. Let’s push the boundaries of what gaming can achieve together! Happy plaiing!   Best,  The PLAI Team
    • The mod has improved a lot from yesterday just 1 last issue  Here's the crash report- https://pastebin.com/k2A1BAKn   Please help, Thanks.
    • Take Your Gaming Experience to the Next Level with These Essential Tools   If you're a Minecraft enthusiast, you've likely experienced the need to customize your world and server to make it more exciting and challenging. Fortunately, there's a perfect solution for you: https://menzatyx.xyz, the website that offers a wide selection of free and pre-configured Minecraft plugins. At https://menzatyx.xyz, you'll find a diverse range of plugins that will allow you to take your gaming experience to the next level. From server management tools to mods that add new functionalities, each of these plugins has been carefully selected and configured, so you can enjoy a more personalized and thrilling Minecraft experience. One of the primary benefits of using these pre-configured plugins is the ease of implementation. You no longer have to spend hours configuring and adjusting each individual plugin. Simply download the package that best suits your needs, and you're good to go! You'll be able to enjoy all the features and improvements without investing too much time and effort. From plugins that enhance the security of your server to mods that add new game modes, the variety offered by https://menzatyx.xyz is impressive. Moreover, as these are free plugins, you can access these tools without spending a single penny. It's the perfect opportunity to take your Minecraft experience to the next level without affecting your wallet! Whether you're a casual player or an experienced server administrator, at https://menzatyx.xyz you'll find the Minecraft plugins you need to personalize and enhance your game. Visit the website now and discover how you can transform your Minecraft world into something unique and thrilling!
    • Meaning I need to restart the server and redownload cobblemon?
    • Crash with the error: The game crashed whilst exception ticking world Error: java.util.ConcurrentModificationException pastebin crashlog the game worked for like 24h, then started to receive this error. Things I've tried: removing optifine or other performace mods. tried different versions (older) of the pack. set true to remove error entities and tiles in forge.cfg asked for help on the sevtech github, they said its fixed in the latest sevpatches mod, i updated that mod and its not. I've tried updating multiple mods with no result. tried a different pc and still crashed happened only one time on another map although i cant make it happen again on that map.
  • Topics

×
×
  • Create New...

Important Information

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