Jump to content

Recommended Posts

Posted

Will someone please help me figure our why the ore is not generating. I have followed multiple tutorials and thought that I did everything the exact same, but apparently, I'm missing something. I'm using forge 1.9.4.

 

I have minimal experience with Java. I am a Registered Nurse and single mom, and I honestly have no time to take a Java class; however, I do learn quickly and have learned a good bit from tutorials. I am trying to make a mod for my son, and we will appreciate any help that I receive.

 

OreGen:

 

 

package enderborn10172.Radiated.worldGen;

 

import java.util.Random;

 

import enderborn10172.Radiated.init.modblocks;

import net.minecraft.block.Block;

import net.minecraft.block.state.pattern.BlockMatcher;

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.minecraftforge.fml.common.IWorldGenerator;

 

public class OreGen implements IWorldGenerator{

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,

IChunkProvider chunkProvider) {

 

switch(world.provider.getDimension()){

 

case 0:

generateOverworld(world, random, chunkX * 16, chunkZ * 16);

break;

}

 

 

}

 

public void generateOverworld(World world, Random random, int x, int z){

generateOre(modblocks.RadioactiveOre, world, random, x, z, 4, 9, 10, 15, 20, Blocks.STONE);

 

 

}

 

public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize,

int chance, int minY, int maxY, Block generateIn){

int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize);

int heightRange = maxY - minY;

WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), veinSize, BlockMatcher.forBlock(generateIn));

 

for(int i = 0; i < chance; i++){

int xRand = chunkX * 16 + random.nextInt(16);

int yRand = minY + heightRange;

int zRand = chunkX * 16 + random.nextInt(16);

BlockPos newPos = new BlockPos(xRand, yRand, zRand);

gen.generate(world, random, newPos);

 

}

 

 

 

}

 

 

}

 

 

 

Main:

 

 

package enderborn10172.Radiated;

 

import java.io.File;

 

import enderborn10172.Radiated.init.ModCrafting;

import enderborn10172.Radiated.init.modarmor;

import enderborn10172.Radiated.init.modblocks;

import enderborn10172.Radiated.init.moditems;

import enderborn10172.Radiated.init.modtools;

import enderborn10172.Radiated.proxy.CommonProxy;

import enderborn10172.Radiated.proxy.client.ConfigHandler;

import enderborn10172.Radiated.world.BiomeRegistry;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.Mod.Instance;

import net.minecraftforge.fml.common.SidedProxy;

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 = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)

public class RadiatedMain {

 

@Instance

public static RadiatedMain instance;

 

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)

public static CommonProxy proxy;

 

public static final CreativeTabs CREATIVE_TAB = new RadiationTab();

 

private static File configDir;

 

public static File getconfinDir(){

return configDir;

 

}

 

 

@EventHandler

public void preInit(FMLPreInitializationEvent event)

{

 

moditems.init();

moditems.register();

 

modblocks.init();

modblocks.register();

 

modtools.init();

modtools.register();

 

modarmor.init();

modarmor.register();

 

 

 

 

//Configuration

 

configDir = new File(event.getModConfigurationDirectory() + "/" + Reference.MOD_ID);

configDir.mkdirs();

ConfigHandler.init(new File(configDir.getPath(), Reference.MOD_ID + ".cfg"));

 

 

//Miscellaneous

 

BiomeRegistry.MainBiomeRegistry();

 

 

 

 

 

}

 

@EventHandler

public void init(FMLInitializationEvent event)

{

proxy.init();

 

 

ModCrafting.register();

 

 

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event)

{

}

 

 

}

 

 

 

Blocks:

 

 

package enderborn10172.Radiated.init;

 

import enderborn10172.Radiated.blocks.BlockAnimalDecay;

import enderborn10172.Radiated.blocks.BlockContaminatedStone;

import enderborn10172.Radiated.blocks.BlockHardenedPoison;

import enderborn10172.Radiated.blocks.BlockHardenedStone;

import enderborn10172.Radiated.blocks.BlockRadioactiveOre;

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.item.Item;

