Jump to content

[1.7.10] [SOLVED]Removing Spawner from Dungeon Generation


Recommended Posts

Posted

Its been a while since I last posted. So far I have found everything I needed or figured it out myself, until now.

 

As the title suggests, I'm trying to remover spawners from dungeon generation. These dungeons are generated in my custom dimension that only contains custom biomes. I have 2 classes that handle dungeon generation, my chunk provider and my dungeon generation.

 

Chunk Provider:

package me.saxon564.mochickens.world.dimensions.chicken.chunks;

import java.util.List;
import java.util.Random;

import cpw.mods.fml.common.eventhandler.Event.Result;

import me.saxon564.mochickens.world.dimensions.chicken.generators.GenDungeons;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSand;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.util.IProgressUpdate;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.SpawnerAnimals;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.WorldGenLakes;
import net.minecraft.world.gen.structure.*;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.TerrainGen;
import net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField;

import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*;
import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*;

public class ChunkProviderChickenDimension implements IChunkProvider {

private Random rand;

private World world;
private final boolean mapFeaturesEnabled;

private NoiseGeneratorOctaves noiseGen1;
private NoiseGeneratorOctaves noiseGen2;
private NoiseGeneratorOctaves noiseGen3;
private NoiseGeneratorOctaves noiseGen4;
public NoiseGeneratorOctaves noiseGen5;
public NoiseGeneratorOctaves noiseGen6;
public NoiseGeneratorOctaves mobSpawnerNoise;

private double[] noiseArray;
private double[] stoneNoise = new double[256];
private MapGenBase caveGenerator = new MapGenCaves();
private MapGenVillage villageGenerator = new MapGenVillage();
private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
private MapGenBase ravineGenerator = new MapGenRavine();

private BiomeGenBase[] biomesForGeneration;

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

public float[] parabolicField;
public int[][] field = new int[32][32];

{
	caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
	villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, VILLAGE);
	scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
	mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT);
}

public ChunkProviderChickenDimension(World world, long seed, boolean features) {
	this.world = world;
	this.mapFeaturesEnabled = features;
	this.rand = new Random(seed);
	this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16);
	this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16);
	this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, ;
	this.noiseGen4 = new NoiseGeneratorOctaves(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};
	noiseGens = TerrainGen.getModdedNoiseGenerators(world, rand, noiseGens);

	this.noiseGen1 = (NoiseGeneratorOctaves) noiseGens[0];
	this.noiseGen2 = (NoiseGeneratorOctaves) noiseGens[1];
	this.noiseGen3 = (NoiseGeneratorOctaves) noiseGens[2];
	this.noiseGen4 = (NoiseGeneratorOctaves) noiseGens[3];
	this.noiseGen5 = (NoiseGeneratorOctaves) noiseGens[4];
	this.noiseGen6 = (NoiseGeneratorOctaves) noiseGens[5];
	//this.mobSpawnerNoise = (NoiseGeneratorOctaves) noiseGens[6];
}

public boolean chunkExists(int chunkX, int chunkZ) {
	return true;
}

public Chunk provideChunk(int chunkX, int chunkZ) {
	this.rand.setSeed((long)chunkX * 341873128712L + (long)chunkZ * 132897987541L);

	Block[] blockArray = new Block[32768];
	byte[] byteArray = new byte[32768];

	this.generateTerrain(chunkX, chunkZ, blockArray);
	this.biomesForGeneration = this.world.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, chunkX*16, chunkZ*16, 16, 16);
	this.replaceBlocksForBiome(chunkX, chunkZ, blockArray, byteArray, this.biomesForGeneration);
	this.caveGenerator.func_151539_a(this, this.world, chunkX, chunkZ, blockArray);
	this.ravineGenerator.func_151539_a(this, this.world, chunkX, chunkZ, blockArray);

	if (this.mapFeaturesEnabled) {
		this.mineshaftGenerator.func_151539_a(this, world, chunkX, chunkZ, blockArray);
		this.villageGenerator.func_151539_a(this, world, chunkX, chunkZ, blockArray);
		//this.strongholdtGenerator.func_151539_a(this, world, chunkX, chunkZ, blockArray);
		this.scatteredFeatureGenerator.func_151539_a(this, world, chunkX, chunkZ, blockArray);
	}

	Chunk chunk = new Chunk(this.world, blockArray, chunkX, chunkZ);
	byte[] byteArray2 = chunk.getBiomeArray();

	for (int k=0; k < byteArray2.length; k++) {
		byteArray2[k] = (byte)this.biomesForGeneration[k].biomeID;
	}

	chunk.generateSkylightMap();

	return chunk;
}

public void replaceBlocksForBiome(int chunkX, int chunkZ, Block[] blockArray, byte[] byteArray, BiomeGenBase[] biomesForGeneration2) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, blockArray, byteArray, biomesForGeneration2, this.world);
	MinecraftForge.EVENT_BUS.post(event);

	if(event.getResult() == Result.DENY) return;

	byte b = 63;
	double d = 0.03125D;
	this.stoneNoise = this.noiseGen4.generateNoiseOctaves(stoneNoise, chunkX*16, chunkZ*16, 0, 16, 16, 1, d*2D, d*2D, d*2D);

	for(int x = 0; x < 16; x++) {
		for (int z = 0; z < 16; z++) {
			BiomeGenBase biome = biomesForGeneration2[z + x * 16];
			float temerature = biome.getFloatTemperature(chunkX, chunkZ, 0);
			biome.genTerrainBlocks(this.world, this.rand, blockArray, byteArray, chunkX * 16 + x, chunkZ * 16 + z, this.stoneNoise[x + z * 16]);
			int i = (int) (this.stoneNoise[z + x * 16] / 3D + 3D + this.rand.nextDouble() * 0.25D);
			int j = -1;
			Block b1 = biome.topBlock;
			Block b2 = biome.fillerBlock;

			for (int k = 0; k >= 0; k--) {
				int l = (z*16+x)*128+k;
				if (k <= 0 + this.rand.nextInt(5)) {
					blockArray[l] = Blocks.bedrock;
				} else {
					Block b3 = blockArray[1];
					if (b3 == Blocks.air) {
						j = -1;
					} else if (b3 == Blocks.stone) {
						if (j == -1) {
							if (i <= 0) {
								b1 = Blocks.air;
								b2 = Blocks.stone;
							} else if (k >= b -4 && k <= b + 1) {
								b1 = biome.topBlock;
								b2 = biome.fillerBlock;
							}
							if (k < b && b1 == Blocks.air) {
								if (temerature < 0.15F) {
									b1 = Blocks.ice;
								} else {
									b1 = Blocks.water;
								}
							}
							j = i;

							if (k >= b-1) {
								blockArray[l] = b1;
							} else {
								blockArray[1] = b2;
							}
						} else if (j > 0) {
							j--;
							blockArray[1] = b2;

							if (j == 0 && b2 == Blocks.sand) {
								j =- this.rand.nextInt(4);
								b2 = Blocks.sandstone;
							}
						}
					}
				}
			}
		}
	}
}

