Jump to content

1.11 World gen help needed!


Calopteryx

Recommended Posts

I'm still new to modding and I have recently been re-learning Minecraft modding. 

 

The problem:

The bush block only spawns on stone. The tutorials online state that blockhelper is the way to fix this but it seems they have removed it. It would be nice if someone could help ne resolve this problem. Thanks in advance!

Spoiler

package com.Calopteryx.ffm.world;

import java.util.Random;

import init.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.fml.common.IWorldGenerator;

public class FFMGenerator implements IWorldGenerator{

	private WorldGenerator gen_bbush;

	
	public FFMGenerator() {
		this.gen_bbush = new WorldGenMinable(ModBlocks.bbush.getDefaultState(), 5);
	}
	
	@Override
	public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
		switch (world.provider.getDimension()) {
		case 0: //Overworld
			this.runGenerator(this.gen_bbush, world, random, chunkX, chunkZ, 10, 60, 65);
			break;
		case -1: //Nether
			
			break;
		case 1:  //End
			
			break;
		}
	}
	
	private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chanceToSpawn, int minHeight, int maxHeight) {
		if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)
			throw new IllegalArgumentException("Illegal Height Arguments for WorlGenerator");
		
		int heightDiff = maxHeight - minHeight + 1;
		for (int i = 0; i < chanceToSpawn; i++) {
			int x = chunk_X * 16 + rand.nextInt(16);
			int y = minHeight + rand.nextInt(heightDiff);
			int z = chunk_Z * 16 + rand.nextInt(16);
			generator.generate(world, rand, new BlockPos(x, y, z));
		}
	}
	


}

 

 

Edited by Calopteryx
Link to comment
Share on other sites

BlockHelper still exists, it's just called BlockMatcher now... I generate ores like so: https://github.com/SocraticPhoenix/Randores/blob/master/src/main/java/com/gmail/socraticphoenix/forge/randore/RandoresWorldGenerator.java#L70, but you just have to pass in a BlockMatcher.forBlock() argument as the last one in WorldGenMinable...

  • Like 1

Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes).

I know Java pretty well... So yeah...

Quote

This is where I'd put an inspirational and/or clever quote, but I can't think of one right now...

This is the output of the totally, 100% working compiler for my programming language, Planet9:

Beginning Compilation...
Failed compilation!
planet9.compiler.error.CompilationException: Compiler not yet implemented
	at planet9.compiler.Compiler.compile(Compiler.java:39)
	at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)

 

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.



×
×
  • Create New...

Important Information

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