Jump to content

Recommended Posts

Posted (edited)

What is the best way to generate structures bigger than a chunk? Are there tutorials for it?

I've looked it up online and I know that WorldGenerator shouldn't be used for things bigger than a chunk, and I've seen that the bigger structures in minecraft like strongholds and the woodland mansion have chunkproviders, but I haven't found any tutorials on those.

Edited by GooberGunter
Posted

Use Structure Blocks. You can look at Igloos and newer Minecraft structures for example. Basically, all you need to do is build your structure, save it to NBT using Structure Blocks, and load it in through a Template.

 

If you want a structure bigger than 32x32, you can make multiple Structure Blocks and when you spawn the structure in you can the multiple files in and just offset positions depending on the piece. I have some code on my GitHub as well using Structure Blocks.

Developer of Levels and Lost Eclipse

Posted

Yes - instead of having a bunch of setBlockState calls specifying every single block in your structure, you can load your structure from NBT in a very few lines of code. Just call the template method to set the blocks in the world in your WorldGenerator class.

Developer of Levels and Lost Eclipse

Posted
  On 7/16/2017 at 1:27 PM, TheXFactor117 said:

you can load your structure from NBT in a very few lines of code

Expand  

And that "structure" can include the air you want as a buffer around and/or above.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted
  On 7/16/2017 at 1:14 AM, TheXFactor117 said:

Use Structure Blocks. You can look at Igloos and newer Minecraft structures for example. Basically, all you need to do is build your structure, save it to NBT using Structure Blocks, and load it in through a Template.

 

If you want a structure bigger than 32x32, you can make multiple Structure Blocks and when you spawn the structure in you can the multiple files in and just offset positions depending on the piece. I have some code on my GitHub as well using Structure Blocks.

Expand  

Is this method also supported in 1.10.2? If so, can I still have some randomization in structures?

Posted

Yes, I believe structure blocks were added in 1.10.

 

As for randomization, what exactly do you want randomized? One draw back of loading from NBT that I found is you can't change the blocks that are saved in the NBT. I haven't looked into it too much though, so there might be a way. You can use Data Blocks to put on top of chests or other important blocks to load loot tables for example too.

Developer of Levels and Lost Eclipse

Posted

You don't need a structure class. Create a Template variable which loads your NBT file through a ResourceLocation. Once you have a template, just call addBlocksToWorld or whatever the method is called.

Developer of Levels and Lost Eclipse

Posted

When saving your structure, place a monster spawner (the default one) and place a data block on top of it and name it like monster_spawner or something. When you add the blocks to the world, you can call a method which will handle the data blocks. Here is my method for handling data blocks for an example.

 

Essentially you just need to loop through all data blocks in the structure - if the data block name matches the one you are looking for, you can do stuff with the block underneath. For example in my structures, I'm setting the loot table for the chest. For monster spawners, you can get an instance of the Tile Entity and modify it there. After you are done modifying it, simply set the data block to an air block or whatever block you want (or else it'll spawn a random block based on where it is located).

  • Like 1

Developer of Levels and Lost Eclipse

  • 1 year later...
Posted
  On 7/16/2017 at 1:14 AM, TheXFactor117 said:

Use Structure Blocks. You can look at Igloos and newer Minecraft structures for example. Basically, all you need to do is build your structure, save it to NBT using Structure Blocks, and load it in through a Template.

 

If you want a structure bigger than 32x32, you can make multiple Structure Blocks and when you spawn the structure in you can the multiple files in and just offset positions depending on the piece. I have some code on my GitHub as well using Structure Blocks.

Expand  

Hey TheXFactor, did you move the code to somewhere else?  I wanted to look at some code examples with multiple structure blocks in only one structure but the link that you posted is no longer available. 

Do you know other tutorials/code that can help me?

Posted
  On 8/3/2018 at 3:42 PM, JDL said:

Hey TheXFactor, did you move the code to somewhere else?  I wanted to look at some code examples with multiple structure blocks in only one structure but the link that you posted is no longer available. 

Do you know other tutorials/code that can help me?

Expand  

He still has some old tutorials posted on GitHub: https://github.com/doctorhealt3/TheXFactor117s-Forge-Tutorials/blob/master/OldTutorials.md but I can't find anything relevant to this topic. 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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

    • Make a test with another Launcher like the Curseforge Launcher, MultiMC or AT Launcher
    • can anyone help me i am opening forge and add modpacks and then it says unable to update native luancher and i redownlaod java and the luancher it self?
    • The problem occurs also in 1.20.1 Forge, but with an "Error executing task on client" instead. I have "Sinytra Connector" installed. On 1.21.5 Fabric, there is no problem. When this happens, the chat message before the death screen appears gets sent, with an extra dash added.
    • Well, as usual, it was user error. Naming mismatch in sounds.json.  Please delete this post if you find it necessary. 
    • Hello Forge community.  I'm running into an issue with a mod I'm working on.  To preface, I can call /playsound modId:name music @a and I can hear the sound I registered being played in game. Great!  However, I cannot get it to trigger via my mod code.    Registration: public static final RegistryObject<SoundEvent> A_WORLD_OF_MADNESS = SOUND_EVENTS.register("a_world_of_madness", () -> new SoundEvent(new ResourceLocation("tetheredsouls", "a_world_of_madness")));   Playback: Minecraft mc = Minecraft.getInstance(); if (!(mc.player instanceof LocalPlayer) || mc.level == null) return; LocalPlayer player = (LocalPlayer) mc.player; BlockPos pos = player.blockPosition(); SoundEvent track = ModSounds.A_WORLD_OF_MADNESS.get(); System.out.println(track); System.out.println(pos); System.out.println(player); // play exactly like the tutorial: client-only, at the player's position try { mc.level.playLocalSound( player.getX(), player.getY(), player.getZ(), track, SoundSource.MUSIC, // Or MASTER if needed 1f, 1f, false ); System.out.println("[DEBUG] playSound success: " + track.getLocation()); } catch (Exception e) { System.err.println("[ERROR] Failed to play sound: " + track.getLocation()); e.printStackTrace(); } Sounds.json:   { "theme_of_laura": { "category": "music", "sounds": [ { "name": "tetheredsouls:a_world_of_madness", "stream": true } ] } } Things I have tried: - multiple .ogg files. Short .ogg files (5 seconds, <100KB).  - default minecraft sounds imported from import net.minecraft.sounds.SoundEvents; These work given my code. No idea why these are different.  - playSound() method, as well as several others in past iterations that did not work   I would be forever grateful if somebody could point me in the right direction. I've looked at several mod github repositories and found extremely similar code to what I'm doing. I've also found several threads in this forum that did not solve my issue. I just cannot figure out what I'm doing differently, and why I'm able to queue sounds manually with playsound but the code won't play it (despite confirming the code is being run with the debug statements.)
  • Topics

×
×
  • Create New...

Important Information

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