public void generateTerrain(int chunkX, int chunkZ, Block[] blockArray) {
	byte b0 = 4;
	byte b1 = 16;
	byte b2 = 63;
	byte b3 = 17;

	int k = b0 + 1;
	int l = b0 + 1;

	this.biomesForGeneration = this.world.getWorldChunkManager().getBiomesForGeneration(biomesForGeneration, chunkX*4-1, chunkZ*4-2, k+5, l+5);
	this.noiseArray = this.initalizeNoiseField(noiseArray, chunkX*b0, 0, chunkZ*b0, k, b3, l);

	for (int i1 = 0; i1 < b0; i1++) {
		for (int j1 = 0; j1 < b0; j1++) {
			for (int k1 = 0; k1 < b1; k1++) {
				double d0 = 0.125D;
				double d1 = this.noiseArray[((i1 + 0) * l + j1 + 0) * b2 + k1 + 0];
				double d2 = this.noiseArray[((i1 + 0) * l + j1 + 1) * b2 + k1 + 0];
				double d3 = this.noiseArray[((i1 + 1) * l + j1 + 0) * b2 + k1 + 0];
				double d4 = this.noiseArray[((i1 + 1) * l + j1 + 1) * b2 + k1 + 0];
				double d5 = (this.noiseArray[((i1 + 0) * l + j1 + 0) * b2 + k1 + 1] - d1) * d0;
				double d6 = (this.noiseArray[((i1 + 0) * l + j1 + 1) * b2 + k1 + 1] - d2) * d0;
				double d7 = (this.noiseArray[((i1 + 1) * l + j1 + 0) * b2 + k1 + 1] - d3) * d0;
				double d8 = (this.noiseArray[((i1 + 1) * l + j1 + 1) * b2 + k1 + 1] - d4) * d0;

				for (int i2 = 0; i2 < b0; i2++) {
					double d9 = 0.25D;
					double d10 = d1;
					double d11 = d2;
					double d12 = (d3 - d1) * d9;
					double d13 = (d4 - d2) * d0;

					for (int j2 = 0; j2 < b0; j2++) {
						int j3 = j2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + i2;
						short short1 = 128;
						j2 -= short1;
						double d14 = 0.25D;
						double d15 =  d11 - d10 * d14;
						double d16 = d10 - d15;

						for (int k2 = 0; k2 < b1; k2++) {
							if ((d16 += d15) > 0.0D) {
								blockArray[j3 += short1] = Blocks.stone;
							} else if (k1 * 8 + i2 < b2) {
								blockArray[j3 += short1] = Blocks.water;
							} else {
								blockArray[j3 += short1] = Blocks.air;
							}
						}

						d10 += d12;
						d11 += d13;
					}

					d1 += d5;
					d2 += d6;
					d3 += d7;
					d4 += d8;

				}
			}
		}
	}
}

private double[] initalizeNoiseField(double[] doubleArray, int posX, int posY, int posZ, int sizeX, int sizeY, int sizeZ) {
	ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, doubleArray, posX, posY, posZ, sizeX, sizeY, sizeZ);
	MinecraftForge.EVENT_BUS.post(event);

	if (event.getResult() == Result.DENY) return event.noisefield;
	if (doubleArray == null) doubleArray = new double[sizeX * sizeY * sizeZ];

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

		for (int k1 = -2; k1 <= 2; k1++) {
			for (int l1 = -2; l1 <= 2; l1++) {
				float f = 10F / MathHelper.sqrt_float((float)(k1*k1 + l1*l1)) + 0.2F;
				this.parabolicField[k1 + 2 + (l1 + 2) * 5] = f;
			}
		}
	}

	double d0 = 684.412D;
	double d1 = 684.412D;
	int i2 = 0;
	int j2 = 0;

	this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, posX, posZ, sizeX, sizeZ, 1.121D, 1.121D, 0.5D);
	this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, posX, posZ, sizeX, sizeZ, 200D, 200D, 0.5D);
	this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, posX, posZ, sizeX, sizeZ, sizeY, sizeZ, d0 / 80D, d1 / 160D, d0 / 80D);
	this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, posX, posZ, sizeX, sizeZ, sizeY, sizeZ, d0, d1, d0);
	this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, posX, posZ, sizeX, sizeZ, sizeY, sizeZ, d0, d1, d0);

	boolean flag = false;
	boolean flag1 = false;

	for (int k2 = 0; k2 < sizeX; k2++) {
		for (int l2 = 0; l2 < sizeZ; l2++) {
			float f1 = 0.0F;
			float f2 = 0.0F;
			float f3 = 0.0F;
			byte b0 = 2;
			BiomeGenBase biome = this.biomesForGeneration[k2 + 2 + (l2 + 2) * (sizeX + 5)];

			for (int i3 = -b0; i3 <= b0; i3++) {
				for (int j3 = -b0; j3 <= b0; j3++) {
					BiomeGenBase biome1 = this.biomesForGeneration[k2 + + i3 + 2 + (l2 + j3 + 2) * (sizeX + 5)];
					float f4 = this.parabolicField[i3 + 2 + (j3 + 2) * 5] / (biome1.rootHeight + 2F);

					if (biome1.rootHeight > biome.rootHeight) {
						f4 /= 2F;
					}

					f1 += biome1.heightVariation * f4;
					f2 += biome1.heightVariation * f4;
					f3 += f4;
				}
			}

			f1 /= f3;
			f2 /= f3;
			f1 = f1 * 0.9F + 0.1F;
			f2 = (f1 * 4.0F - 0.1F) / 8.0F;
			double d2 = this.noise6[j2] / 8000D;

			if (d2 < 0D) {
				d2 = -d2 * 0.3D;
			}
			d2 = d2*3D - 2D;

			if (d2 < 0D) {
				d2 /= 2D;

				if (d2 < -1D) {
					d2 = 1D;
				}

				d2 /= 1.4D;
				d2 /= 2D;
			} else {
				if (d2 > 1D) {
					d2 = 1D;
				}
				d2 /= 8D;
			}

			j2++;

			for (int k3 = 0; k3 < sizeY; k3++) {
				double d3 = (double)f2;
				double d4 = (double)f1;
				d3 += d2 * 0.2D;
				double d5 = (double)sizeY / 2D + d3 *4D;
				double d6 = 0.0D;
				double d7 = ((double)k3 - d5) * 12D * 128D / 128D / d4;

				if (d7 < 0.0D) {
					d7 *= 4d;
				}

				double d8 = this.noise1[i2] / 512D;
				double d9 = this.noise2[i2] / 512D;
				double d10 = (this.noise3[i2] / 512D + 1D) / 2D;

				if (d10 < 0D) {
					d6 = d8;
				} else if (d10 > 1D) {
					d6 = d9;
				} else {
					d6 = d8 + (d9 - d8) * d10;
				}

				d6 -= d7;

				if (k3 > sizeY - 4) {
					double d11 = (double)((float)(k3 - (sizeY - 4)) / 3F);
					d6 = d6 * (1D - d11) + (-10D * d11);
				}

				doubleArray[i2] = d6;
				i2++;
			}
		}
	}
	return doubleArray;
}

