Jump to content

Nether Ore generation not working 1.10.2


hhggtg3279

Recommended Posts

I have set up my NetherGenMinable class and changed stone to netherrack, I have regoistered the ore in case -1, under my overworld ores, which spawn as they should, however when I go into the nether it does not generate, any help?

 

ModWorldGen

 

package top.mod.worldgen;

 

import java.util.Random;

 

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.WorldGenerator;

import net.minecraftforge.fml.common.IWorldGenerator;

import top.mod.block.ModBlocks;

 

public class ModWorldGen implements IWorldGenerator {

// OverWorldOres

private WorldGenerator copperore;

private WorldGenerator tinore;

private WorldGenerator zincore;

private WorldGenerator silverore;

private WorldGenerator uraniumore;

private WorldGenerator aluminiumore;

private WorldGenerator magnesiumore;

private WorldGenerator cobaltore;

private WorldGenerator titaniumore;

private WorldGenerator platinumore;

private WorldGenerator sulphurore;

private WorldGenerator niterore;

private WorldGenerator leadore;

private WorldGenerator nickelore;

private WorldGenerator nethergold;

 

public ModWorldGen() {

this.copperore = new ModWorldGenMinable(ModBlocks.copperore.getDefaultState(), 16);

this.tinore = new ModWorldGenMinable(ModBlocks.tinore.getDefaultState(), 16);

this.zincore = new ModWorldGenMinable(ModBlocks.zincore.getDefaultState(), 8);

this.leadore = new ModWorldGenMinable(ModBlocks.leadore.getDefaultState(), 8);

this.magnesiumore = new ModWorldGenMinable(ModBlocks.magore.getDefaultState(), 8);

this.silverore = new ModWorldGenMinable(ModBlocks.silverore.getDefaultState(), 8);

this.uraniumore = new ModWorldGenMinable(ModBlocks.uraniumore.getDefaultState(), 8);

this.aluminiumore = new ModWorldGenMinable(ModBlocks.aluminiumore.getDefaultState(), 8);

this.cobaltore = new ModWorldGenMinable(ModBlocks.cobaltore.getDefaultState(), 8);

this.titaniumore = new ModWorldGenMinable(ModBlocks.titaniumore.getDefaultState(), 8);

this.sulphurore = new ModWorldGenMinable(ModBlocks.sulphurore.getDefaultState(), 10);

this.niterore = new ModWorldGenMinable(ModBlocks.niterore.getDefaultState(), 10);

this.platinumore = new ModWorldGenMinable(ModBlocks.platinumore.getDefaultState(), 7);

this.nickelore = new ModWorldGenMinable(ModBlocks.nickelore.getDefaultState(), 8);

this.nethergold = new ModWorldGenMinable(ModBlocks.nethergold.getDefaultState(), 9);

 

}

 

@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(copperore, world, random, chunkX, chunkX, chunkZ, 21, 0, 128);

this.runGenerator(tinore, world, random, chunkX, chunkX, chunkZ, 21, 0, 128);

this.runGenerator(leadore, world, random, chunkX, chunkX, chunkZ, 15, 0, 54);

this.runGenerator(zincore, world, random, chunkX, chunkX, chunkZ, 14, 0, 54);

this.runGenerator(magnesiumore, world, random, chunkX, chunkX, chunkZ, 11, 0, 50);

this.runGenerator(silverore, world, random, chunkX, chunkX, chunkZ, 9, 0, 45);

this.runGenerator(uraniumore, world, random, chunkX, chunkX, chunkZ, 11, 0, 50);

this.runGenerator(aluminiumore, world, random, chunkX, chunkX, chunkZ, 11, 0, 50);

this.runGenerator(cobaltore, world, random, chunkX, chunkX, chunkZ, 4, 0, 42);

this.runGenerator(titaniumore, world, random, chunkX, chunkX, chunkZ, 2, 0, 35);

this.runGenerator(sulphurore, world, random, chunkX, chunkX, chunkZ, 20, 0, 84);

this.runGenerator(niterore, world, random, chunkX, chunkX, chunkZ, 20, 0, 84);

this.runGenerator(platinumore, world, random, chunkX, chunkX, chunkZ, 1, 0, 16);

this.runGenerator(nickelore, world, random, chunkX, chunkX, chunkZ, 10, 0, 47);

 

break;

 

case -1: // Nether

 

this.runGenerator(nethergold, world, random, chunkX, chunkX, chunkZ, 21, 0, 128);

 

break;

 

case 1: // EndWorld

 

break;

}

}

 

