Jump to content

[1.8] BlockPos Help


AssassinHero

Recommended Posts

Hi,

 

I am creating a world generator for my mod so that i can spawn custom blocks into my world. I have got an issue with the BlockPos section as i've always remembered it to be the X,Y,Z coords of the block that you are wanting to spawn.

 

So far I have got this

package minecraft.criminoxmc.parallelworlds;

import java.util.Random;

import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraftforge.fml.common.IWorldGenerator;

public class ParallelWorldsGenerator implements IWorldGenerator {

@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
		IChunkProvider chunkProvider) {

	switch (world.provider.getDimensionId()) {
	case -1:
		generateNether(world, random, chunkX * 16, chunkZ * 16);
		break;
	case 0:
		generateSurface(world, random, chunkX * 16, chunkZ * 16);
		break;
	case 1:
		generateEnd(world, random, chunkX * 16, chunkZ * 16);
		break;
	}

}

private void generateEnd(World world, Random random, int i, int j) {

}

private void generateSurface(World world, Random random, int i, int j) {
	for (int k = 0; k < 4; k++) {
		int NightOreXCoord = i + random.nextInt(16);
		int NightOreYCoord = i + random.nextInt(10);
		int NightOreZCoord = j + random.nextInt(16);

		(new WorldGenMinable(ParallelWorldsMain.NightOre.getDefaultState(), 4)).generate(world, random, BlockPos);
	}
}



private void generateNether(World world, Random random, int i, int j) {

}

}

 

So it's really i don't know what to do with the BlockPos, do i have to wrap the X,Y,Z coords for that block into BlockPos and if so can someone shed some light on this as i'm a bit rusty after being gone for a bit.

 

Also Here is my main code

package minecraft.criminoxmc.parallelworlds;

import minecraft.criminoxmc.parallelworlds.items.NightGem;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = ParallelWorldsMain.MODID, version = ParallelWorldsMain.Version)
public class ParallelWorldsMain {

public static final String MODID = "Parallel Worlds";
public static final String Version = "1.0.0";


//Block Static
public static minecraft.criminoxmc.parallelworlds.blocks.NightOre NightOre;

//Item Static
public static Item NightGem;
@EventHandler
public void PreInit(FMLPreInitializationEvent event){
	// Block New
	NightOre = new minecraft.criminoxmc.parallelworlds.blocks.NightOre();

	// Item New
	NightGem = new NightGem();
	//Block Registry
	GameRegistry.registerBlock(NightOre, "Night Ore");

	//Item Registry
	GameRegistry.registerItem(NightGem, "Night Gem");
}


public void Init(FMLInitializationEvent event){
	//Generation
	GameRegistry.registerWorldGenerator(new ParallelWorldsGenerator(), 14);
}

public void PostInit(FMLPostInitializationEvent event){

}

}

 

I am assuming that the number on the registerworldgenerator is a dimension ID, feel free to correct me if i am wrong.

 

Thanks people

:)

STOP CRUCIFYING NEW MODDERS!!!!

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.