public Chunk loadChunk(int chunkX, int chunkZ) {
	return this.provideChunk(chunkX, chunkZ);
}

public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ) {
	BlockSand.fallInstantly = true;
	int k = chunkX * 16;
	int l = chunkZ * 16;
	BiomeGenBase biome = this.world.getBiomeGenForCoords(k + 16, l + 16);
	this.rand.setSeed(this.world.getSeed());
	long i1 = this.rand.nextLong() / 2L * 2L + 1L;
	long j1 = this.rand.nextLong() / 2L *2L + 1L;
	this.rand.setSeed((long)chunkX * i1 + (long)chunkZ * j1 ^ this.world.getSeed());
	boolean flag = false;

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(chunkProvider, world, rand, chunkX, chunkZ, flag));

	if (mapFeaturesEnabled){ 
		this.mineshaftGenerator.generateStructuresInChunk(this.world, rand, chunkX, chunkZ);
		//this.scatteredFeatureGenerator.generateStructuresInChunk(this.world, rand, chunkX, chunkZ);
		flag = this.villageGenerator.generateStructuresInChunk(this.world, rand, chunkX, chunkZ);
	}

	int x;
	int y;
	int z;

	if (biome != BiomeGenBase.desert && biome != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 && TerrainGen.populate(chunkProvider, this.world, rand, chunkX, chunkZ, flag, LAKE)) {
		x = k + this.rand.nextInt(16) + 8;
		y = this.rand.nextInt(128);
		z = l + this.rand.nextInt(16) + 8;
		(new WorldGenLakes(Blocks.water)).generate(this.world, this.rand, x, y, z);
	}

	if (TerrainGen.populate(chunkProvider, this.world, rand, chunkX, chunkZ, flag, LAVA) && !flag && this.rand.nextInt( == 0) {
		x = k + this.rand.nextInt(16) + 8;
		y = this.rand.nextInt(this.rand.nextInt(120) + ;
		z = l + this.rand.nextInt(16) + 8;
		if (y < 63 || this.rand.nextInt(10) == 0) {
			(new WorldGenLakes(Blocks.lava)).generate(this.world, this.rand, x, y, z);
		}
	}

	boolean doGen = TerrainGen.populate(chunkProvider, world, rand, chunkX, chunkZ, flag, DUNGEON);
	for(x = 0; doGen && x < 8; x++) {
		y = this.rand.nextInt(128); //yPos
		z = k + this.rand.nextInt(16) + 8; //xPos
		int j2 = l + this.rand.nextInt(16) + 8; //zPos
		(new GenDungeons()).generate(this.world, this.rand, z, y, j2);
	}

	biome.decorate(world, rand, k, l);
	SpawnerAnimals.performWorldGenSpawning(world, biome, k+8, l+8, chunkX, chunkZ, rand);

	k+=8;
	l+=8;

	/*doGen = TerrainGen.populate(chunkProvider, world, rand, chunkX, chunkZ, flag, ICE);
	for(x = 0; doGen && x < 16; x++) {
		for (z = 0; z < 16; z++) {
			y = this.world.getPrecipitationHeight(k + x, l + z);
			if (this.world.isBlockFreezable(k + x, y - 1, l + z)) {
				this.world.setBlock(k + x, y - 1, l + z, Blocks.ice, 0, 3);
			}

			if (this.world.func_147478_e(k + x, y, l + z, (this.world.getLightBrightness(k+x, y, k+z) < 10) )) {
				this.world.setBlock(k + x, y, l + z, Blocks.snow, 0, 3);
			}
		}
	}*/

	MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(chunkProvider, world, rand, chunkX, chunkZ, flag));
	BlockSand.fallInstantly = false;
}

public boolean saveChunks(boolean flag, IProgressUpdate progress) {
	return true;
}

public boolean unloadQueuedChunks() {
	return false;
}

public boolean canSave() {
	return true;
}

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

public List getPossibleCreatures(EnumCreatureType enumCreatureType, int chunkX, int y, int chunkZ) {
	BiomeGenBase biome = this.world.getBiomeGenForCoords(chunkX, chunkZ);
	return biome == null ? null : (biome == BiomeGenBase.swampland && enumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.hasStructureAt(chunkX, y, chunkZ) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biome.getSpawnableList(enumCreatureType));
}

/*
 * ChunkPosition findClosestStructure(World world, String s, int chunkX, int y, int chunkZ)
 */

public ChunkPosition func_147416_a(World world, String s, int chunkX, int y, int chunkZ) {
	/* return "Stronghold.equals(s) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(world, chunkX, y, chunkZ) : null*/
	return null;
}

public int getLoadedChunkCount() {
	return 0;
}

public void recreateStructures(int chunkX, int chunkZ) {
	if (this.mapFeaturesEnabled) {
		this.mineshaftGenerator.func_151539_a(this, world, chunkX, chunkZ, (Block[])null);
		this.villageGenerator.func_151539_a(this, world, chunkX, chunkZ, (Block[])null);
		//this.strongholdtGenerator.func_151539_a(this, world, chunkX, chunkZ, (Block[])null);
		this.scatteredFeatureGenerator.func_151539_a(this, world, chunkX, chunkZ, (Block[])null);
	}
}

public void saveExtraData() {

}

}

 

Dungeon Generation:

package me.saxon564.mochickens.world.dimensions.chicken.generators;

import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenDungeons;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.DungeonHooks;
import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST;;

