H 2 welcome to another Minecraft mon tutorial today I’m going to teach you how to generate structures in your world so here’s the structure that I’m going to be generating um don’t know why the FPS is just shockingly bad jeez um so inside just got a chest which I’m going to hopefully Generate random items in crafting table furnace torch also got a door and yeah I’m going to show you how this works so what I’ve done is I’ve split this into its different lay ERS now obviously that’s half a door and here’s Just the command to do that half of the door and here’s a command to do that half the door so the reason why I split it into layers is because we have to sort of say what each type of block is so um yeah so this layer here is we’re going To set that’s layer zero which is this layer right here the bottom layer not the bottom layer layer zero this is going to be layer minus one cuz we’re going to want it to be on ground so it’s going to be the one underneath and yeah So the way this works is coordinates so we got to write down the coordinates in this array array CU a coordinate is an array cuz x y z which is three numbers which is an array and we’re going to have an array which is like a list of These smaller arrays so that’s an array array so um this is layer minus one so this block right here we start from the front left this block right here is going to be 0 – one 0 and then it’s going to increase so that’s 0 Min – One one and so on and that’s just for each block type so we have to do that in an array array I’ll explain this later on so so in World gen we want to add a new class and I’m call it uh room gen and this has got Implement Implement I world Generator there you go and that’s going to make us want add some methods so add an implemented method which is just this method here actually and the first one that we’re going to have is this can replace one which just checks whether we can place it there so control shift o to import All of this another minecraft. material uh another Minecraft block and basically just checks whether it’s replaceable and then we’re going to also want a can spawn here checks whether we can spawn on it and that’s just fine it just generates um that’s needs to be five Sorry cuz as is 5 by 5 by five and yeah so that that checks where we can spawn it just going to have a place block helper method just helps us place blocks um control shift o to import that so we just place that and then a build layer this is actually what’s Going to build all of our stuff and um up here on the top are you going to make those array arrays so it’s going to just so the first one is going to be the spruce planks position Spruce planks cord now it’s going to be equal to and I Forgot to say it’s a int array array or array array equal to a new in Array array and let’s open it up and just want to say where each one is So 3 for Okay so we’ve done the Birch planks so now we’re going to be doing um all the other coordinates for all the other stuff so for all the other blocks that we don’t have a lot of it’s just a in say there’s just one so like this glass it’s just One interray so private int array and that’s glass cords is equal to a new int array smart me decided to use the wrong thing so you actually got to do extends world generator and then that should give us the correct method so add an implemented method Yeah and just want to change this to corner so then uh we’re just going to leave that return for want to check if can spawn here world and that’s the corner so if it can spawn here and let’s just change this to world just to make Our a bit easier so if it can spawn we’re going to first return true so that it has spawned state which block states that we’re using so for each of those blocks so I block State and this is going to be Spruce planks Spruce planks is equal to blocks do Planks Dot and then it’s this dot get state from meta and The Meta is in fact going to be block planks dot enum type dot um spruce. get metadata and we just copy and paste this and just change this to Spruce logs and just change this to log then we Want do I block State uh door lower and that’s equal to blocks Dot and it’s going to be called ACAA door dot get default state do with property block ocation or block door Dot and it’s going to be half and then the value is going to be Block door dot enum door half do lower and then we just want to do that for the other one except for it’s going to be higher do higher and then just change this to higher or high upper whatever and now we need to build the layer so build Layer the world front left corner is the corner the block positions so the first one that we’re going to do spruce planks so Spruce planks and block two place is going to be Spruce planks now I’m just going to do the spruce logs exactly the Same like I you can change this but by doing um the other one and then our chest is a bit different so just want to do Place block and um it’s just going to be World Corner chest cord chest so that’s just going to place our chest and now we Actually have to do some cool math thingies uh just to make sure we know where the Tity cuz we’re going to be randomly generate stuff in here so it is block pause actual pause is equal to corner do add and then uh that one and then it’s just going to be chest cords Zero chest cord one and chest cords two and that’s just going to add the appropriate amount now I want to get the tile entity so that’s tile entity chest uh chest te is equal to we got to cast this to a t entity chest entity chest and that’s world. get T entity at The actual pause so there you go we’ve got the T entity we’re going to check if the T does Exist by doing if chest te not equal to nothing and then we’ll do weighted random chest content dot generate chest contents random which is going to be world. Rand the list is Lists. new array list and then here we’re just going to put chest contents the chest TI entity and the max is six now we don’t actually have this we’re going to make this in a sec and I forgot to say all of these need to actually be final sorry so just Copy that make all of these final so that they can’t be changed cuz don’t we don’t want need to be changed really and then um just going to do a private weighted random chest content array chest content and that’s equal to new weighted chest random chest and we could do the Item one so that’s mod items. copper Apple it’s the minimum ch it’s just zero here the minimum chance is one maximum chance is four and the item we is just like the chance so I’m going to put it on five so you have a 5% chance of getting this and then a new Weighted okay so I’ve actually created a new package called structures put this structure in here um I’ve changed a couple of Stu where is it um I’ve just got torch and that like work and I’ve just got this little debug thing so it fills the chat Um I’ve made it so that the furnace and chest face the right way just using this uh I’ve actually created a different generator for it which is this at the moment you get quite a few of these I might you can just turn down the chance Of this cuz really might help because is quite a lot and just common proxy I’ve just got it at 10 like before and yeah and I’m going to say quite a lot this quite a lot yeah but everything works in these so this is actually a freshly spawned world Just go in here that seeds because destroyed them go in here we’ve got a torch got glass I haven’t altered these you can do that I haven’t in here we just got bones and yeah this is all generated in our world which is pretty pretty nice so if I just go for a couple of these we should eventually fight oh excuse me should eventually in one of these okay we got one of these chests we will find a copper Apple I have SE because I on I know I know there is one don’t you let me down on camera Apparently spawns in the water as well if it spawns in ocean that be hilarious sorry that bad FPS um yeah that’s the FR door let go come on je Louise yeah they do spawn quite a lot but you have to chase to fix that up as you like super more item item as Well and yeah you can just get put a it nothing inside there we go we have copper apples there we go and these are legit copper apples if I go into survival these do as they’re supposed to so yeah structure generation yeah so yeah thank you guys for watching Don’t forget to like comment and subscribe I am out don’t forget to watch any of my previous videos or the last tutorial so yeah go check them Out boom Video Information
This video, titled ‘Minecraft Modding Tutorial | Structure Generation (1.8.9)’, was uploaded by CJMinecraft on 2016-06-20 16:30:00. It has garnered 1401 views and 21 likes. The duration of the video is 00:16:03 or 963 seconds.
Watch todays modding tutorial to discover how to generate a structure in the world!
Can Replace Method – https://goo.gl/JPzHCq Place Block Methods – https://goo.gl/dOj7Gc Build Layer Method – https://goo.gl/cmCqTg Get Ground From Above Method – https://goo.gl/SmF4Jo Can Spawn Here Method – https://goo.gl/0wxWcS Room Structure Coords – https://goo.gl/2aLSbx
Don’t forget to like, comment and subscribe!
Links: ►My Website – http://cjminecraft.theclever.me/ ►Modding Tutorial List – http://cjminecraft.theclever.me/modding-tutorials.html ►Modding Tutorial Playlist – https://goo.gl/ZnZWTd ►Facebook – https://www.facebook.com/CJMinecraft01/ ►Google Plus – https://goo.gl/3n1umj ►SoundCloud – https://soundcloud.com/speed2-pc/ ►MCAmino – http://goo.gl/LzwZ9W ►Votable – http://www.votable.com/CJMinecraft
For modding help or if you want to contact me, email me at [email protected]
My Schedule: Monday or Thursday: ►Modding Tutorial Wednesday: ►SkyFactory 2