Jump to content

Nether and End ore generation not working [Solved - see end for solution]


Yagoki

Recommended Posts

Sorted out all of my blocks for the world section of my mod, and have managed to get them to generate successfully in the overworld, however the ores which i set to generate in the nether and end do not seem to be spawning anywhere (several extended searches and high spawn rates for testing yielded nothing).

not sure what i'm doing wrong so any help would be welcome.

 

World Generator class (only showing one ore form each method as there's a lot of them)

package mods.mtech.code.common;

import java.util.Random;

import mods.mtech.code.blocks.BlockOreNether;
import mods.mtech.code.blocks.BlockOreOverworld;
import mods.mtech.code.client.Config;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;

public class OreGeneration implements IWorldGenerator
{

@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	switch(world.provider.dimensionId)
	{
	case -1:
		generateNether(random, chunkX*16, chunkZ*16, world, chunkGenerator, chunkProvider);
		break;
	case 1:
		generateEnd(random, chunkX*16, chunkZ*16, world, chunkGenerator, chunkProvider);
		break;
	case 0:
		generateOverworld(random, chunkX*16, chunkZ*16, world, chunkGenerator, chunkProvider);
		break;
	}
}

private void generateOverworld(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{

	System.out.println("generating overworld");
	if(Config.Blocks.aluminiumOreEnabled)
	{
		for (int i = 0; i < 10; i++)
		{
			(new WorldGenMinable(BlockOreOverworld.oreAluminium.blockID, 5)).generate(world, random,
					chunkX + random.nextInt(16), random.nextInt(32), chunkZ + random.nextInt(16));
		}
	}
}

private void generateNether(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	System.out.println("generating nether");
	if(Config.Blocks.azuriteOreEnabled)
	{
		for (int i = 0; i < 30; i++)
		{
			(new WorldGenMinable(BlockOreNether.oreAzurite.blockID, 50, Block.netherrack.blockID)).generate(world, random,
					chunkX + random.nextInt(16), random.nextInt(256), chunkZ + random.nextInt(16));
		}
	}
}

private void generateEnd(Random random, int chunkX, int chunkZ, World world,
		IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
	System.out.println("generating end");
	if(Config.Blocks.calciteOreEnabled)
	{
		for (int i = 0; i < 50; i++)
		{
			(new WorldGenMinable(BlockOreNether.oreCalciteEnd.blockID, 10, Block.whiteStone.blockID)).generate(world, random,
					chunkX + random.nextInt(16), random.nextInt(256), chunkZ + random.nextInt(16));
		}
	}
}
}

 

the debug printing shows the correct prints for each dimension, but there's still no ore. (other than in the overworld)

I've also tried this with adapted versions of the WorldGenMinable class (just replacing the block id it was replacing with the one i was trying to spawn it in), but the results were the same

 

Thanks in advance

Link to comment
Share on other sites

Understand the classes you are using.

WorldGenMinable only replaces stone. No stone in nether or end, so your ore doesnt generate.

Please do some research before posting, this is a inacturate statement.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

i know what the classes are using, if you look in the code for WorldGenMinable there are 3 constructors, one which will only replace stone and two where you can specify a target block (at least that's my understanding of it looking through the class). in my code i've specified the target blocks as netherrack and whitestone (endstone) so which is where my confusion arises from.

 

your point was one of the first things i though of, hence to start with i tred with my own versions of the code for this replacing the Block.stone.blockID with the necessary ones, which still had no effect.

 

(new WorldGenMinable(BlockOreNether.oreCalciteEnd.blockID, 10, Block.whiteStone.blockID))

Link to comment
Share on other sites

How very odd...

 

looking further through the class, and the paths for all the variables i was passing it the target which can be set using the other constructors seems to be rather redundant

 

the following line is called before the ore is added to the chunk, and in the declaration for the method none of the parameters are relay necessary other than the block as when it's called it just checks to see if the id == stone.blockID.

 

if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, k2, l2, i3, field_94523_c)))

 

field_94523_c is supposed to be the id of the target block, and the bit which seems odd is the block.isGenMineableReplaceable(...) method.

 