import net.minecraft.item.ItemBlock;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class modblocks {

 

//Declare the block

 

public static Block RadioactiveOre;

public static Block AnimalDecay;

public static Block ContaminatedStone;

public static Block HardenedStone;

public static Block HardenedPoison;

 

 

//Initialize the block

 

public static void init(){

RadioactiveOre = new BlockRadioactiveOre();

AnimalDecay = new BlockAnimalDecay();

ContaminatedStone = new BlockContaminatedStone();

HardenedStone = new BlockHardenedStone();

HardenedPoison = new BlockHardenedPoison();

 

 

}

 

//Register the block

 

public static void register(){

registerBlock(RadioactiveOre);

registerBlock(AnimalDecay);

registerBlock(ContaminatedStone);

registerBlock(HardenedStone);

registerBlock(HardenedPoison);

 

 

}

 

private static void registerBlock(Block block) {

GameRegistry.register(block);

ItemBlock item = new ItemBlock(block);

item.setRegistryName(block.getRegistryName());

GameRegistry.register(item);

}

 

 

//The Following method calls the method below it.

 

public static void registerRenders(){

registerRender(RadioactiveOre);

registerRender(AnimalDecay);

registerRender(ContaminatedStone);

registerRender(HardenedStone);

registerRender(HardenedPoison);

 

 

}

 

//Where in the assets folder we will be looking for the item.

 

private static void registerRender(Block block){

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));

 

}

}

 

 

 

Client Proxy:

 

 

package enderborn10172.Radiated.proxy;

 

import enderborn10172.Radiated.init.modarmor;

import enderborn10172.Radiated.init.modblocks;

import enderborn10172.Radiated.init.moditems;

import enderborn10172.Radiated.init.modtools;

import enderborn10172.Radiated.world.BiomeRegistry;

import enderborn10172.Radiated.worldGen.OreGen;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class ClientProxy implements CommonProxy {

 

 

 

public void init() {

 

 

 

 

 

moditems.registerRenders();

modblocks.registerRenders();

modtools.registerRenders();

modarmor.registerRenders();

GameRegistry.registerWorldGenerator(new OreGen(), 0);

 

}

 

//public void BiomeRegistry.MainBiomeRegistry();

 

 

}

 

 

 

Thanks in advance for all your help!

 

 

 

 

 

Posted

Thanks for the quick response.

By that are you meaning take

 

GameRegistry.registerWorldGenerator(new OreGen(), 0);

 

out of the "ClientProxy" and place it under the init portion in the main?

 

Or possible the preinit?

 

 

 

 

Posted

GameRegistry.registerWorldGenerator(new OreGen(), 0);

 

out of the "ClientProxy"

 

Why the fuck would a world generator be in the client side only code?

 

You know the client isn't responsible for world state information, right?

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.

Posted

The ugly language is not necessary. However, to answer your question, no, I do not know that. However, if you would like to respectfully teach me something, I would love to learn.

Thanks in advance

 

I've also tried placing it in the preInit and the Init, and I continue to have my problem. That's why I decided after two days of trying to ask on this forum.

Posted

The ugly language is not necessary. However, to answer your question, no, I do not know that. However, if you would like to respectfully teach me something, I would love to learn.

Thanks in advance

Well basically we have two sides, client and server. The server handles basically everything, while the client only handles what needs to be handled on the client: keyboard and mouse input to GUIs.

 

I've also tried placing it in the preInit and the Init, and I continue to have my problem. That's why I decided after two days of trying to ask on this forum.

Have you generated a new world? Or chunks?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Well basically we have two sides, client and server. The server handles basically everything, while the client only handles what needs to be handled on the client: keyboard and mouse input to GUIs.

 

Have you generated a new world? Or chunks?

Thanks for your understanding and the explanation. I always just create a new world with every test run. I know it's not necessary; however, that's just my method.

 

You pass block coordinates to generateOre but generateOre expects chunk coordinates. Hence you end up with huge coordinate values.

Thank you as well. I made these adjustments, and I am extremely happy to report that the ore is now in game.

Appreciate the both of you!

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.