Jump to content

Recommended Posts

Posted

Hi,

I was coding in a new biome for SpaceAge, when I realised something: the biome engine has no support for metadata blocks. I had a look around, and the closest thing I found to a tutorial was this:

 

I have not done any world generation that requires metadata blocks so i can only give you the steps you would need to do/figure out.

Hope it helps, also it may be worth to check if any of the biome mods have done anything similar like extrabiomesxl or biomes o plenty etc...

 

1. You would need to add metadata variable to BiomeGenBase so you would need to make custom one:

public byte topBlockMeta;
public byte fillerBlockMeta;

 

2. You need to make custom ChunkProviderGenerate and add an array for the metadata info:

byte[] abyteMeta = new byte[32768];

 

3. replaceBlocksForBiome in ChunkProviderGenerate assigns topblock and fillerblock id to abyte array you would need to make similar method that puts metadata info to abyteMeta array.

4. Finally

Chunk chunk = new Chunk(this.worldObj, abyte, par1, par2);
// Change in to:
Chunk chunk = new Chunk(this.worldObj, abyte, abyteMeta, par1, par2);

 

The third instruction was a bit vague and didn't tell you how to exactly. I want to know how to do that. All other mods seem to stray away from metadata blocks in world generation.

 

Thanks,

SKYLORDJOEL

 

PS: Here is my replace blocks for biome method:

	public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY) {
		return;
	}

	byte b0 = 63;
	double d0 = 0.03125D;
	this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);

	for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[l + k * 16];
			float f = biomegenbase.getFloatTemperature();
			int i1 = (int) (this.stoneNoise[k + l * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D);
			int j1 = -1;
			byte topBlock = biomegenbase.topBlock;
			byte fillerBlock = biomegenbase.fillerBlock;

			byte topBlockMeta = biomegenplanets.topBlockMeta;
			byte fillerBlockMeta = biomegenplanets.fillerBlockMeta;

			for (int k1 = 127; k1 >= 0; --k1) {
				int l1 = (l * 16 + k) * 128 + k1;

				if (k1 <= 0 + this.rand.nextInt(5)) {
					par3ArrayOfByte[l1] = (byte) Block.bedrock.blockID;
				} else {
					byte b3 = par3ArrayOfByte[l1]; //block id for current block

					if (b3 == 0) {
						j1 = -1;
					} else if (b3 == SpaceAgeCore.hadesSurfaceID) { //originally stone - used cause the generator generates stone first
						if (j1 == -1) {
							if (i1 <= 0) {
								topBlock = 0;
								fillerBlock = (byte) SpaceAgeCore.hadesSurfaceID;//originally stone - under top and filler
							} else if (k1 >= b0 - 4 && k1 <= b0 + 1) {
								topBlock = biomegenbase.topBlock;
								fillerBlock = biomegenbase.fillerBlock;
							}

							if (k1 < b0 && topBlock == 0) {
								if (f < 0.15F) {
									topBlock = (byte) Block.ice.blockID; //lakes
								}
							}

							j1 = i1;

							if (k1 >= b0 - 1) {
								par3ArrayOfByte[l1] = topBlock;
							} else {
								par3ArrayOfByte[l1] = fillerBlock;
							}
						} else if (j1 > 0) {
							--j1;
							par3ArrayOfByte[l1] = fillerBlock;

							if (j1 == 0 && fillerBlock == SpaceAgeCore.hadesSurfaceID) { //originally sand
								j1 = this.rand.nextInt(4);
								fillerBlock = (byte) SpaceAgeCore.hadesSurfaceID; //sandstone
							}
						}
					}
				}
			}
		}
	}
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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