this all seems rather odd to me, as i can't find it overridden in netherrack or anything ???

 

this could explain the problem, please say if I've missed anything here with the code or what it's actually doing. I do have a fair amount of experience of java, but we all make mistakes so i could've missed something.

 

 

P.S. currently making custom class to test

Link to comment
Share on other sites

You could you know, read it, and see that there was a bug that has been fixed referecing this exact things:

https://github.com/MinecraftForge/MinecraftForge/commit/58ad89ca9066b2e0b0749e2b795a6ce953005b0e

 

Or if I have to explicity say it: UPDATE YOUR FORGE.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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

    • we tried both versions and both cant run on her laptop for some reason idk what to do  
    • Okay so we tried both versions and both cant run on her pc for some reason!  
    • Well. Make sure you installed a correct jdk for your forge mdk version. Make sure your JAVA_HOME and %PATH% environment-variables are setup correctly. (If you're on windows)   I downloaded an example forge mdk for my version and extracted the contents to a folder I'm working in Using Eclipse, I opened Eclipse and imported an existing gradle Project (with its root directory in the folder directory which I previously extracted my contents to). Waited for Eclipse to do its thing After it having finished, I ran genEclipseRuns, setupDecompWorkspace and setupDevWorkspace (Gradle Tasks > your mod name here > forgegradle)    If it still didn't work (and you're using Eclipse) run cleanEclipse and, in a command prompt  Also If I recall correctly, someone, somewhere said that the way you setup your workspace changes depending on your Minecraft Version. I did this in 1.8.9.
    • https://mclo.gs/ZlRMU4G Still crash, help 
    • Hi, im having problem with error: Could not resolve dependency: net.minecraftforge:forge:1.20.1:userdev   im new in modding, but i tried everything, and it is still not working. all versions are correct etc.   build gradle: plugins {     id 'eclipse'     id 'idea'     id 'maven-publish'     id 'net.minecraftforge.gradle' version '[6.0,6.2)'     id 'org.parchmentmc.librarian.forgegradle' version '1.+' } version = mod_version group = mod_group_id base {     archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft {     // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md     // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started     mappings channel: mapping_channel, version: mapping_version          copyIdeResources = true          runs {         // applies to all the run configs below         configureEach {             workingDirectory project.file('run')             property 'forge.logging.markers', 'REGISTRIES'             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels             property 'forge.logging.console.level', 'debug'             mods {                 "${mod_id}" {                     source sourceSets.main                 }             }         }         client {             // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.             property 'forge.enabledGameTestNamespaces', mod_id         }         server {             property 'forge.enabledGameTestNamespaces', mod_id             args '--nogui'         }                  gameTestServer {             property 'forge.enabledGameTestNamespaces', mod_id         }         data {             workingDirectory project.file('run-data')                          args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')         }     } } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { } dependencies {     minecraft "net.minecraftforge:forge:1.20.1" } tasks.named('processResources', ProcessResources).configure {     var replaceProperties = [             minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,             forge_version: forge_version, forge_version_range: forge_version_range,             loader_version_range: loader_version_range,             mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,             mod_authors: mod_authors, mod_description: mod_description,     ]     inputs.properties replaceProperties     filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {         expand replaceProperties + [project: project]     } } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure {     manifest {         attributes([                 'Specification-Title'     : mod_id,                 'Specification-Vendor'    : mod_authors,                 'Specification-Version'   : '1', // We are version 1 of ourselves                 'Implementation-Title'    : project.name,                 'Implementation-Version'  : project.jar.archiveVersion,                 'Implementation-Vendor'   : mod_authors,                 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")         ])     }     // This is the preferred method to reobfuscate your jar file     finalizedBy 'reobfJar' } publishing {     publications {         register('mavenJava', MavenPublication) {             artifact jar         }     }     repositories {         maven {             url "file://${project.projectDir}/mcmodsrepo"         }     } } tasks.withType(JavaCompile).configureEach {     options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation }       please help me out
  • Topics

×
×
  • Create New...

Important Information

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