Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Generating Ores in Chunks of One


Recommended Posts

Hello, I am trying to make a block of mine(richOreCopper) generate in veins of one ore each. Currently, I'm using the same code that I use for other ores, and just setting WordGenMineable's size to 1; However, this seems like it isn't working. This is my code:


public class ModWorldGen implements IWorldGenerator {

    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
        if (world.provider.getDimension() == 0){ //Overworld
            generateOverworld(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);

    private void generateOverworld(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
        generateOre(ModBlocks.oreCopper.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 16, 64, 4 + random.nextInt(4), 6);
        generateOre(ModBlocks.richOreCopper.getDefaultState(), world, random, chunkX * 16, chunkZ * 16, 16, 64, 1, 6);

    private void generateOre(IBlockState ore, World world, Random random, int x, int z, int minY, int maxY, int size, int chances) {
        int deltaY = maxY - minY;

        for(int i = 0; i < chances; i++) {
            BlockPos pos = new BlockPos(x + random.nextInt(16), minY + random.nextInt(deltaY), z + random.nextInt(16));

            WorldGenMinable generator = new WorldGenMinable(ore, size);
            generator.generate(world, random, pos);

I know it isn't a problem with that block specifically because I've gotten it to generate by setting the size to a larger number. Does anybody know what the issue could be?? Thanks!

Link to comment
Share on other sites

Probably because the random had values used up so it's placing those solo blocks somewhere else.

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

hmm... I've experienced the exact same thing. Im not sure how to fix it, but I can tell you that for some reason one of the if statements in WorldGenMineable::generate never passes with a vein size of 1... Not sure which one though... I can't access a computer right now...



Not entirely sure why - I'm not that great at math, but with some debugging I'm pretty sure that it's this line in WorldGenMineable...

Edited by Socratic_Phoenix

Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes).

I know Java pretty well... So yeah...


This is where I'd put an inspirational and/or clever quote, but I can't think of one right now...

This is the output of the totally, 100% working compiler for my programming language, Planet9:

Beginning Compilation...
Failed compilation!
planet9.compiler.error.CompilationException: Compiler not yet implemented
	at planet9.compiler.Compiler.compile(Compiler.java:39)
	at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)


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.

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

    • This is my code. How can I change it to have "Hello world!" show on the screen? @Mod(Chants2.MODID) public class Chants2 { public static final String MODID = "chants2"; public Chants2(){ final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); final ClientSideOnlyModEventRegistrar clientSideOnlyModEventRegistrar = new ClientSideOnlyModEventRegistrar(modEventBus); registerCommonEvents(modEventBus); DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> clientSideOnlyModEventRegistrar::registerClientOnlyEvents); } public void registerCommonEvents(IEventBus eventBus) { //eventBus.register(GuiHandler.class); } } public class ClientSideOnlyModEventRegistrar { private final IEventBus eventBus; public ClientSideOnlyModEventRegistrar(IEventBus eventBus) { this.eventBus = eventBus; } public void registerClientOnlyEvents() { eventBus.register(GuiHandler.class); } } public class GuiHandler { String text = "Hello world!"; @SubscribeEvent public void onRenderGui(RenderGameOverlayEvent.Post event) { drawString(event.getMatrixStack(), Minecraft.getInstance().font, text, event.getWindow().getWidth() / 2, event.getWindow().getHeight() / 2, Integer.parseInt("33AA66", 16)); } }  
    • why do you need the JDA API in MinecraftForge?
    • you also can look at the StonecutterScreen, but basically you moved the scrolling bar via mouse scroll or mouse drag (you set the y pos where it will render in the screen), after moving you can update the screen on client then send a custom packet to the server and updating the screen there
    • You still capitalizing every word... the name sounds like it will return a ResourceLocation or the mod id, not sure because urbanxx001 didn't say what the method does can you actually explain your exact goal to us, because it can be that there is a easier way to do this
    • I've got capabilities and I was just wondering if there's a way to add a statistic with the value of that capability to the stat menu, so I can make my mod more useable with FTB quests and other similar mods which can take in a statistic to trigger an event
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.