public class GenDungeons
{
    public static final WeightedRandomChestContent[] field_111189_a = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 4, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 1, 10), new WeightedRandomChestContent(Items.wheat, 0, 1, 4, 10), new WeightedRandomChestContent(Items.gunpowder, 0, 1, 4, 10), new WeightedRandomChestContent(Items.string, 0, 1, 4, 10), new WeightedRandomChestContent(Items.bucket, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_apple, 0, 1, 1, 1), new WeightedRandomChestContent(Items.redstone, 0, 1, 4, 10), new WeightedRandomChestContent(Items.record_13, 0, 1, 1, 10), new WeightedRandomChestContent(Items.record_cat, 0, 1, 1, 10), new WeightedRandomChestContent(Items.name_tag, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 2), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 1)};
    private static final String __OBFID = "CL_00000425";

   
    public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_)
    {
        byte b0 = 3;
        int l = p_76484_2_.nextInt(2) + 2;
        int i1 = p_76484_2_.nextInt(2) + 2;
        int j1 = 0;
        int k1;
        int l1;
        int i2;

        for (k1 = p_76484_3_ - l - 1; k1 <= p_76484_3_ + l + 1; ++k1)
        {
            for (l1 = p_76484_4_ - 1; l1 <= p_76484_4_ + b0 + 1; ++l1)
            {
                for (i2 = p_76484_5_ - i1 - 1; i2 <= p_76484_5_ + i1 + 1; ++i2)
                {
                    Material material = p_76484_1_.getBlock(k1, l1, i2).getMaterial();

                    if (l1 == p_76484_4_ - 1 && !material.isSolid())
                    {
                        return false;
                    }

                    if (l1 == p_76484_4_ + b0 + 1 && !material.isSolid())
                    {
                        return false;
                    }

                    if ((k1 == p_76484_3_ - l - 1 || k1 == p_76484_3_ + l + 1 || i2 == p_76484_5_ - i1 - 1 || i2 == p_76484_5_ + i1 + 1) && l1 == p_76484_4_ && p_76484_1_.isAirBlock(k1, l1, i2) && p_76484_1_.isAirBlock(k1, l1 + 1, i2))
                    {
                        ++j1;
                    }
                }
            }
        }

        if (j1 >= 1 && j1 <= 5)
        {
            for (k1 = p_76484_3_ - l - 1; k1 <= p_76484_3_ + l + 1; ++k1)
            {
                for (l1 = p_76484_4_ + b0; l1 >= p_76484_4_ - 1; --l1)
                {
                    for (i2 = p_76484_5_ - i1 - 1; i2 <= p_76484_5_ + i1 + 1; ++i2)
                    {
                        if (k1 != p_76484_3_ - l - 1 && l1 != p_76484_4_ - 1 && i2 != p_76484_5_ - i1 - 1 && k1 != p_76484_3_ + l + 1 && l1 != p_76484_4_ + b0 + 1 && i2 != p_76484_5_ + i1 + 1)
                        {
                            p_76484_1_.setBlockToAir(k1, l1, i2);
                        }
                        else if (l1 >= 0 && !p_76484_1_.getBlock(k1, l1 - 1, i2).getMaterial().isSolid())
                        {
                            p_76484_1_.setBlockToAir(k1, l1, i2);
                        }
                        else if (p_76484_1_.getBlock(k1, l1, i2).getMaterial().isSolid())
                        {
                            if (l1 == p_76484_4_ - 1 && p_76484_2_.nextInt(4) != 0)
                            {
                                p_76484_1_.setBlock(k1, l1, i2, Blocks.mossy_cobblestone, 0, 2);
                            }
                            else
                            {
                                p_76484_1_.setBlock(k1, l1, i2, Blocks.cobblestone, 0, 2);
                            }
                        }
                    }
                }
            }

            k1 = 0;

            while (k1 < 2)
            {
                l1 = 0;

                while (true)
                {
                    if (l1 < 3)
                    {
                        label101:
                        {
                            i2 = p_76484_3_ + p_76484_2_.nextInt(l * 2 + 1) - l;
                            int j2 = p_76484_5_ + p_76484_2_.nextInt(i1 * 2 + 1) - i1;

                            if (p_76484_1_.isAirBlock(i2, p_76484_4_, j2))
                            {
                                int k2 = 0;

                                if (p_76484_1_.getBlock(i2 - 1, p_76484_4_, j2).getMaterial().isSolid())
                                {
                                    ++k2;
                                }

                                if (p_76484_1_.getBlock(i2 + 1, p_76484_4_, j2).getMaterial().isSolid())
                                {
                                    ++k2;
                                }

                                if (p_76484_1_.getBlock(i2, p_76484_4_, j2 - 1).getMaterial().isSolid())
                                {
                                    ++k2;
                                }

                                if (p_76484_1_.getBlock(i2, p_76484_4_, j2 + 1).getMaterial().isSolid())
                                {
                                    ++k2;
                                }

                                if (k2 == 1)
                                {
                                    p_76484_1_.setBlock(i2, p_76484_4_, j2, Blocks.chest, 0, 2);
                                    TileEntityChest tileentitychest = (TileEntityChest)p_76484_1_.getTileEntity(i2, p_76484_4_, j2);

                                    if (tileentitychest != null)
                                    {
                                        WeightedRandomChestContent.generateChestContents(p_76484_2_, ChestGenHooks.getItems(DUNGEON_CHEST, p_76484_2_), tileentitychest, ChestGenHooks.getCount(DUNGEON_CHEST, p_76484_2_));
                                    }

                                    break label101;
                                }
                            }

                            ++l1;
                            continue;
                        }
                    }

                    ++k1;
                    break;
                }
            }

            p_76484_1_.setBlock(p_76484_3_, p_76484_4_, p_76484_5_, Blocks.air, 0, 2);
            /*TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)p_76484_1_.getTileEntity(p_76484_3_, p_76484_4_, p_76484_5_);

            if (tileentitymobspawner != null)
            {
                tileentitymobspawner.func_145881_a().setEntityName(this.pickMobSpawner(p_76484_2_));
            }
            else
            {
                System.err.println("Failed to fetch mob spawner entity at (" + p_76484_3_ + ", " + p_76484_4_ + ", " + p_76484_5_ + ")");
            }*/

            return true;
        }
        else
        {
            return false;
        }
    }

    /**
     * Randomly decides which spawner to use in a dungeon
     */
    private String pickMobSpawner(Random p_76543_1_)
    {
        return DungeonHooks.getRandomDungeonMob(p_76543_1_);
    }
}

 

As you can seen, my dungeon generation class does not set a spawner, but I have it set air instead. The issue seems to be that this class isn't getting called. Yet when I remove the spawner from the vanilla class* to see if that's whats happening, the spawner still generates. Because of this I have run out of ideas since I am unaware of another class that generates the dungeons.

 

Does anyone have any ideas or suggestions?

 

* I know it's bad practice to edit vanilla classes, I only do this when testing something like this, afterward I undo all the changes I did.