private void runGenerator(WorldGenerator generator, World world, Random random, int chunkX, int chunkY, int chunkZ,

int chanceToSpawn, int minHeight, int maxHeight) {

if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight)

throw new IllegalArgumentException("Minimum or Maximum Height out of bounds");

 

int heightDiff = maxHeight - minHeight + 1;

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

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

int y = minHeight + random.nextInt(heightDiff);

int z = chunkZ * 16 + random.nextInt(16);

generator.generate(world, random, new BlockPos(x, y, z));

}

}

}

 

 

NetherGenMinable

 

package top.mod.worldgen;

 

import java.util.Random;

 

import com.google.common.base.Predicate;

 

import net.minecraft.block.state.IBlockState;

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

import net.minecraft.init.Blocks;

import net.minecraft.util.math.BlockPos;

import net.minecraft.util.math.MathHelper;

import net.minecraft.world.World;

import net.minecraft.world.gen.feature.WorldGenerator;

 

public class ModNetherGenMinable extends WorldGenerator {

private final IBlockState oreBlock;

/** The number of blocks to generate. */

private final int numberOfBlocks;

private final Predicate<IBlockState> predicate;

 

public ModNetherGenMinable(IBlockState state, int blockCount) {

this(state, blockCount, BlockMatcher.forBlock(Blocks.NETHERRACK));

}

 

public ModNetherGenMinable(IBlockState state, int blockCount, Predicate<IBlockState> p_i45631_3_) {

this.oreBlock = state;

this.numberOfBlocks = blockCount;

this.predicate = p_i45631_3_;

}

 

public boolean generate(World worldIn, Random rand, BlockPos position) {

float f = rand.nextFloat() * (float) Math.PI;

double d0 = (double) ((float) (position.getX() + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);

double d1 = (double) ((float) (position.getX() + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);

double d2 = (double) ((float) (position.getZ() + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);

double d3 = (double) ((float) (position.getZ() + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);

double d4 = (double) (position.getY() + rand.nextInt(3) - 2);

double d5 = (double) (position.getY() + rand.nextInt(3) - 2);

 

for (int i = 0; i < this.numberOfBlocks; ++i) {

float f1 = (float) i / (float) this.numberOfBlocks;

double d6 = d0 + (d1 - d0) * (double) f1;

double d7 = d4 + (d5 - d4) * (double) f1;

double d8 = d2 + (d3 - d2) * (double) f1;

double d9 = rand.nextDouble() * (double) this.numberOfBlocks / 16.0D;

double d10 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D;

double d11 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D;

int j = MathHelper.floor_double(d6 - d10 / 2.0D);

int k = MathHelper.floor_double(d7 - d11 / 2.0D);

int l = MathHelper.floor_double(d8 - d10 / 2.0D);

int i1 = MathHelper.floor_double(d6 + d10 / 2.0D);

int j1 = MathHelper.floor_double(d7 + d11 / 2.0D);

int k1 = MathHelper.floor_double(d8 + d10 / 2.0D);

 

for (int l1 = j; l1 <= i1; ++l1) {

double d12 = ((double) l1 + 0.5D - d6) / (d10 / 2.0D);

 

if (d12 * d12 < 1.0D) {

for (int i2 = k; i2 <= j1; ++i2) {

double d13 = ((double) i2 + 0.5D - d7) / (d11 / 2.0D);

 

if (d12 * d12 + d13 * d13 < 1.0D) {

for (int j2 = l; j2 <= k1; ++j2) {

double d14 = ((double) j2 + 0.5D - d8) / (d10 / 2.0D);

 

if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) {

BlockPos blockpos = new BlockPos(l1, i2, j2);

 

IBlockState state = worldIn.getBlockState(blockpos);

if (state.getBlock().isReplaceableOreGen(state, worldIn, blockpos,

this.predicate)) {

worldIn.setBlockState(blockpos, this.oreBlock, 2);

}

}

}

}

}

}

}

}

 

return true;

}

}

 

 

Link to comment
Share on other sites

You set

ModWorldGen.nethergold

to an instance of

ModWorldGenMinable

instead of

ModNetherGenMinable

.

 

Why have you copy-pasted

WorldGenMinable

instead of extending it?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, Hi and I am making a forge 1.12.2 mod and also trying to get a custom model helmet item (I made a joker mask) and exported it to .json format and put it in the ~/namespace/models/item folder. Though, I'm struggling to get the item to render what I want it to be rendered like as I've positioned it in the 'head' window view in blockbench. How did you render out your model? I checked your code and it looks like no references to the actual model are being made. I'm new to this forge modding stuff (was a fabric modder) and I desperately need some help. Is there a way to standardly render out armor models made using blockbench? any methods that one can use? My model in JSON: ```json { "credit": "Made with Blockbench", "texture_size": [160, 160], "textures": { "0": "ydyrn:items/joker_mask_texture", "particle": "ydyrn:items/joker_mask_texture" }, "elements": [ { "from": [0, 0, 0], "to": [16, 16, 1], "faces": { "north": {"uv": [0, 1.7, 16, 14.2], "texture": "#0"}, "east": {"uv": [0, 4, 0.9, 5.6], "texture": "#0"}, "south": {"uv": [0, 5.8, 1.6, 7.4], "texture": "#0"}, "west": {"uv": [0, 1.9, 1.3, 3.5], "texture": "#0"}, "up": {"uv": [0, 3.4, 1.6, 4.2], "texture": "#0"}, "down": {"uv": [0, 9, 1.6, 9.7], "texture": "#0"} } }, { "from": [15.8, 11, 0.5], "to": [16.2, 13, 15], "faces": { "north": {"uv": [7.9, 7.9, 7.94, 8.1], "texture": "#0"}, "east": {"uv": [7.9, 7.9, 9.35, 8.1], "texture": "#0"}, "south": {"uv": [7.9, 7.9, 7.94, 8.1], "texture": "#0"}, "west": {"uv": [7.9, 7.9, 9.35, 8.1], "texture": "#0"}, "up": {"uv": [7.9, 7.9, 7.94, 9.35], "texture": "#0"}, "down": {"uv": [7.9, 7.9, 7.94, 9.35], "texture": "#0"} } }, { "from": [0.2, 11, 14.6], "to": [15.8, 13, 15], "faces": { "north": {"uv": [7.9, 7.9, 9.46, 8.1], "texture": "#0"}, "east": {"uv": [7.9, 7.9, 7.94, 8.1], "texture": "#0"}, "south": {"uv": [7.9, 7.9, 9.46, 8.1], "texture": "#0"}, "west": {"uv": [7.9, 7.9, 7.94, 8.1], "texture": "#0"}, "up": {"uv": [7.9, 7.9, 9.46, 7.94], "texture": "#0"}, "down": {"uv": [7.9, 7.9, 9.46, 7.94], "texture": "#0"} } }, { "from": [-0.2, 11, 0.5], "to": [0.2, 13, 15], "faces": { "north": {"uv": [7.9, 7.9, 7.94, 8.1], "texture": "#0"}, "east": {"uv": [7.9, 7.9, 9.35, 8.1], "texture": "#0"}, "south": {"uv": [7.9, 7.9, 7.94, 8.1], "texture": "#0"}, "west": {"uv": [7.9, 7.9, 9.35, 8.1], "texture": "#0"}, "up": {"uv": [7.9, 7.9, 7.94, 9.35], "texture": "#0"}, "down": {"uv": [7.9, 7.9, 7.94, 9.35], "texture": "#0"} } } ], "display": { "thirdperson_righthand": { "translation": [-0.25, -2.75, 0], "scale": [0.3, 0.3, 0.3] }, "thirdperson_lefthand": { "translation": [-0.25, -2.75, 0], "scale": [0.3, 0.3, 0.3] }, "firstperson_righthand": { "rotation": [-9, 115, 15], "translation": [0, 1.25, -1.75], "scale": [0.5, 0.5, 0.5] }, "firstperson_lefthand": { "rotation": [-9, 115, 15], "translation": [0, 1.25, -1.75], "scale": [0.5, 0.5, 0.5] }, "ground": { "rotation": [40, 0, 0], "translation": [0, -2.5, 0], "scale": [0.5, 0.5, 0.5] }, "gui": { "rotation": [0, 180, 0] }, "head": { "translation": [0, 0, 0.25], "scale": [0.82773, 0.73594, 0.9] }, "fixed": { "translation": [0, 0, 8.75] } }, "groups": [ 0, { "name": "straps", "origin": [0, 0, 0], "color": 0, "children": [1, 2, 3] } ] } ```
    • Add the crash-report or latest.log (logs-folder) with sites like https://paste.ee/ and paste the link to it here  
    • In your config folder, delete the sophisticatedcore-common.toml file and test it again
    • Add the crash-report or latest.log (logs-folder) with sites like https://paste.ee/ and paste the link to it here  
  • Topics

×
×
  • Create New...

Important Information

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