Jump to content

Recommended Posts

Posted

I have created a custom feature which should generate my custom ore in the world,
my ore should only generate in certain chunks with certain biomes,
and this in a 5x5 chunk area (80x80 blocks), but after a lot of testing and fixing bugs,
that's me noticed that my ore is only generated in a 3x3 chunk area, outside the area no chunk seems to exist.

So is this intentional,
or do I have to overwrite a method in my feature,
or is this due to the "settings" of the ConfiguredFeature,
or somewhere else?

Posted
10 hours ago, ChampionAsh5357 said:

there is a dependency on each chunk to be able to load an eight chunk radius around that for feature generation.

This is also the case, if I specify a position that is outside of these 8 chunks,
there is an error on the console, but if I try to place a block outside of a 3 chunk radius,
no block is placed, as already said outside the area no chunk seems to exist

 

10 hours ago, ChampionAsh5357 said:

What does your feature look like?

this is my feature:

public class HardDeepslateFeature extends Feature<NoFeatureConfig> {

	public HardDeepslateFeature() {
		super(NoFeatureConfig.CODEC);
	}

	@Override
	public boolean place(ISeedReader seedReader, ChunkGenerator chunkGenerator, Random rng, BlockPos pos, NoFeatureConfig config) {
		Chunk chunk = (Chunk) seedReader.getChunk(pos);
		if (chunk.getPos().x % 20 == 0 && chunk.getPos().z % 20 == 0) {
			this.placeOre(seedReader, rng, pos);
		}
		return true;
	}
	
	protected void placeOre(ISeedReader seedReader, Random rng, BlockPos pos) {
		// Main Ore
		int y = MathHelper.nextInt(rng, 32, 128);
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, 8, 8), y, 10);
		// Ore in chunk +1 +1
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, 24, 24), y, 20);
		// Ore in chunk +1 -1
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, 24, -24), y, 20);
		// Ore in chunk -1 +1
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, -24, 24), y, 20);
		// Ore in chunk -1 -1
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, -24, -24), y, 20);
		
		// Ore in chunk +5 +5
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, 88, 88), y, 40);
		// Ore in chunk +5 -5
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, 88, -88), y, 40);
		// Ore in chunk -5 +5
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, -88, 88), y, 40);
		// Ore in chunk -5 -5
		this.generateOreVine(seedReader, rng, this.getNextPos(pos, -88, -88), y, 40);
	}
	
	protected BlockPos getNextPos(BlockPos pos, int x, int z) {
		return new BlockPos(z, pos.getY(), z);
	}
	
	// generate horizontal vine
	protected void generateOreVine(ISeedReader seedReader, Random rng, BlockPos pos, int y, int count) {
		int x = MathHelper.nextInt(rng, 0, 15);
		int z = MathHelper.nextInt(rng, 0, 15);
		for (int i = y; i < y + count; i++) {
			seedReader.setBlock(new BlockPos(pos.getX() + x, i, pos.getZ() + z), ModBlocks.HARD_DEEPSLATE.get().defaultBlockState(), i);
		}
	}

}

 

Posted

The entire purpose of this feature is incorrect. You're mixing in a placement with the feature.  All this feature would do is spawn the block at the specified position passed with maybe the count coming into effect. The placement would determine whether a chunk was valid to spawn in and the height of the feature to start setting.

Posted (edited)
1 hour ago, ChampionAsh5357 said:

The entire purpose of this feature is incorrect. You're mixing in a placement with the feature.

so i am not allowed to change the position in the feature
makes sense after looking at the vanilla features

1 hour ago, ChampionAsh5357 said:

The placement would determine whether a chunk was valid to spawn in and the height of the feature to start setting.

so i have to create a placement for my feature, which then handle the position of the feature?
But how do I put the bigger features? because my created feature is actually only a small part of what I want to generate.

is there a vanilla example for a placement/feature of a larger feature,
since the MonsterRoom feature is probably not suitable as an example for my purposes,
or does it make more sense to create a structure for larger features
and if so, how do I create these randomly because the structures are fixed, village houses, igloos, etc. ?

 

Edited by Luis_ST
Posted
31 minutes ago, Luis_ST said:

But how do I put the bigger features? because my created feature is actually only a small part of what I want to generate.

So what do you want to generate? You seem to either be combining multiple features into one feature based on what I'm seeing.

34 minutes ago, Luis_ST said:

and if so, how do I create these randomly because the structures are fixed, village houses, igloos, etc. ?

Structures are perfectly capable of being randomized using pools. Currently out of what I've seen though, you don't really have any dynamic data.

Posted
15 hours ago, ChampionAsh5357 said:

So what do you want to generate? You seem to either be combining multiple features into one feature based on what I'm seeing.

my goal would be to generate a large main room with a lot of my custom ore,
and to generate these several small rooms with less ore, the ore should be generated in the middle of the room,
the rooms should also be connected with a kind of tunnel system.

if I think about what I want to generate, it would be smartest to generate a structure instead of a featrure
two more questions about structures:

it is possible to generate structures in the code and not via nbt file
and is there a vanilla structure that i can use as an example

Posted
3 hours ago, Luis_ST said:

it is possible to generate structures in the code and not via nbt file

Sure, although based on what I'm hearing, there's nothing that you can't do via nbt.

3 hours ago, Luis_ST said:

and is there a vanilla structure that i can use as an example

There's a bunch like the desert pyramid iirc.

Posted
1 hour ago, ChampionAsh5357 said:

Sure, although based on what I'm hearing, there's nothing that you can't do via nbt.

There's a bunch like the desert pyramid iirc

thanks i try that

Posted
On 5/17/2021 at 4:01 PM, ChampionAsh5357 said:

There's a bunch like the desert pyramid iirc.

the structure works almost perfectly there are a few small things that i have to change, only optically

one more little thing, I'm currently trying to understand the world generating, here I tried to generate a custom cave,
but I have again the problem that chunks not or not complete load. looks like this:

2021-05-23_19_17_14.thumb.png.aa535f88688e1c12e14b34e08e8f236f.png

this is the code:
https://github.com/Luis-st/Forge-1.16.5-Industry/blob/main/src/main/java/net/luis/industry/common/world/carver/ocean/OceanWorldCarver.java


I hope you can help me again

 

  • 2 weeks later...
Posted
On 5/24/2021 at 3:45 PM, ChampionAsh5357 said:

Your carvers seem to be working as intended from what I glance. I would suggest looking at the existing CaveWorldCarver since that most likely has what you're looking for.

the problem has been fixed, unfortunately i still have a problem with my structure because i had to recreate it (because my hard drive crashed and destroyed many files).
unfortunately i can't remember how i fixed the problem last time. The error is probably due to the fact that the structure is not correctly registered,
because the game is always chrashed when I want to create a new world or i load a old world:

This is the log:
log.log

I hope you can help me one last time

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.