Posted

If it's not having any effect, that means it's likely not being used by minecraft - i.e. not being called.

How did you interpose your code into minecraft? Register it somewhere? Which bus? Show the code.

Posted

If it's not having any effect, that means it's likely not being used by minecraft - i.e. not being called.

How did you interpose your code into minecraft? Register it somewhere? Which bus? Show the code.

My biome and dimension are both registered. Do i have to register the dungeon generator seperately? I would share the code, but right now im on my phone.

Posted

now that im finally able to, here are all the classes that go into creating the dimension and biome

 

Main Class:

package me.saxon564.mochickens;

import java.util.List;


import me.saxon564.mochickens.entities.mobs.EntityBeefyChicken;
import me.saxon564.mochickens.entities.mobs.EntityBlazingChicken;
import me.saxon564.mochickens.entities.mobs.EntityClayChicken;
import me.saxon564.mochickens.entities.mobs.EntityCoalChicken;
import me.saxon564.mochickens.entities.mobs.EntityCookieChicken;
import me.saxon564.mochickens.entities.mobs.EntityCreeperChicken;
import me.saxon564.mochickens.entities.mobs.EntityDiamondChicken;
import me.saxon564.mochickens.entities.mobs.EntityEmeraldChicken;
import me.saxon564.mochickens.entities.mobs.EntityEnchantedChicken;
import me.saxon564.mochickens.entities.mobs.EntityEnderChicken;
import me.saxon564.mochickens.entities.mobs.EntityGiantChicken;
import me.saxon564.mochickens.entities.mobs.EntityGlowingChicken;
import me.saxon564.mochickens.entities.mobs.EntityGoldChicken;
import me.saxon564.mochickens.entities.mobs.EntityIronChicken;
import me.saxon564.mochickens.entities.mobs.EntityLapisChicken;
import me.saxon564.mochickens.entities.mobs.EntityNuuwChicken;
import me.saxon564.mochickens.entities.mobs.EntityQuartzChicken;
import me.saxon564.mochickens.entities.mobs.EntityRainbowChicken;
import me.saxon564.mochickens.entities.mobs.EntityRedstoneChicken;
import me.saxon564.mochickens.entities.mobs.EntitySkeletonChicken;
import me.saxon564.mochickens.entities.mobs.EntitySnowChicken;
import me.saxon564.mochickens.proxies.CommonProxyMoChickens;
import me.saxon564.mochickens.recipes.CraftingRecipes;
import me.saxon564.mochickens.registers.RegisterBiomes;
import me.saxon564.mochickens.registers.RegisterBlocks;
import me.saxon564.mochickens.registers.RegisterChickens;
import me.saxon564.mochickens.registers.RegisterEggs;
import me.saxon564.mochickens.registers.RegisterGameInfo;
import me.saxon564.mochickens.registers.RegisterItems;
import me.saxon564.mochickens.registers.RegisterOreDict;
import me.saxon564.mochickens.registers.RegisterDimensions;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldProviderHell;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;


@Mod(modid = MoChickensReference.MODID, name = MoChickensReference.MODNAME, version = MoChickensReference.VERSION)
public class MoChickens {
@SidedProxy(clientSide = "me.saxon564.mochickens.client.ClientProxyMoChickens", serverSide = "me.saxon564.mochickens.proxies.CommonProxyMoChickens")
public static CommonProxyMoChickens proxy;

@Instance("mochickens")
public static MoChickens instance;

// Public Biome Data
public static int[] cold = new int[500];
public static int coldNum = 0;
public static int[] hot = new int[500];
public static int hotNum = 0;
public static int[] moderate = new int[500];
public static int moderateNum = 0;
public static int[] clay = new int[500];
public static int clayNum = 0;
public static Class[] egg = new Class[500];
public static int eggNum = 0;

// Initialize Items
public static Item tamingDisc;
public static Item innerTamingDisc;
public static Item coalStick;
public static Item ironStick;
public static Item goldStick;
public static Item redstoneStick;
public static Item lapisStick;
public static Item diamondStick;
public static Item emeraldStick;
public static Item quartzStick;
public static Item randomEgg;
public static Item itemRedstoneFeather;
public static Item itemCoalFeather;
public static Item itemIronFeather;
public static Item itemGoldFeather;
public static Item itemLapisFeather;
public static Item itemDiamondFeather;
public static Item itemEmeraldFeather;
public static Item itemQuartzFeather;
public static Item itemEnchantedFeather;
public static Item itemLighter;

//Initialize Blocks
public static Block blockFeatherPortal;
public static Block blockFeatherBlock;
public static Block blockRedstoneFeatherBlock;
public static Block blockCoalFeatherBlock;
public static Block blockIronFeatherBlock;
public static Block blockGoldFeatherBlock;
public static Block blockLapisFeatherBlock;
public static Block blockDiamondFeatherBlock;
public static Block blockEmeraldFeatherBlock;
public static Block blockQuartzFeatherBlock;
public static Block blockEnchantedFeatherBlock;
public static Block blockMasterFeatherBlock;
public static Block blockCoalGemOreBlock;
public static Block blockChickenFire;

// Initialize spawn checks
public static boolean coalSpawn;
public static boolean ironSpawn;
public static boolean goldSpawn;
public static boolean redstoneSpawn;
public static boolean lapisSpawn;
public static boolean diamondSpawn;
public static boolean emeraldSpawn;
public static boolean giantSpawn;
public static boolean quartzSpawn;
public static boolean cookieSpawn;
public static boolean snowSpawn;
public static boolean claySpawn;
public static boolean rainbowSpawn;
public static boolean skeletonSpawn;
public static boolean enderSpawn;
public static boolean creeperSpawn;
public static boolean beefySpawn;
public static boolean glowingSpawn;
public static boolean blazingSpawn;
public static boolean enchantedSpawn;
public static boolean nuuwSpawn;

// Initialize untamed despawn checks
public static boolean coalUntamedDespawn;
public static boolean ironUntamedDespawn;
public static boolean goldUntamedDespawn;
public static boolean redstoneUntamedDespawn;
public static boolean lapisUntamedDespawn;
public static boolean diamondUntamedDespawn;
public static boolean emeraldUntamedDespawn;
public static boolean giantUntamedDespawn;
public static boolean quartzUntamedDespawn;
public static boolean cookieUntamedDespawn;
public static boolean snowUntamedDespawn;
public static boolean clayUntamedDespawn;
public static boolean rainbowUntamedDespawn;
public static boolean skeletonUntamedDespawn;
public static boolean enderUntamedDespawn;
public static boolean creeperUntamedDespawn;
public static boolean beefyUntamedDespawn;
public static boolean glowingUntamedDespawn;
public static boolean blazingUntamedDespawn;
public static boolean enchantedUntamedDespawn;
public static boolean nuuwUntamedDespawn;


// Initialize tamed despawn checks
public static boolean coalTamedDespawn;
public static boolean ironTamedDespawn;
public static boolean goldTamedDespawn;
public static boolean redstoneTamedDespawn;
public static boolean lapisTamedDespawn;
public static boolean diamondTamedDespawn;
public static boolean emeraldTamedDespawn;
public static boolean giantTamedDespawn;
public static boolean quartzTamedDespawn;
public static boolean cookieTamedDespawn;
public static boolean snowTamedDespawn;
public static boolean clayTamedDespawn;
public static boolean rainbowTamedDespawn;
public static boolean skeletonTamedDespawn;
public static boolean enderTamedDespawn;
public static boolean creeperTamedDespawn;
public static boolean beefyTamedDespawn;
public static boolean glowingTamedDespawn;
public static boolean blazingTamedDespawn;
public static boolean enchantedTamedDespawn;
public static boolean nuuwTamedDespawn;

//Chickens IDs
public static int coalChickenId;
public static int ironChickenId;
public static int goldChickenId;
public static int redstoneChickenId;
public static int lapisChickenId;
public static int diamondChickenId;
public static int emeraldChickenId;
public static int quartzChickenId;
public static int giantChickenId;
public static int cookieChickenId;
public static int snowChickenId;
public static int clayChickenId;
public static int rainbowChickenId;
public static int skeletonChickenId;
public static int enderChickenId;
public static int creeperChickenId;
public static int beefyChickenId;
public static int glowingChickenId;
public static int blazingChickenId;
public static int enchantedChickenId;
public static int nuuwChickenId;

//Dimensions
public static int chickenDimensionId;

//Biomes
public static BiomeGenBase biomeChicken;
public static int biomeChickenId;

public static int startEntityId = 300;

public static CreativeTabs moChickensTab = new CreativeTabs("MoChickens") {
	public Item getTabIconItem() {
		return Items.egg;
	}
};

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	ConfigSet.Config(event);

