Hello and welcome back to another tutorial today we’re going to be going over features and features allow us to add custom world gen into the game such as grass bushes or trees so in our world.surface package let’s create another new package called world dot feature and inside the feature package We’re going to create a new class called example feature and this is going to extend feature of no feature config then let’s hover over this and add our constructor and we can remove the to do and then let’s add our unimplemented generate method and in mod maps this Won’t have a name and this will be called apply instead of generate and now in here all we need to do is actually generate our feature and this will be cooled every time our feature spawns in the world so we want to make sure to do As little as possible to minimize lag so next what we’re going to do is basically make like a custom bush and to do that we need to make sure to always generate it on the bottom of the world so in order to do that we need to loop from The position from which we start and keep going down until we hit a block so we’re going to add a while loop and we’re going to check while pause dot get y is greater than one so we’re going to check that it is still inside the world and is air or leaves And here we’re going to check that it isn’t all leaves because we don’t want to be able to place our block on leaves and for that we’re going to need to pass in the reader and the position and while it’s doing that we’re going to set pause to pause Dot down and on mod maps this will be below so now let’s create our public boolean is air or leaves and this is going to take an eye world generation base reader we’re going to call this reader and a block pause pause and we’re going to check if the reader isn’t an instanceof I world reader and we’re going to return reader dot has block state or is state at position and we’re going to pass in the pause and a predicate and we’re going to take the state and for our predicate we’re going to check if the state is air Or state dot is in block tags dot leaves and on mod maps this will be just dot is and then we can hover over this and add warnings suppress deprecation to get rid of this error however if it is an instance of iworld reader instead we can return reader dot has block state Or is state at position in mod maps and then we’re going to go to state to state dot can be replaced by leaves then we pass in the reader and the position and we need to cast this to an instance of i world reader so now the pos is going to Be the block at the bottom so now let’s just set pause to pause dot up to make sure that we’re on the block above the bottom block of the world and now all we need to do now that we have our position is to place our feature however First let’s create a block state for the block that we’re going to place so let’s do a private static final block state and i’m just going to call this example block since this is just going to be equal to block init dot example block dot get so we get the Block and then dot get default state so here’s our example block state and now under here we can do set block state or set block on mod maps where we’re going to put in the reader the position and an example block however i’m going to make a bit of a Loop so i’m going to do 4 int i is equal to 0 i is less than 4 i plus plus we’re going to loop this and we’re going to do this 4 times but each time we’re going to do pause dot up i so this is going to create a full tool Pillar of example blocks so the first time it’s going to loop through it’s going to add 0 then it’s going to add 1 to the y and this is going to go up to three so eventually we’ll have a full tool pillar of example blocks and next what i’m going to do is Create another block state down here and this is just going to be called stone and i’m going to set this to blocks dot stone dot get default state so you can see that when we use a minecraft one we don’t need to add the dot get And then i’m going to set block state of pause dot down one so under the pillar and we’re just going to set this to stone and that’s it for my example feature class obviously you can do a lot more with this and i’ll be showing you How to create a tree with this class in the next episode so then let’s go to our already existing feature in its class from when we did the awes very early on and in here we’re going to add a deferred register so we’re going to create a public static final deferred Register of feature of any config and this is going to be called features and it’s going to be equal to deferred register dot create then we pass in forward registries dot features and then our tutorial mod dot mod id and then to add a feature we’re going to create a Public static final registry object of example feature and i’m going to call this example feature and we’re going to set this equal to features dot register then we pass in the name so example feature and then we need a supplier of our new example feature but then you can See that we need to pass in a codec so we can do no feature config dot field two three six five five eight a and on mod maps that would be codec and now we need to register our feature in it in our main class so let’s go over There and above our surface builders we’re going to do feature init dot features dot register of bus and that is it for our java now we need to do some jsons so we need to tell our biome class how this feature is going to be placed we’ve already set at The height at which it’s going to place but we don’t know the frequency or how it’s going to generate so to do that we need a configured feature so in our data world gen class let’s create another new package called dot configured feature and in there we’re going to create a new File called example feature dot json however to fill this out we’re once again going to use missiles data generator on missout.github.io so if we go to misso.github.io and click on well gen and feature you can see that it’s going to give us a json however we don’t need Most of this we’re going to leave this as decorated and leave this as count but we’re going to change the feature to decorated as well then we need to select a decorator and once again we’re going to be selecting decorated then for our outer we’re going to select square and inner We’re going to select height map spread double and you can do what you want here but i’m just going to use this since this has worked for me and then for our feature i’m going to select no op and we’re going to be replacing that with our tutorial mod the count is basically How much you want per chunk i’m just going to set this to something like 4 and then i’m going to copy the json generated and paste it into the world over here you can select the ways in which and generates so a chance generator i’m just going to leave this As square as height map and you can also change the way in which it generates up here i’m going to paste this in and change this to tutorial mode colon example feature now let’s add it to our biome in our example bio we can scroll down to the different generation stages which i Explained before and we’re just going to put this at the top since this generates on the surface so down here let’s add tutorial mod colon example feature now we can run the game but not before a short message from our sponsor this video is sponsored by mtx serve mtx serve provides premium Game servers for titles such as minecraft rust and valheim click the link in the description and use code cy4 to get five percent off your server today and i actually made a change so that the block underneath the pillar is going to be a shroom light since the stone is Already visible and you can see that with all the example block pillars we have a shroom light underneath so that means that our feature is generating this is a very interesting biome and that is going to do it for this video if you need a minecraft server check out mtxserv.com If you need any help join the discord and we also have an epic community minecraft server that you can play on in the next episode i’m probably going to be covering trees and i’ll see you next time Video Information
This video, titled ‘Minecraft Modding Tutorial 1.16 | 26.0 – Features’, was uploaded by Cy4’s Modding on 2021-08-13 13:03:14. It has garnered 1997 views and 70 likes. The duration of the video is 00:09:08 or 548 seconds.
MODDED COMMUNITY SERVER! join via discord below 😀
(ɔ◔‿◔)ɔ ♥ ~ expand me
C://mTxServ/ Check out mTxServ for premium + affordable game servers: https://mtxserv.com/ Use codes: cy4-3, cy4-6, cy4-16, and cy4-32 for 5% off!
C://Help/ Discord: https://discord.gg/x9Mj63m4QG Or comment on this video!
C://Sources/ Ilja615’s World Upgrade: https://github.com/ilja615/WorldUpgrade/
C://Follow_Me/ Subscribe: https://www.youtube.com/channel/UCJIDXtGpf4wv1ybDzdTA_vQ/ Website: https://cy4shot.github.io/
C://Time_Stamps/ 00:00 – Intro 00:11 – Feature Class 04:41 – FeatureInit Class 06:00 – ConfiguredFeature JSON 08:07 – mTxServ.com 08:19 – Testing 08:39 – Outro
C://Source_Code/ This Episode: https://github.com/Cy4Shot/ModdingTutorial1.16/tree/main/26.0-Features All Episodes: https://github.com/Cy4Shot/ModdingTutorial1.16/