Jump to content

[1.8.9] [UNSOLVED] World generation


Bektor

Recommended Posts

UPDATE:

Ok, I got it nearly working. For testing purpose I decided to use lava. xD

 

aHKdBnx.png

 

Thats how it looks so far, but there is one problem.

Is there a way to remove the lava which is over the one block air level?

 

My current code:

    for(int x = 0; x < 16; ++x) {
        for(int z = 0; z < 16; ++z) {
            BiomeBase biomeBase = (BiomeBase)baseBiome[x * 16 + z];
            biomeBase.replaceBlocksForBiome(chunkX * 16 + x, chunkZ * 16 + z, blocks, state, baseBiome, noise);
            
            for(int y = 255; y >= 0; --y) {
                if(y <= this.random.nextInt(4)) {
                    primer.setBlockState((chunkX * 16 + x) & 15, y, (chunkZ * 16 + z) & 15, Blocks.bedrock.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 1, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 2, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 3, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 4, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 5, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 6, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    
// doesn't remove all lava... not working 
                    if(primer.getBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                        primer.setBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                        primer.setBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                }
            }
        }
    }

So everything above y + 6 should not generate the lava spots. (lava lakes are ok, but thats a future task for me)

 

Thx in advance.

Bektor

 

 

 

Hi,

 

I've got a question (which is a problem, too). So, I'm currently working on my own world generator for my

own dimension, but now I'm wondering how to generate bedrock at the bottom of the world.

 

Currently it's not generating in my world and when you dig down you just fell out of the world.

So does anyone got an idea how to genereate bedrock in a world generator cause I'm unable to find

out how Mojang does it and my own code isn't working (replaceBlockBiomes code...)

 

Thats my code which I tried:

private void replaceBlocksForBiome(int chunkX, int chunkZ, Block[] blocks, IBlockState[] state, BiomeGenBase[] baseBiome, float[] noise, ChunkPrimer primer) {
    ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, primer, world);
    MinecraftForge.EVENT_BUS.post(event);
    
    if(event.getResult() == Result.DENY) return;
    
    for(int x = 0; x < 16; ++x) {
        for(int z = 0; z < 16; ++z) {
            BiomeBase biomeBase = (BiomeBase)baseBiome[x * 16 + z];
            biomeBase.replaceBlocksForBiome(chunkX * 16, chunkZ * 16, blocks, state, baseBiome, noise);

            blocks[(z * 16 + x) * 256] = Blocks.bedrock;
            state[(z * 16 + x) * 256] = Blocks.bedrock.getDefaultState();
        }
    }
}

[i don't even know if that code is correct, I just now it gives me no errors]

 

For generating stuff I'm using OpenSimplexNoise and currently just generating a few layers of stone... no grass, no dirt, no hills, no caves etc.

 

Thx in advance.

Bektor

 

Developer of Primeval Forest.

Link to comment
Share on other sites

replaceBlocksForBiome is intended for replacing the top 4 blocks of stone with grass or sand (or at least, that's what Minecraft uses it for).  The bottom bedrock is handled by the chunk provider the last time I looked at it.

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

replaceBlocksForBiome is intended for replacing the top 4 blocks of stone with grass or sand (or at least, that's what Minecraft uses it for).  The bottom bedrock is handled by the chunk provider the last time I looked at it.

Ah, ok. Just thought I can use it for that purpose, too, because some mods do it [MC 1.7.10]. xD

So how is the chunk provider doing this? Everytime when I search for "bedrock" in the "ChunkProviderGenerate" from Mojang I can't find it. And "replaceBlocksForBiome" is a method inside of the chunk provider. ;)

 

Developer of Primeval Forest.

Link to comment
Share on other sites

Been a while since I looked at it, TBH.

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

If you look for usages of the

Blocks.bedrock

field, you'll see that it's used in

BiomeGenBase#generateBiomeTerrain

. This is called from

BiomeGenBase#genTerrainBlocks

, which is called from

ChunkProviderGenerate#replaceBlocksForBiome

.

 

Each biome generates its own terrain (including bedrock) from this method.

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

If you look for usages of the

Blocks.bedrock

field, you'll see that it's used in

BiomeGenBase#generateBiomeTerrain

. This is called from

BiomeGenBase#genTerrainBlocks

, which is called from

ChunkProviderGenerate#replaceBlocksForBiome

.

 

Each biome generates its own terrain (including bedrock) from this method.

Ok, thx. Now its mostly working..... I just broke MC down to 2FPS because I wanted to generate over the bedrock something else like which is generated like the bedrock.....

 

Any idea how my code must look to generate in (java) level 256 bedrock and in (java) 255 for example dirt?

Developer of Primeval Forest.

Link to comment
Share on other sites

Ok, I got it nearly working. For testing purpose I decided to use lava. xD

 

aHKdBnx.png

 

Thats how it looks so far, but there is one problem.

Is there a way to remove the lava which is over the one block air level?

 

My current code:

    for(int x = 0; x < 16; ++x) {
        for(int z = 0; z < 16; ++z) {
            BiomeBase biomeBase = (BiomeBase)baseBiome[x * 16 + z];
            biomeBase.replaceBlocksForBiome(chunkX * 16 + x, chunkZ * 16 + z, blocks, state, baseBiome, noise);
            
            for(int y = 255; y >= 0; --y) {
                if(y <= this.random.nextInt(4)) {
                    primer.setBlockState((chunkX * 16 + x) & 15, y, (chunkZ * 16 + z) & 15, Blocks.bedrock.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 1, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 2, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 3, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 4, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 5, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState());
                    primer.setBlockState((chunkX * 16 + x) & 15, y + 6, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    
// doesn't remove all lava... not working 
                    if(primer.getBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                        primer.setBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                        primer.setBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                    else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState())
                            primer.setBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState());
                }
            }
        }
    }

So everything above y + 6 should not generate the lava spots. (lava lakes are ok, but thats a future task for me)

 

Bektor

Developer of Primeval Forest.

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

    • For crash 1, set max-tick-time to -1 in your server.properties Crash 2 shows a conflict or incompatibility between LuckPerms and the mod boh-0.0.6.1-forge-1.20.1_2.jar
    • Add the crash-report or latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here  
    • so my minecraft crashes when opening my world, i played without any troubles for about 5 days and today it started tweaking.. pls help me
    • Hi guys! I am having some issues with the server crashing over and over and I was hoping to get some guidance.  Thanks in advance! Crash 1: java.lang.Error: ServerHangWatchdog detected that a single server tick took 60.00 seconds (should be max 0.05)     at net.minecraft.server.dedicated.ServerWatchdog.run(ServerWatchdog.java:43) ~[server-1.20.1-20230612.114412-srg.jar%23217!/:?] {re:classloading}     at java.lang.Thread.run(Thread.java:840) ~[?:?] { Crash 2: java.lang.IllegalStateException: Capability missing for eeb7f026-34b4-42f5-9164-e7736461df83     at me.lucko.luckperms.forge.capabilities.UserCapabilityImpl.lambda$get$0(UserCapabilityImpl.java:66) ~[?:?] {re:classloading,re:classloading,re:classloading}     at net.minecraftforge.common.util.LazyOptional.orElseThrow(LazyOptional.java:261) ~[forge-1.20.1-47.3.10-universal.jar%23222!/:?] {re:mixin,re:classloading}     at me.lucko.luckperms.forge.capabilities.UserCapabilityImpl.get(UserCapabilityImpl.java:66) ~[?:?] {re:classloading,re:classloading,re:classloading}     at me.lucko.luckperms.forge.util.BrigadierInjector$InjectedPermissionRequirement.test(BrigadierInjector.java:143) ~[?:?] {}     at me.lucko.luckperms.forge.util.BrigadierInjector$InjectedPermissionRequirement.test(BrigadierInjector.java:129) ~[?:?] {}     at com.mojang.brigadier.tree.CommandNode.canUse(CommandNode.java:65) ~[brigadier-1.1.8.jar%2376!/:?] {}     at com.mojang.brigadier.CommandDispatcher.parseNodes(CommandDispatcher.java:359) ~[brigadier-1.1.8.jar%2376!/:?] {}     at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:349) ~[brigadier-1.1.8.jar%2376!/:?] {}     at com.mojang.brigadier.CommandDispatcher.parse(CommandDispatcher.java:317) ~[brigadier-1.1.8.jar%2376!/:?] {}     at net.minecraft.commands.Commands.m_230957_(Commands.java:237) ~[server-1.20.1-20230612.114412-srg.jar%23217!/:?] {re:classloading}     at net.mcreator.boh.procedures.TeleportbenProcedure.lambda$execute$2(TeleportbenProcedure.java:65) ~[boh-0.0.6.1-forge-1.20.1_2.jar%23165!/:?] {re:classloading}     at net.mcreator.boh.BohMod.lambda$tick$2(BohMod.java:96) ~[boh-0.0.6.1-forge-1.20.1_2.jar%23165!/:?] {re:classloading}     at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {re:mixin}     at net.mcreator.boh.BohMod.tick(BohMod.java:96) ~[boh-0.0.6.1-forge-1.20.1_2.jar%23165!/:?] {re:classloading}     at net.mcreator.boh.__BohMod_tick_ServerTickEvent.invoke(.dynamic) ~[boh-0.0.6.1-forge-1.20.1_2.jar%23165!/:?] {re:classloading,pl:eventbus:B}     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.event.ForgeEventFactory.onPostServerTick(ForgeEventFactory.java:950) ~[forge-1.20.1-47.3.10-universal.jar%23222!/:?] {re:classloading}     at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:835) ~[server-1.20.1-20230612.114412-srg.jar%23217!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaerominimap:xaero_minecraftserver,re:classloading,pl:accesstransformer:B,xf:fml:xaerominimap:xaero_minecraftserver,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[server-1.20.1-20230612.114412-srg.jar%23217!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaerominimap:xaero_minecraftserver,re:classloading,pl:accesstransformer:B,xf:fml:xaerominimap:xaero_minecraftserver,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23217!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaerominimap:xaero_minecraftserver,re:classloading,pl:accesstransformer:B,xf:fml:xaerominimap:xaero_minecraftserver,pl:mixin:A}     at java.lang.Thread.run(Thread.java:840) ~[?:?] {}
    • Hello there! I am trying to make custom dimensions for a modpack I am making in an older minecraft version, 1.16.5. I like that version and it has a few other mods that have not been updated that I would still like to use. Anyway, I am having a terrible time with getting my dimension to work and have tried using code from other peoples projects to at least figure out what I'm supposed to be doing but it has not been as helpful as I would have liked. If anyone could help that would be greatly appreciated! Here is my github with all the code as I am using it: https://github.com/BladeColdsteel/InvigoratedDimensionsMod I have also included the last log, https://pastebin.com/zX9vsDSq, I had when I tried to load up a world, let me know if there is anything else I should send though, thank you!
  • Topics

×
×
  • Create New...

Important Information

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