Jump to content

Ore not Generating


enderborn10172

Recommended Posts

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!

 

 

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • the modpack start but when i close crash DEBUG LOG : https://paste.ee/p/3WjHl#section0
    • Looks like an issue with betterpingdisplay - make a test without it
    • I made a basic homing arrow, which I am going to refine further, but as of now I have the problem of the Arrow not rendering properly. It works fine on the server side, but on the client it always appears as if the arrow was flying normally, until it synchs and teleports around.   [https://gemoo.com/tools/upload-video/share/661346070437036032?codeId=MpmzxaW0pBpE1&card=661346066800603136&origin=videolinkgenerator] the white particles are created by the entity every tick on the server side and represent its actual flying path.   My best guess is that this behaviour is caused, because minecraft appears to try to predict the projectiles path on the client side instead of constantly synching (perhaps something to do with it implementing the TracableEntity interface??). I am thinking I need help with either 1. Getting the client to use my custom Tick function in its path prediction, or 2. (the less elegant solution) getting the game to synch up the direction, position and movement etc. every tick.     Note that my custom arrow class extends AbstractArrow. everything important it does: private static final EntityDataAccessor<Integer> TARGET_ENTITY = SynchedEntityData.defineId(ReachArrow.class, EntityDataSerializers.INT); @Override public void addAdditionalSaveData(CompoundTag pCompound) { super.addAdditionalSaveData(pCompound); pCompound.putInt("TargetEntity", this.getTargetEntity()); } @Override public void readAdditionalSaveData(CompoundTag pCompound) { super.readAdditionalSaveData(pCompound); this.setTargetEntity(pCompound.getInt("TargetEntity")); } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(TARGET_ENTITY, -1); } @Override public void shootFromRotation(Entity pShooter, float pX, float pY, float pZ, float pVelocity, float pInaccuracy) { LivingEntity target = ReachArrow.findNearestTarget(this.level(),(LivingEntity) pShooter,50d); if(pShooter instanceof LivingEntity && target !=null){ //pShooter.sendSystemMessage(Component.literal("setting id "+target.getId()+" as target")); setTargetEntity(target.getId()); //pShooter.sendSystemMessage(Component.literal("target set")); } super.shootFromRotation(pShooter, pX, pY, pZ, pVelocity, pInaccuracy); } public static LivingEntity findNearestTarget(Level world, LivingEntity shooter, double range) { AABB searchBox = shooter.getBoundingBox().inflate(range); List<LivingEntity> potentialTargets = world.getEntitiesOfClass(LivingEntity.class, searchBox, EntitySelector.NO_SPECTATORS); LivingEntity nearestTarget = null; double closestDistance = Double.MAX_VALUE; for (LivingEntity potentialTarget : potentialTargets) { if (potentialTarget != shooter && potentialTarget.isAlive()) { double distance = shooter.distanceToSqr(potentialTarget); if (distance < closestDistance) { closestDistance = distance; nearestTarget = potentialTarget; } } } return nearestTarget; } I tried fixing the problem by storing the Target using SynchedEntityData, which not only didn't fix the problem, but also added unwanted, blue particles to the arrow (like on tipped arrow) Thank you in advance for any help or hints, I am quite new at this so you could probably help me a lot. :)
    • When trying to load Craft to Exile 2, game crashes and this error message pops up:   https://api.mclo.gs/1/raw/B2oYte0
    • FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':processResources'. > Could not copy file 'C:\Users\jedil\Downloads\forge-1.20-46.0.14-mdk\src\main\resources\META-INF\mods.toml' to 'C:\Users\jedil\Downloads\forge-1.20-46.0.14-mdk\build\resources\main\META-INF\mods.toml'.    > Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:      SimpleTemplateScript1.groovy: 1: Unexpected input: '(' @ line 1, column 10.         out.print("""# This is an example mods.toml file. It contains the data relating to the loading mods.                  ^   This is my mods.toml script: # This is an example mods.toml file. It contains the data relating to the loading mods. # There are several mandatory fields (#mandatory), and many more that are optional (#optional). # The overall format is standard TOML format, v0.5.0. # Note that there are a couple of TOML lists in this file. # Find more information on toml format here: https://github.com/toml-lang/toml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version loaderVersion="${46.0.14}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="${All Rights Reserved}" # A URL to refer people to when problems occur with this mod #issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod modId="${MCRefined}" #mandatory # The version number of the mod version="${1.0.0}" #mandatory # A display name for the mod displayName="${Minecraft Refined}" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ #updateJSONURL="https://change.me.example.invalid/updates.json" #optional # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional # A file name (in the root of the mod JAR) containing a logo for display #logoFile="examplemod.png" #optional # A text field displayed in the mod UI #credits="" #optional # A text field displayed in the mod UI authors="${me}" #optional # Display Test controls the display for your mod in the server connection screen # MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. # IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. # IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. # NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. # IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. #displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) # The description text for the mod (multi line!) (#mandatory) description='''${Minecraft, but it's, like, better.}''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. I tried using --scan or --stacktrace, those were no help. I also tried Ctrl+Alt+S, the template I used did not appear. HELP
  • Topics

×
×
  • Create New...

Important Information

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