Posted November 18, 20159 yr Hi. Im looking for a code to make a Instant structure. Ive been searching everywhere. So maybe somebody here does know a tutorial our code? greetz Chris || Thanks in advance!
November 18, 20159 yr Author Instant structure? Like if you click somewhere a building appears? Yes if you place the block there comes a structure.
November 18, 20159 yr Look at vanilla villages or schematics. You basically just need to call world.setBlock until your structure is built. http://i.imgur.com/NdrFdld.png[/img]
November 18, 20159 yr Author Look at vanilla villages or schematics. You basically just need to call world.setBlock until your structure is built. I will try , but i dont think its easy !
November 18, 20159 yr Author Look at vanilla villages or schematics. You basically just need to call world.setBlock until your structure is built. Nope , thats not it. Somebody another method?
November 18, 20159 yr 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. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
November 18, 20159 yr Author 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?
November 18, 20159 yr When your mod block is placed, you call World#setBlock for all of the blocks in your structure. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
November 18, 20159 yr Author When your mod block is placed, you call World#setBlock for all of the blocks in your structure. So i need to built the structure in codes (kinda?)
November 18, 20159 yr Author When your mod block is placed, you call World#setBlock for all of the blocks in your structure. Im new in the advanced modding but i want to learn.
November 18, 20159 yr 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.
November 18, 20159 yr 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
November 18, 20159 yr Author Sorry if im annoying you , im so hyper. But i will search it again on myself. Thought that people can just give tips.
November 18, 20159 yr Author 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".
November 18, 20159 yr How much pay? "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
November 18, 20159 yr How much pay? 15? I repeat, you're not going to learn if you just pay someone to do it for you. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
November 18, 20159 yr Author How much pay? 15? Im now doing it by myself , using schematics & MCEdit I repeat, you're not going to learn if you just pay someone to do it for you.
November 18, 20159 yr Author How much pay? 15? I repeat, you're not going to learn if you just pay someone to do it for you. Im doing/trying in on myself*
November 19, 20159 yr 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). http://i.imgur.com/NdrFdld.png[/img]
November 19, 20159 yr Author 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!
November 19, 20159 yr Author 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
November 20, 20159 yr This is a good example why it is good to work through a problem yourself (instead of paying people). You actually learned something. 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.