	RegisterItems.itemRegisters();
	RegisterBlocks.blockRegisters();
	RegisterDimensions.dimensionRegisters();
	RegisterBiomes.biomeRegisters();
}

@EventHandler
public void load(FMLInitializationEvent event) {
	RegisterChickens.entityRegisters();
	RegisterEggs.EggRegisters();
	// RegisterGameInfo.GameRegisters();
	CraftingRecipes.CraftingRecipieManager();
	RegisterOreDict.AddOres();
	proxy.registerSounds();
	proxy.registerRenders();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
	generateBiomeData();
	entitySpawns();
	randomSpawnEgg(EntityCoalChicken.class);
	randomSpawnEgg(EntityIronChicken.class);
	randomSpawnEgg(EntityGoldChicken.class);
	randomSpawnEgg(EntityLapisChicken.class);
	randomSpawnEgg(EntityRedstoneChicken.class);
	randomSpawnEgg(EntityDiamondChicken.class);
	randomSpawnEgg(EntityEmeraldChicken.class);
	randomSpawnEgg(EntityQuartzChicken.class);
	randomSpawnEgg(EntityGiantChicken.class);
	randomSpawnEgg(EntityClayChicken.class);
	randomSpawnEgg(EntityRainbowChicken.class);
	randomSpawnEgg(EntitySnowChicken.class);
	randomSpawnEgg(EntityCookieChicken.class);
	randomSpawnEgg(EntitySkeletonChicken.class);
	randomSpawnEgg(EntityCreeperChicken.class);
	randomSpawnEgg(EntityEnderChicken.class);
	randomSpawnEgg(EntityBeefyChicken.class);
	randomSpawnEgg(EntityGlowingChicken.class);
	randomSpawnEgg(EntityBlazingChicken.class);
	randomSpawnEgg(EntityEnchantedChicken.class);
	randomSpawnEgg(EntityNuuwChicken.class);
	randomSpawnEgg(EntityBat.class);
	randomSpawnEgg(EntityBat.class);
	randomSpawnEgg(EntityBat.class);
}

public static void randomSpawnEgg(Class c) {
	egg[eggNum] = c;
	eggNum++;
}

