Jump to content

A couple custom dimension questions


Danickar

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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