Wel to another Minecraft mon St today I’m going to teach you how to add a RF generator to the game so um this is my generator so far it’s a redstone generator it looks pretty damn awesome I I’m tough with the texture um I recommend watching samasaurus6 That we might just write out I’m not sure about that yet and this is the RF bar so we’re going to make it so this bar fills up at the moment it’s full I explain I’ll explain to you why that’s full at the moment but not right now save that for later so Um let’s just exit out of this game and here we are in the T entity but before we get started started I actually want to install some apis so we’re going to install my API which sorry had to update it uh going to install my API and uh the Redstone flux API from uh Team cfh this is just their um read me so you just want to go over to mine click down download zip and then that’ll download that and you want to go to here the both of these links will be in the description and you also want to click download Z Here so that will download these for us okay so mine’s downloaded so just want to go into here you see this Source just contrl C the source and press contrl + V in where your areas click yes to merge and uh um there we go so just want to copy this source as Well and uh go to here these probably have it sorted these guys and there we go C FH API so we now have all this API stuff so yes so the first thing that we want to do here um under impl just add a comma and you want to just add I energy Provider and that’s just going to make us want to add a method onto the end of this all the way down here actually multiple methods uh get energy stored uh just turn zero for now get max energy stored so we we’re actually going to have to Define these up the top so I’m going to have a private uh private final int Max RF and that’s going to be uh that much yeah and Max is just going to return that so it’s going to return Max RF the energy stored so I’m going to call this current RF so Private int current RF and then basically um I’m going to go down to read and write from MBT so I just want to write this to MBT so Mt do Set uh integer and that is current RF and the value is current RF and then read from Mt I just wanted to do current RF is equal to nvt do get integer and it’s current RF so that will just get our RF and that’s just doing that can connect energy turn true Uh current RF minus equals Max Extract that’s when you’re extracting so that’s just going to take the Max Extract Max Extract off off it and it’s just going to return Max Extract here and let’s just change up to tree so we’ve got that but like I want to make it so that it’s only Redstone that you can put in this cuz it makes sense it’s going to Be generating RF which stands for Redstone flux so really I’m going to use Redstone and convert that into Redstone flux you see where I’m going with this um so let’s just go into our client uh no let’s actually go into let’s just go into our container class And I’m just going to add a new package called do slot and I’m going to add a class and I’m going to call it slot Redstone generator and boom and it need to extend slot control shift o to import this net. minecraft. inventory. slot and you want add a constru Structure and that’s just the normal stuff so we’re going to add a method and all it is is is item valid so we’re going to check if the item is valid and I’m going the only way I’m going to check that um what I’m going to do to check This is I’m going to just return true it’s going to return true if stack dot get item is equal to items Dot and then I’m going to say a redstone boom or stack. get item is equal to item. get item from block uh blocks do redstone block block That’s just going to allow it to put Redstone and redstone blocks in and in that is item valid um we want to return and it’s going to be slot Redstone generator dot so what I’m going to do I’m just going to make a static method um static Version of this cuz I have to have that one so public static Boolean um is valid item stack stack and in here we’re going just put this and this is going to make us want to take Chang static which is fine and in here I’m just going to return is Valid so that’ll just do the same stuff for us so back in here you want to return slot Redstone generator dot is valid and there we go so I’ll just check whether it’s valid and say true or false if is or not so um I’m going to actually use these Fields um cuz these These are technically field see Max RF and the current RF so I’m just going to get at like utilize these methods so I want to do this thing called a switch so switch ID open it up and just checking what the ID is so if the ID is Zero I’m going to return current RF and it’s going to add this dot to it and then underneath this uh we going to do case one and I’m just going to return this do Max RF do you of one like so so the field count we’ve got two Fields now now we want to just set it so going to just switch here and switch ID again open it up case so we can check where the case is zero and if it is then this. current RF is equal to value and then we’re going to check Whether it the case is one and then this Max RF is the value like so and I’m just going to not do that uh because that’s always going to be the same now um a generator is going to generate a certain amount of stuff per tick so just want to add a com Iable and the minecraft. you and that’s going to make us add a new method to this right down on the button and now this is our update method so we’re going to check if thisor object. is remote yeah and then we’re going to check whether it’s got like Redstone in So we’re going to check do if and I’m just going to check that slot so slot uh Redstone generator dot is valid and then I’m just going to do this do get stack and Slot Z so if the item is valid um I’m just going to add a cool down let’s just add A cool down to this so private in cool down and let’s just do the mvt stuff for the cool down and the fields as well so let’s change the field count to three let’s do case two return this. cool down and then here I’m going to do case 2 this. cool down equals Value and then here I’m just going to add um the thing for the cool down so cool down cool down and it’s this do cool down and this dot sorry and it’s also this do current RF sorry sorry about that and then I’m just going to change the uh cool down let’s Just do this cool down like so and then get energy stored this is just going to turn this. Curren RF and then um yeah so we’re checking Redstone type so cool down is going to be equal to um I think a redstone block should last About 30 seconds so if I just load up the calculator 30 seconds now there 20 ticks a seconds so times 20 that’s 600 so the coord down is equal to 600 um and I’m just going to do uh else just going to set C down to 600 L and Then I think just a normal piece of redstone is that divid by 9 so that’s around 67 yeah let’s just set that cool down I’m just going to set it to 70 just to be easier and then um we’re just going to actually add the RF so I’m going to increase the RF By 20 Redstone no it’s it’s actually I’m just going to set increase per Tech so I’m just going to get in increase per tick and that’s going to be zero for now and then increase for tick is equal to um no I’m just going to set increase Pro To 20 so here I’m just going to change to 20 so it’s going to be constant 20 but depending on the cool down so then uh any update method uh hard that should just run once so at the moment this is running like every time per second so we also Want to check the cool down is zero so I’m just going to put a an and called this. cool down is equal to zero that’s 2 course and if it’s zero that means it’s cooled down it should be smaller than or so I’m just going to check if it’s Smaller than or equal to zero and if it is I’m going to just it should just run this so this will run it on the first time then cool down would be more cuz it’s changed it here and I’m just going to and I’m just going to move this to Here I’m just going to move this to here and that’s just for the slot so at increase for tick we should actually have um up the top really so private static final int increase per tick is 20 so this will do 20 RF per tick I might op this just for Testing Purp is so we’ve done that don’t forget to watch any of my previous videos or the last tutorial so yeah go check them Out Video Information
This video, titled ‘Minecraft Modding Tutorial | RF Generator P1 (1.8.9)’, was uploaded by CJMinecraft on 2016-05-09 16:30:00. It has garnered 5108 views and 42 likes. The duration of the video is 00:15:26 or 926 seconds.
Watch todays modding tutorial to discover how to add a RF generator to the game. This is only part 1! Don’t forget to check out the next video.
COFH API – https://goo.gl/IDWOJx MY API – https://goo.gl/S48A5r Modeling Minecraft – http://goo.gl/GOElvc Don’t forget to like, comment and subscribe!
Links: ►GitHub – https://goo.gl/YkQYpu ►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
For modding help or if you want to contact me, email me at [email protected]
My Schedule: Monday or Thursday: ►Modding Tutorial Wednesday: ►Qbeh-1