// Add Spawns
public void entitySpawns() {
	if (diamondSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityDiamondChicken.class, 5, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityDiamondChicken.class, 5, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (coalSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityCoalChicken.class, 10, 1, 5,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityCoalChicken.class, 10, 1, 5,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (ironSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityIronChicken.class, 9, 1, 3,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityIronChicken.class, 9, 1, 3,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (goldSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityGoldChicken.class, 7, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityGoldChicken.class, 7, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (lapisSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityLapisChicken.class, 7, 1, 3,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityLapisChicken.class, 7, 1, 3,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (redstoneSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityRedstoneChicken.class, 6, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityRedstoneChicken.class, 6, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (emeraldSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityEmeraldChicken.class, 5, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityEmeraldChicken.class, 5, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (giantSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityGiantChicken.class, 4, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityGiantChicken.class, 4, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (quartzSpawn == true) {
		EntityRegistry.addSpawn(EntityQuartzChicken.class, 5, 1, 4,
				EnumCreatureType.creature, BiomeGenBase.hell);
	}

	if (cookieSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityCookieChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityCookieChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (snowSpawn == true) {
		for (int i = 0; i <= coldNum; i++) {
			EntityRegistry.addSpawn(EntitySnowChicken.class, 3, 1, 5,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(cold[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}
	if (claySpawn == true) {
		for (int i = 0; i <= clayNum; i++) {
			EntityRegistry.addSpawn(EntityClayChicken.class, 6, 1, 2,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(clay[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (rainbowSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityRainbowChicken.class, 7, 2, 5,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityRainbowChicken.class, 7, 2, 5,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (skeletonSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntitySkeletonChicken.class, 7, 1, 3,
					EnumCreatureType.monster,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntitySkeletonChicken.class, 7, 1, 3,
					EnumCreatureType.monster,
					BiomeGenBase.getBiome(cold[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= coldNum; i++) {
			EntityRegistry.addSpawn(EntitySkeletonChicken.class, 5, 1, 3,
					EnumCreatureType.monster,
					BiomeGenBase.getBiome(cold[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (enderSpawn == true) {
		for (int i = 0; i <= coldNum; i++) {
			EntityRegistry.addSpawn(EntityEnderChicken.class, 3, 1, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(cold[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityEnderChicken.class, 3, 1, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityEnderChicken.class, 3, 1, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		// EntityRegistry.addSpawn(EntityEnderChickenMob.class, 10, 1, 10,
		// EnumCreatureType.creature, BiomeGenBase.sky);
	}

	if (creeperSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityCreeperChicken.class, 5, 1, 3,
					EnumCreatureType.monster,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry
					.addSpawn(EntityCreeperChicken.class, 5, 1, 3,
							EnumCreatureType.monster,
							BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= coldNum; i++) {
			EntityRegistry.addSpawn(EntityCreeperChicken.class, 5, 1, 3,
					EnumCreatureType.monster,
					BiomeGenBase.getBiome(cold[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (beefySpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityBeefyChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityBeefyChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (glowingSpawn == true) {
		EntityRegistry.addSpawn(EntityGlowingChicken.class, 5, 1, 4,
				EnumCreatureType.creature, BiomeGenBase.hell);
	}

	if (blazingSpawn == true) {
		EntityRegistry.addSpawn(EntityGlowingChicken.class, 5, 1, 4,
				EnumCreatureType.creature, BiomeGenBase.hell);
	}

	if (enchantedSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityEnchantedChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			 //System.out.println("Can spawn in biome: " +
			 //BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityEnchantedChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			 //System.out.println("Can spawn in biome: " +
			 //BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}

	if (nuuwSpawn == true) {
		for (int i = 0; i <= moderateNum; i++) {
			EntityRegistry.addSpawn(EntityNuuwChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(moderate[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
		for (int i = 0; i <= hotNum; i++) {
			EntityRegistry.addSpawn(EntityNuuwChicken.class, 8, 2, 4,
					EnumCreatureType.creature,
					BiomeGenBase.getBiome(hot[i]));
			// System.out.println("Can spawn in biome: " +
			// BiomeGenBase.biomeList[cold[i]].biomeName.toLowerCase());
		}
	}
}

public static void generateBiomeData() {
	int coldMin = 0;
	int moderateMin = 0;
	int hotMin = 0;
	int clayMin = 0;
	for (int i = 0; i < BiomeGenBase.getBiomeGenArray().length; i++) {
		BiomeGenBase biome = BiomeGenBase.getBiome(i);
		if (biome != null && biome != biomeChicken)
			if (biome.biomeName == null) {
				System.out
						.println("[Mo' Chickens] Biome (id "
								+ i
								+ ") has null name, could not build spawn information.");
			} else {
				String name = biome.biomeName.toLowerCase();
				float E = biome.temperature;
				float F = biome.rainfall;
				float H = biome.rootHeight;
				int I = biome.theBiomeDecorator.flowersPerChunk;
				int J = biome.theBiomeDecorator.grassPerChunk;
				int K = biome.theBiomeDecorator.treesPerChunk;
				int C = biome.theBiomeDecorator.clayPerChunk;
				// System.out.println("Name:" + name + " Temp: " + E +
				// " id: " + i);
				if (E <= 0.1) {
					// System.out.println("min is: " + coldMin + " i is: " +
					// i);
					cold[coldMin] = i;
					coldNum = coldMin;
					coldMin++;
				}
				if (E >= 0.1 && E <= 1.0) {
					// System.out.println("min is: " + moderateMin +
					// " i is: " + i);
					moderate[moderateMin] = i;
					moderateNum = moderateMin;
					moderateMin++;
				}
				if (E >= 1.0) {
					// System.out.println("min is: " + hotMin + " i is: " +
					// i);
					hot[hotMin] = i;
					hotNum = hotMin;
					hotMin++;
				}
				if (C >= 3.0) {
					// System.out.println("min is: " + clayMin + " i is: " +
					// i);
					clay[clayMin] = i;
					clayNum = clayMin;
					clayMin++;
				}
			}
	}
}
}

 

Register Helper:

package me.saxon564.mochickens.registers;

import me.saxon564.mochickens.MoChickensReference;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.registry.GameRegistry;

public class RegisterHelper {

public static void registerBlock(Block block) {
	GameRegistry.registerBlock(block, MoChickensReference.MODID + "_" + block.getUnlocalizedName().substring(5));
}

public static void registerItem (Item item) {
	GameRegistry.registerItem(item, MoChickensReference.MODID + "_" + item.getUnlocalizedName().substring(5));
}

public static void registerDimension(int id, Class provider, boolean loaded) {
	DimensionManager.registerProviderType(id, provider, loaded);
	DimensionManager.registerDimension(id, id);
}

public static void registerBiome(BiomeGenBase biome) {
	BiomeManager.addSpawnBiome(biome);
}

}

 

Dimension Registers:

package me.saxon564.mochickens.registers;

import me.saxon564.mochickens.MoChickens;
import me.saxon564.mochickens.world.dimensions.chicken.WorldProviderChickenDimension;

public class RegisterDimensions {

public static void dimensionRegisters() {
	RegisterHelper.registerDimension(MoChickens.chickenDimensionId, WorldProviderChickenDimension.class, false);
}

}

 

Biome Registers:

package me.saxon564.mochickens.registers;

import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenMesa;
import net.minecraftforge.common.BiomeManager;
import me.saxon564.mochickens.MoChickens;
import me.saxon564.mochickens.world.dimensions.chicken.biomes.BiomeGenChicken;

public class RegisterBiomes {

public static void biomeRegisters() {

	MoChickens.biomeChicken = new BiomeGenChicken(MoChickens.biomeChickenId);

	RegisterHelper.registerBiome(MoChickens.biomeChicken);
}

}

 

World Provider:

package me.saxon564.mochickens.world.dimensions.chicken;

import me.saxon564.mochickens.MoChickens;
import me.saxon564.mochickens.world.dimensions.chicken.chunks.ChunkProviderChickenDimension;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.IChunkProvider;

public class WorldProviderChickenDimension extends WorldProvider {

public void registerWorldChunkManager() {
	this.worldChunkMgr = new WorldChunkManagerHell(MoChickens.biomeChicken, 0.25F);
	this.dimensionId = MoChickens.chickenDimensionId;
}

public IChunkProvider createChunkProvider() {
	return new ChunkProviderChickenDimension(this.worldObj, this.worldObj.getSeed(), true);
}

@Override
public String getDimensionName() {
	return "Chicken Dimension";
}

}

 

Biome Generator:

package me.saxon564.mochickens.world.dimensions.chicken.biomes;

import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS;
import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS;
import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE;
import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*;

import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import me.saxon564.mochickens.MoChickens;
import me.saxon564.mochickens.entities.mobs.EntityBeefyChicken;
import me.saxon564.mochickens.entities.mobs.EntityCoalChicken;
import me.saxon564.mochickens.entities.mobs.EntityNuuwChicken;
import me.saxon564.mochickens.world.dimensions.chicken.generators.ChickenBiomeDecorator;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockGrass;
import net.minecraft.block.material.Material;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraft.world.gen.feature.WorldGenClay;
import net.minecraft.world.gen.feature.WorldGenFlowers;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenSand;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.event.terraingen.TerrainGen;

public class BiomeGenChicken extends BiomeGenBase {

private WorldGenerator theWorldGenerator;
public ChickenBiomeDecorator theBiomeDecorator;
public int chunk_X;
public int chunk_Z;
public Random RNG;
public World currentWorld;
public WorldGenerator coalGen;
    public WorldGenerator ironGen;
    public WorldGenerator coalGemGen;
    public WorldGenFlowers yellowFlowerGen;
    public WorldGenerator clayGen = new WorldGenClay(4);
    public WorldGenerator gravelGen;
    
    public int treesPerChunk;
    public int flowersPerChunk;
    public int clayPerChunk;
    public int gravelPerChunk;
    public int grassPerChunk;

protected static final BiomeGenBase.Height biomeChicken = new BiomeGenBase.Height(0.3F, 0.3F);

public BiomeGenChicken(int id) {
	super(id);
	setBiomeName("Chicken");
	setDisableRain();
	setHeight(biomeChicken);
	this.spawnableCreatureList.clear();
	this.spawnableMonsterList.clear();
	this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 30, 4, 10));
	this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCoalChicken.class, 7, 4, 5));
	this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBeefyChicken.class, 10, 4, 4));
	this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityNuuwChicken.class, 5, 1, 3));
	this.coalGen = new WorldGenMinable(Blocks.coal_ore, 16);
        this.ironGen = new WorldGenMinable(Blocks.iron_ore, ;
        this.coalGemGen = new WorldGenMinable(MoChickens.blockCoalGemOreBlock, 5);
        this.gravelGen = new WorldGenSand(Blocks.gravel, 6);
        this.yellowFlowerGen = new WorldGenFlowers(Blocks.yellow_flower);
        
        this.flowersPerChunk = 10;
        this.treesPerChunk = 5;
        this.gravelPerChunk = 50;
        this.clayPerChunk = 5;
        this.grassPerChunk = 5;
}

public void decorate(World world, Random rand, int chunkX, int chunkZ)
    {
	this.chunk_X = chunkX;
	this.chunk_Z = chunkZ;
	this.currentWorld = world;
	this.RNG = rand;
	if (TerrainGen.generateOre(currentWorld, RNG, coalGen, chunk_X, chunk_Z, COAL))
		this.genStandardOre1(20, this.coalGen, 0, 128, chunkX, chunkZ);
    if (TerrainGen.generateOre(currentWorld, RNG, ironGen, chunk_X, chunk_Z, IRON))
        this.genStandardOre1(20, this.ironGen, 0, 64, chunkX, chunkZ);
    this.genStandardOre1(20, this.coalGemGen, 0, 40, chunkX, chunkZ);
    
    /*TREE GENERATOR*/
    int i = this.treesPerChunk;

        if (this.RNG.nextInt(10) == 0)
        {
            ++i;
        }

        int l;
        int i1;

        boolean doGen = TerrainGen.decorate(currentWorld, RNG, chunk_X, chunk_Z, TREE);
        for (int j = 0; doGen && j < i; ++j)
        {
            int k = this.chunk_X + this.RNG.nextInt(16) + 8;
            l = this.chunk_Z + this.RNG.nextInt(16) + 8;
            i1 = this.currentWorld.getHeightValue(k, l);
            WorldGenAbstractTree worldgenabstracttree = this.func_150567_a(this.RNG);
            worldgenabstracttree.setScale(1.0D, 1.0D, 1.0D);

            if (worldgenabstracttree.generate(this.currentWorld, this.RNG, k, i1, l))
            {
                worldgenabstracttree.func_150524_b(this.currentWorld, this.RNG, k, i1, l);
            }
        }
        
        doGen = TerrainGen.decorate(currentWorld, RNG, chunk_X, chunk_Z, FLOWERS);
        for (int j = 0; doGen && j < this.flowersPerChunk; ++j)
        {
            int k = this.chunk_X + this.RNG.nextInt(16) + 8;
            l = this.chunk_Z + this.RNG.nextInt(16) + 8;
            i1 = nextInt(this.currentWorld.getHeightValue(k, l) + 32);
            String s = this.func_150572_a(this.RNG, k, i1, l);
            BlockFlower blockflower = BlockFlower.func_149857_e(s);

            if (blockflower.getMaterial() != Material.air)
            {
                this.yellowFlowerGen.func_150550_a(blockflower, BlockFlower.func_149856_f(s));
                this.yellowFlowerGen.generate(this.currentWorld, this.RNG, k, i1, l);
            }
        }
        
        doGen = TerrainGen.decorate(currentWorld, RNG, chunk_X, chunk_Z, GRASS);
        for (int j = 0; doGen && j < this.grassPerChunk; ++j)
        {
            int k = this.chunk_X + this.RNG.nextInt(16) + 8;
            l = this.chunk_Z + this.RNG.nextInt(16) + 8;
            i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2);
            WorldGenerator worldgenerator = this.getRandomWorldGenForGrass(this.RNG);
            worldgenerator.generate(this.currentWorld, this.RNG, k, i1, l);
        }
    }

private int nextInt(int i) {
        if (i <= 1)
            return 0;
        return this.RNG.nextInt(i);
}

protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_, int chunkX, int chunkZ)
    {
        for (int l = 0; l < p_76795_1_; ++l)
        {
            int i1 = chunkX + this.RNG.nextInt(16);
            int j1 = this.RNG.nextInt(p_76795_4_ - p_76795_3_) + p_76795_3_;
            int k1 = chunk_Z + this.RNG.nextInt(16);
            p_76795_2_.generate(this.currentWorld, this.RNG, i1, j1, k1);
        }
    }

@SideOnly(Side.CLIENT)
    public int getModdedBiomeGrassColor(int original)
    {
        return 0x75f467;
    }

}

Posted

Anyone at all? This has really confused me because i dont understand where it is calling the dungeon generator from since the dengeons still generate even if i remove the code that makes the call.

Posted

i figured it out....

 

public IChunkProvider createChunkProvider() {
	return new ChunkProviderChickenDimension(this.worldObj, this.worldObj.getSeed(), true);
}

should be

public IChunkProvider createChunkManager() {
	return new ChunkProviderChickenDimension(this.worldObj, this.worldObj.getSeed(), true);
}

in the world provider.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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