Jump to content

Recommended Posts

Posted
  On 5/31/2014 at 2:41 AM, theOriginalByte said:

there is an error in you world generation code...

it should be (...).generate(world, rand, randPosX, randPosY, randPosZ)

 

Excuse me if I'm wrong, but in the images currently posted, I don't see that error anywhere. And if it was there, the OP would be getting a runtime error and the minecraft client wouldn't even run.

 

  Quote

the client runs normally but I searched the new ores in the world but they doesn't generate. where I mistake?

 

 

  Reveal hidden contents

 

 

You aren't using the x, y, and z values you generated in each for loop.

i.e. you should be calling this:

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

 

But instead you are calling this:

(new WorldGenMinable(...)).generate(world, random, chunkX, chunkY, chunkZ);

 

Even though these are technically valid coordinates in the world, they are not the coordinates you generated. The reason you can't find any ores is A) they are all spawning in the same area in each chunk, and B) chunkY is set to 0, therefore it is being spawned under bedrock, however, since ores can only be spawned in stone, it just isn't spawning anything. Does that make sense?

 

Posted
  On 5/31/2014 at 1:04 PM, SimonSlime said:

I tried (new WorldGenMinable(simonsoresMod.PlatinumOre, 50)).generate(world, random, x, y, z); but it's equal

 

Could you please post your current code so I can see all of it?

Posted

SimonGenerator.java

 

package com.example.simonsores.generation;

 

import java.util.Random;

 

 

 

 

 

 

 

import com.example.simonsores.simonsoresMod;

 

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 SimonGenerator implements IWorldGenerator

{

private static final int chunkY = 0;

 

public SimonGenerator() {

// TODO Auto-generated constructor stub

}

 

@Override

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

{

switch(world.provider.dimensionId)

{

case -1:

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

break;

case 0:

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

break;

case 1:

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

break;

}

}

 

private void generateInNether(World world, Random random, int chunkX, int chunkZ) {

 

}

 

 

private void generateInOverworld(World world, Random random, int chunkX, int chunkZ)

{

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

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

int y = random.nextInt(300);

int z = random.nextInt(16);

(new WorldGenMinable(simonsoresMod.PlatinumOre, 50)).generate(world, random, x, y, z);

}

 

{

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

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

int y = random.nextInt(300);

int z = random.nextInt(16);

(new WorldGenMinable(simonsoresMod.CobaltOre, 20)).generate(world, random, x, y, z);}}

}

 

private void generateInEnd(World world, Random random, int chunkX, int chunkZ) {

 

}

}

Posted

I tried in this way, did you mean this?

 

private void generateInOverworld(World world, Random random, int chunkX, int chunkZ)

{

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

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

int y = random.nextInt(300);

int z = random.nextInt(15);

(new WorldGenMinable(simonsoresMod.PlatinumOre, 50)).generate(world, random, x, y, z);

}

Posted

SimonSlime, I believe what he means is, as you had to do with your X coordinate, you have to add the chunkZ to your Z variable. Does that make sense? I can give a further explanation if you do not understand why, it's important you understand why things work, not just that they do.

 

diesieben07, is that what you meant?

Posted

ok then maybe did you mean this? sorry but it's my first generation  :-\

 

{

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

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

int y = random.nextInt(300);

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

(new WorldGenMinable(simonsoresMod.PlatinumOre, 50)).generate(world, random, x, y, z);

}

Posted

ok ok I fixed it! the error was in the main.java.

 

I had written

 

    GameRegistry.registerWorldGenerator(gen, 1);

 

and I have changed it with

 

    GameRegistry.registerWorldGenerator(new SimonGenerator(), 1);

 

I don't know why I did this stupid mistake but the important thing is that now it works! thank you all! :)

 

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

    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
    • Where did you get the schematic? Source/Link? And do use an own modpack or a pre-configured from curseforge? If yes, which one On a later time, I can make some tests on my own - but I need the schematic and the modpack name
  • Topics

×
×
  • Create New...

Important Information

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