Jump to content

Instant Structure is that possible? (PAYED IF HELPED)


chrisknoop

Recommended Posts

coolAlias' suggestion is the correct method. Tells us what you tried (show your code) and tell us went wrong and we'll probably be able to help you.

i did delete the code , but the problem is i dont get what i should do with "You basically just need to call world.setBlock until your structure is built."

 

what does he means?

 

 

Link to comment
Share on other sites

So i need to built the structure in codes (kinda?)

 

Yes. Structures are not magic.

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

So i need to built the structure in codes (kinda?)

 

Yes.

 

Im new in the advanced modding but i want to learn.

 

Sticking "PAYED IF HELPED" in your titles isn't a good way to learn.

 

 

nobody :'( im willing to pay money

 

Be patient, not everybody can spend all day on forums helping people. We have real lives too.

 

 

P.S. "paid" is the past tense of "pay", not "payed".

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Link to comment
Share on other sites

So i need to built the structure in codes (kinda?)

 

Yes.

 

Im new in the advanced modding but i want to learn.

 

Sticking "PAYED IF HELPED" in your titles isn't a good way to learn.

 

 

nobody :'( im willing to pay money

 

Be patient, not everybody can spend all day on forums helping people. We have real lives too.

 

Sorry for the annoying part , im now finding out that is works with schematics & MCEdit.

P.S. "paid" is the past tense of "pay", not "payed".

Link to comment
Share on other sites

When / where should the structure generate? During world gen, when using an item, or somewhere else? That makes a big difference in how you initiate the execution of your code, i.e. where you get your variables from, but once you have that, it literally is just #setBlock.

 

You need to take the time to plan out your structure, though, and figure out where each block needs to be in relation to some point of origin, or you can get fancier and allow your structure to rotate - again, look at vanilla village structures for some fine examples of how to do it, and look especially at the various helper methods they have created e.g. fillWithBlocks - these make your life MUCH easier.

 

Pseudocode example creating a cube filled with air, i.e. a basic 'room'-like structure, assuming you have written a method named 'fillWithBlocks' that sets every block within an area relative to a BlockPos to a specific block:

// method you make sure is called from somewhere
public boolean generate(World world, BlockPos pos) {
  fillWithBlocks(world, pos, 0, 0, 0, 5, 5, 5, Blocks.cobblestone);
  fillWithBlocks(world, pos, 1, 1, 1, 4, 4, 4, Blocks.air); // leave 1 block on all sides
  BlockPos doorPos = pos.east(2).up(); // 2 blocks to the east and 1 block up should be in the center of the south wall
  world.setBlockState(doorPos, Blocks.air.getDefaultState(), 2); // just an open-air doorway for now
  world.setBlockState(doorPos.up(), Blocks.air.getDefaultState(), 2);
}

Now all you have to do is figure out how to write a method 'fillWithBlocks' like I described (shouldn't be that difficult) or figure out how to use the vanilla StructureComponent class and methods, and you can have yourself a cobblestone hut.

 

More complicated structures are obviously more difficult, even more so if you have blocks that care about metadata / rotation, or you want your structure to face in random directions, or you want to add loot and other things, but at the core of it all is world#setBlock (or, in 1.8, world#setBlockState).

Link to comment
Share on other sites

When / where should the structure generate? During world gen, when using an item, or somewhere else? That makes a big difference in how you initiate the execution of your code, i.e. where you get your variables from, but once you have that, it literally is just #setBlock.

 

You need to take the time to plan out your structure, though, and figure out where each block needs to be in relation to some point of origin, or you can get fancier and allow your structure to rotate - again, look at vanilla village structures for some fine examples of how to do it, and look especially at the various helper methods they have created e.g. fillWithBlocks - these make your life MUCH easier.

 

Pseudocode example creating a cube filled with air, i.e. a basic 'room'-like structure, assuming you have written a method named 'fillWithBlocks' that sets every block within an area relative to a BlockPos to a specific block:

// method you make sure is called from somewhere
public boolean generate(World world, BlockPos pos) {
  fillWithBlocks(world, pos, 0, 0, 0, 5, 5, 5, Blocks.cobblestone);
  fillWithBlocks(world, pos, 1, 1, 1, 4, 4, 4, Blocks.air); // leave 1 block on all sides
  BlockPos doorPos = pos.east(2).up(); // 2 blocks to the east and 1 block up should be in the center of the south wall
  world.setBlockState(doorPos, Blocks.air.getDefaultState(), 2); // just an open-air doorway for now
  world.setBlockState(doorPos.up(), Blocks.air.getDefaultState(), 2);
}

Now all you have to do is figure out how to write a method 'fillWithBlocks' like I described (shouldn't be that difficult) or figure out how to use the vanilla StructureComponent class and methods, and you can have yourself a cobblestone hut.

 

More complicated structures are obviously more difficult, even more so if you have blocks that care about metadata / rotation, or you want your structure to face in random directions, or you want to add loot and other things, but at the core of it all is world#setBlock (or, in 1.8, world#setBlockState).

 

Thanks for all that information im getting it now!

I just need to build the structure in codes & figure out how i let it spawn in by placing a block!

Link to comment
Share on other sites

When / where should the structure generate? During world gen, when using an item, or somewhere else? That makes a big difference in how you initiate the execution of your code, i.e. where you get your variables from, but once you have that, it literally is just #setBlock.

 

You need to take the time to plan out your structure, though, and figure out where each block needs to be in relation to some point of origin, or you can get fancier and allow your structure to rotate - again, look at vanilla village structures for some fine examples of how to do it, and look especially at the various helper methods they have created e.g. fillWithBlocks - these make your life MUCH easier.

 

Pseudocode example creating a cube filled with air, i.e. a basic 'room'-like structure, assuming you have written a method named 'fillWithBlocks' that sets every block within an area relative to a BlockPos to a specific block:

// method you make sure is called from somewhere
public boolean generate(World world, BlockPos pos) {
  fillWithBlocks(world, pos, 0, 0, 0, 5, 5, 5, Blocks.cobblestone);
  fillWithBlocks(world, pos, 1, 1, 1, 4, 4, 4, Blocks.air); // leave 1 block on all sides
  BlockPos doorPos = pos.east(2).up(); // 2 blocks to the east and 1 block up should be in the center of the south wall
  world.setBlockState(doorPos, Blocks.air.getDefaultState(), 2); // just an open-air doorway for now
  world.setBlockState(doorPos.up(), Blocks.air.getDefaultState(), 2);
}

Now all you have to do is figure out how to write a method 'fillWithBlocks' like I described (shouldn't be that difficult) or figure out how to use the vanilla StructureComponent class and methods, and you can have yourself a cobblestone hut.

 

More complicated structures are obviously more difficult, even more so if you have blocks that care about metadata / rotation, or you want your structure to face in random directions, or you want to add loot and other things, but at the core of it all is world#setBlock (or, in 1.8, world#setBlockState).

 

ahhh , i see you can use onBlockActivated to make it spawn when i place the block ;)

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



×
×
  • Create New...

Important Information

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