Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

A couple custom dimension questions


Danickar
 Share

Recommended Posts

So I got my custom dimension working in at least a testable state.  Have multiple custom biomes spawning that I need to tweek, but they are at least there.

 

So the two big questions I currently am looking at:

 

1) Custom Sky

I know this will probably involve a custom SkyRenderer, especially because I want to take out the sun and moon all together.  I basically want it to always be dark as night (I really am not worried about stars at this point).  Any thoughts/suggestions or helpful hints on where to look?

 

2) Custom Stucture Generation

It does not appear that towns or the like are spawning in my custom dimension, which I am sure has something to do with the fact that there are no Vanilla biomes in it.  I would like to create custom structures so that the towns not only spawn, but do so with a look relative to the biome they are in.  I also would like one of the biomes to generate a Nether Stronghold type structure.

 

I've been doing some searching but haven't really come across much on these two particular topics.

Link to comment
Share on other sites

Hi

 

1) For a quick and dirty see http://www.minecraftforge.net/forum/index.php/topic,7403.msg37894.html#msg37894

- you could change the textures to completely transparent

See also RenderGlobal.renderSky (you can hook into the skyrenderer... easiest way is to copy the renderSky code into your own IRenderHandler, register it, and tweak the code.

 

2)  No idea, never done that :-(

 

-TGG

Link to comment
Share on other sites

Hi

 

1) For a quick and dirty see http://www.minecraftforge.net/forum/index.php/topic,7403.msg37894.html#msg37894

- you could change the textures to completely transparent

See also RenderGlobal.renderSky (you can hook into the skyrenderer... easiest way is to copy the renderSky code into your own IRenderHandler, register it, and tweak the code.

 

2)  No idea, never done that :-(

 

-TGG

 

After looking at the link you provided and doing some further research I modified my world provider class to the following:

 

public class RasterlandWorldProvider extends WorldProvider
{

@Override
public void registerWorldChunkManager()
{
	this.worldChunkMgr = new RasterlandChunkManager(worldObj.getSeed(), terrainType);
	this.hasNoSky = true;
}

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

public static WorldProvider getProviderForDimension(int id)
{
	return DimensionManager.createProviderFor(Rasterland.DIMENSIONID);
}

@Override
public String getWelcomeMessage()
{
	return "Welcome to the Rasterland";
}

@Override
public IChunkProvider createChunkGenerator()
{
	return new RasterlandChunkProvider(worldObj, worldObj.getSeed(), true);
}

@Override
public boolean canRespawnHere()
{
	return true;
}


@SideOnly(Side.CLIENT)
public boolean isSkyColored()
{
	return false;
}

public float getCloudHeight()
{
	return 0.0F;
}

public boolean isSurfaceWorld()
{
	return false;
}

public float[] calcSunriseSunsetColors(float par1, float par2)
{
	return null;
}

public Vec3 getFogColor(float par1, float par2)
{
	return this.worldObj.getWorldVec3Pool().getVecFromPool(0.0, 0.0, 0.0);
}

}

 

It works pretty close to what I want.  The only thing I am not happy about right now is there is still a color variation (based off light I am guessing) between day and night time.

Link to comment
Share on other sites

If you can't figure it out, give XCompWiz a poke.  He's gotten Mystcraft to have dynamic sky colors (including rainbow hue shifts over time).

 

Mystcraft isn't open source, but XCW is pretty helpful about getting specific features working the way (generic) you want them to for your mod.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

To try and address the structure issue I have done the following:

 

In the main mod class I added

GameRegistry.registerWorldGenerator(new RasterWorldStructureGenerator());

 

 

The generator file looks like:

import java.util.Random;

import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import powell.rasterland.Rasterland;
import powell.rasterland.biome.Biomes;
import powell.rasterland.biome.YellowBiome;
import powell.rasterland.structure.RasterTestStructure;
import cpw.mods.fml.common.IWorldGenerator;

public class RasterWorldStructureGenerator implements IWorldGenerator

{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	switch(world.provider.dimensionId)
	{
		case Rasterland.DIMENSIONID: generateRasterland(world, random, chunkX*16, chunkZ*16);
		break;
	}

}

private void generateRasterland(World world, Random rand, int chunkX, int chunkZ)
{
	BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);

	if((biome instanceof YellowBiome))// then add ||BiomeGenXYZ if you want more.
	{
		System.out.println("inside the yellow generate");
		for(int x = 0;x<2;x++)
		{
			int i = chunkX + rand.nextInt(16);
			int k = chunkZ + rand.nextInt(16);
			int j = world.getHeightValue(i, k);
			new RasterTestStructure().generate(world, rand, i, j, k);
		}
	}

}

}

 

The test structure it generates is just a random building (and for the moment I am using a random structure code I found online just to see if it works).

 

It is creating the structure and only in the correct biome.  The problem is it is creating it all over the place and often on top of itself.  So my next task is to try and get it to generate a little more randomly and hopefully not when it can't create the whole thing, like villages (mostly) do in vanilla code.  I have spent a good amount of time trying to pour through the village vanilla code, a lot of which seems to still be obfuscated.  Any thoughts on where to look or what to change to get the generation itself more inline with what I am trying to do?

Link to comment
Share on other sites

You can use the BiomeEvent.GetVillageBlockID event to change block according to the biome the village structure is generated in.

 

The default village generator (MapGenVillage) is used in ChunkProviderGenerate. You can use this chunk provider as a base for your own, or use the InitMapGenEvent.

Link to comment
Share on other sites

You can use the BiomeEvent.GetVillageBlockID event to change block according to the biome the village structure is generated in.

 

The default village generator (MapGenVillage) is used in ChunkProviderGenerate. You can use this chunk provider as a base for your own, or use the InitMapGenEvent.

 

Before I went the current route I am on, I tried creating my own Village files (really just overwriting the part that talks about viable biomes to spawn in) without much success.  I was able to get it to tell me that it had found viable biomes to generate villages in, yet no villages were ever actually created.

 

I am not sure how I would use the BiomeEvent you mentioned as I have not really gotten too far into specific event modding yet.

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
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.

 Share



×
×
  • Create New...

Important Information

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