Jump to content

[1.7.10] custom dimension


knokko

Recommended Posts

hello guys,

I am trying to make a custom dimension.

But the dimension generates exactly like the nether whatever I do.

I have been 1 time in my "real" dimension.

I have changed my code back to that but I can't really reach it anymore.

 

Here are my codes:

@EventHandler
public void init(FMLInitializationEvent event){
	RPGEvents.registerEvents();
	RPGentities.registerEntities();
	RPGTileEntities.registerTileEntities();
	RecipeHandler.load();
	proxy.registerRenderThings();
	proxy.registerKeyBindings();
	GameRegistry.registerWorldGenerator(new RPGGenerator(), 1);
	dimensionId = DimensionManager.getNextFreeDimId();
	DimensionManager.registerProviderType(dimensionId, Generator.class, true);
	DimensionManager.registerDimension(dimensionId, dimensionId);
}

 

public class Generator extends WorldProvider {

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

public int getAverageGroundLevel(){
	return 10;
}

public boolean canRespawnHere(){
	return true;
}

public IChunkProvider createChunkGenerator(){
	return new DarkChunkGenerator(worldObj);
}
}

 

public class DarkChunkGenerator implements IChunkProvider {

public World world;

public DarkChunkGenerator(World worldObj){
	world = worldObj;
}

@Override
public boolean chunkExists(int x, int z) {
	return false;
}

@Override
public Chunk provideChunk(int x, int z) {
	Chunk chunk = new Chunk(world, x, z);
	return chunk;
}

@Override
public Chunk loadChunk(int x, int z) {
	return null;
}

@Override
public void populate(IChunkProvider provider, int x, int z) {
}

@Override
public boolean saveChunks(boolean b, IProgressUpdate update) {
	return true;
}

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

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

@Override
public String makeString() {
	return "dark world ";
}

@Override
public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) {
	return null;
}

@Override
public ChunkPosition func_147416_a(World world, String string, int x, int y, int z) {
	return null;
}

@Override
public int getLoadedChunkCount() {
	return 10;
}

@Override
public void recreateStructures(int x, int z) {
}

@Override
public void saveExtraData() {
}

}

public class RPGGenerator implements IWorldGenerator{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
	int randomX = chunkX * 16 + random.nextInt(16);
	int randomZ = chunkZ * 16 + random.nextInt(16);
	int y = BlockFeatures.getHighestBlock(world, randomX, randomZ);
	int randomizer = random.nextInt(400);
	if(randomizer == 50 && y >= 0 && world.provider.dimensionId == 0){
		RPGBuildings.makeHouse(world, randomX, y, randomZ, randomX + random.nextInt(48) + 16, y + random.nextInt(10) + 10, randomZ + random.nextInt(20) + 10, Blocks.brick_block, Blocks.planks);
	}
	if(world.provider.dimensionId == KnokkoRPG.dimensionId){
		System.out.println("IWorldGenerator is called!");
		world.setBlock(0, 100, 0, Blocks.obsidian);
	}
}
}

 

IWorldGenerator is really spamming in the console but doesn't place any obsidian...

 

This is how I travel to my dimension:

public class TestItem extends Item {
public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player){
	player.swingItem();
	player.travelToDimension(KnokkoRPG.dimensionId);
	return item;
}
}

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



×
×
  • Create New...

Important Information

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