He was going on going to Turkey working here and welcome back to part three of our mini-series on our custom furnace in this one we are going to be covering the container the GUI and registering those and just fixing up a few little things so let’s get started first in blocking It we just need to make sure you’ve imported silver furnace which I didn’t do and you need to add the arguments to match what we need so the booting is burning so if on you want to put true and off is already false and that’s just get rid of that Error now we need to create the container class so inside silver thing you want new class and we’re going to call this silver and that container container silver furnace and this needs to extend container extends container and we have a few variables to make that as always so first we have a private Final buy inventory and call this tile furnace strike that and then we have private int cook time and we’re going to then put comma total cook time our burden and time , current item time and this just allows it to be on one line which is much simpler we want then the Constructor and we add the parameters so in venturi player and player inventory and you want I inventory and call this furnace inventory you then want to do this dot tile furnace it’s equal to furnace inventory then we need to this dot add it slot to container new slot of Furnace inventory comma zero comma 56 comma 17 so this is obviously depending on the placement in your GUI this is just the normal furnace one because I haven’t changed the texture around that much high range has changed to colors that’s all totally you need to change That if you are intending on having it in a different place so then you need to do this to icebox your container and new this is where our custom slots come in so new a slot furnace feel and I think actually we named this it’s not silver Furnace fuel and in here you want put furnace inventory comma 1 comma 56 comma 50 free semi come on and this start and so I don’t know I only thick analyst but we’re never gonna add a listener which is the issue so a new slot furnace got Silver the next output in here we’re going to do player inventory dot player comma furnace inventory comma 2 comma 1 1 6 comma 35 then we need to do some full loops which are for the math of these so for int I is equal 0 I is less Than 3 I plus plus and then we have 4 int J is equal 0 J is less than 9 plus plus J and here we’re going through this dot add structure container new slot of player inventory comma J plus I times 9 plus 9 and then comma 8 plus J times 18 Comma 84 plus I times 18 and we’re going to have another full loop which yeah so that’s the player inventory then we have the hot bar so for INT k is equal 0 k is less than 9 k plus plus we need to do this dot add Slots of container new slots of player inventory comma k comma 8 plus K times 1842 and and actually we do need to add a listener which is gotta be a first so add listener and in here you’re going to want to do super don’t add listener listener listener dot send all window Properties this this got tile furnace next we need to detect and send changes the tech and send changes now this is a pretty big method so I’m just going to copy it again once once again you can find these in the description of the videos and we’re Gonna change this to pile furnace and I’m just gonna copy this paste paste paste paste paste paste paste paste paste paste paste just like that then we have update progress bar so update progress bar and basically this is the smelting progress thingy yeah let’s call the progress bar so it’s kind of Self-explanatory and we’re going to do this dot tile furnace dot set field ID data and we’re going to do can interact with and in this we need to return desktop tile furnace dot is usable by player layer in I think yep and then we need to transfer stacking slots which is always Well most of the time a big method and it is of course this is probably one of the longest methods apart from update but you can sometimes be longer so just paste that in and change this to Thailand’s T silver furnace if it’s even on there I’ll entity furnace I’m just gonna copy That oh never mind I’ll copy that paste and I think that’s it issue here okay delete that cool so that’s everything for this class and so how far we into the video we’re ten minutes in okay so let’s go ahead and create these classes so first let’s create the slots so you Want a new package and cool wit dot slots in here we’re going to do slot a silver furnace fuel add the first one slot silver burn fuel and this needs to extend slots just like that and in here we’re going to do a constructor right there and we Need to add some parameters so I inventory in then Tori in comma int slot index go int int x position position int Y position and that’s a cup for the parameters and then in here we need to super off of this so super off of inventory in slot index x position Y Position just like that then you need to is item valid is a left left input slot net dot minecraft up slot slot and then we can do is item valid and in here we’re going to do return tile entity silver furnace dot is item fuel snack or is bucket or is bucket And in there we put a stack obviously we now need to create the bucket method and but first we should do a stack limit so get item stack limits and we’re going to do return is bucket or stack question mark 1 : super don’t get items tackling It lit lit Ling it limit and now we need to actually create the is bucket method so public static boolean is bucket and in here you on item step back and we’re going to return stack don’t get item is equal to items dot bucket just like that That’s safe then you can close that class and import it in here now we need to create the output 3 new class and we’re going with slot silver furnace output and we need to extend slot again it extends slots and let’s just import this we need to create some variables so Private final entity layer layer we need private int remove count then we need to create the constructor and put in the parameters which is going to be entity player Slayer I inventory inventory in int the slot index comma int X position come in Y position and then you need to super off Of these just like before so super off of inventory in comma just lots index I’m a x-position y-position just like that and then you need to do this dot player you can call later and import an entity player then you need to do is item valid and what you want to do Is return false because you don’t want to be enter for anything in the output but I mean you could return it true potentially if you know what you’re doing next you want to decrease stack size so in here you want to put if this dot has gets has stack And inside this you do desktop remove count plus equals math dot min of amount this dr. get STAC dot get count and you want to return super dark degree snack size amount then we have on on take and in here you once do this dots on crafting this dot player dot world this Dot player this dot remove count and get rid the slash which I accidentally added then you want to do if a plum a smart this dots player dot world dot is remote then you want to do int I equals this remove count float F equals silver furnace recipes dot instance dot get Cooking experience of the stack now tonight spell experience right yes I did I think maybe who knows if it’s equal to zero point zero f then you can do I equals zero and else if F is less than one point Oh F then you can do int J equals math Math help her dot floor and in here to put float of I times F and then you want another if so if J is less than math help her dot seal and then odd floats then you can do float of I times F and math dot random is less than open up Double open up to float I times F negative open up to more floats J and I need another bracket on the end so that’s just some little math oh no we don’t need that we need to do then plus plus J and after you can put I equals J And then we need a while loop so while I is greater than zero int K is equal to n ste XP or dots get XP splits of I and you want to do I is minus equals K and then need to do this dot player dot well whoa Dots born entity new in t XP or this dot player dot world this dot player dot pause X comma this dot play out dot pause Y and this dot player dot pause Z plus 0.5 D comment K and we need to actually do y plus 0.5 D as well and Then what CSU here I don’t know up I didn’t do int K equals yeah I did that oh my bad what am i doing I didn’t mean to open this up that’s why I thought it was a bit weird and just put that on the end and then after two You need to this doctor can remove count equals zero and net net dot minecraft George doc FML dot common dot FM FM l and l common hand handler dot instance dot fire player smell kids event of player come up stack oh I got that n minecraft for okay and That’s it oh no what oh no that’s on take I’ve done this totally wrong oh no I’ve got my methods mixed up okay guys and then you want the on take method just write that and inside this we’ve got three little things so this dot on crafting of stack and then super Dot on take the player stack and then return stack and then on crafting in here you want to do this dot remove count is plus equal to amount and then this dots on crafting stack what I’ve done but we need comma in amount I chose the wrong one Surprise next we need a pretty long method called on crafting just like that and we’re gonna change oven recipes to silver Ernest recipes and because that save now let’s just import that just like that and now let’s create our recipes class so inside this package we want in wait one second first Let’s ctrl shift o to import all that we can and the last two things are the recipes I think yep and then next episode we’ll do D will do the young GUI and stuff like that so let’s close no we can’t close this class because we need To create the recipes so new new class and call it the silver furnace recipes and this needs to extend nothing actually nevermind my bad we don’t extend anything we need to create a few variables first so private static final and we need to cool silver furnace recipes pull that Cooking base cooking underscore base equals new silver furnace recipes then we need private final map and itemstack comma item stack and then you want to call that cooking list equals Maps dot and then itemstack on my itemstack new hash map and import map and itemstack so I think yeah it’s that one And I’m presuming it’s Java dot util dot matte so yes that one and Java dot util dot map all right then we need to go ahead and create our mmm create a method called instance so public static static and then cool so furnace recipes instance in here we need to return Cooking base then we need to add our thingy I’ll construct her and we’re gonna leave this for a second because we’re going to do that later then we got add cooking okay this is a method we need to create so public void and cooking recipe or block lot and pull the input on Itemstack uncle that stack and float all that experience in here you want to do this dot add it cooking and call that item dot get item from block ain’t no no no no no get item from block input a snack experience and import block then you want to do and cooking so public Avoid add cooking and you want to do item inputs come on Tyson stack stack and float experience and then you want to do this don’t add cooking recipe new item stack or input comma 1 comma 3 2 7 6 7 and that’s basically the max data if you Were unaware next we’ve got add cooking recipe so public void add cooking recipe and you’ll Bert item step input and the item stack stack stack come on float experience in here you want to do if get cooking result or input is not equal to item stack dropped empty let me go net Dot minecraft forge dots FML dots common dot F F and now log dot info and in here we won’t put ignored cooking recipe with con flick ting input coal on double brackets equals double brackets and then a data you want perks inputs come up stack and then you want to return Um wait well I don’t want yeah that’s right and then you want to do this don’t cooking list dot put input stack this dot experience list Experian list dot hook step comma float dot value of experience and now we have quite a few more methods that you go so I’m just Going to copy these in you can grab them from the description of course and copy and paste obviously I’m going to change a few things or not as the case may be but I just need to import everything so wait what’s entry let’s have a look what Entry is it so Java dot util dot that dot entry is the one we’re looking for Java util dot matter empty and we have some issues so what does I cool oh we didn’t create our experience list oops let’s just add that in there we go That’s also in this whole class will be in the description to make it simpler and add cooking recipe for blah hmm you know I’m just gonna copy this class from my fingy this whole class will be in the description cuz I’ve I’ve hosted messing stuff up here and and I’m Just gonna go to this for now cuz we don’t want that since the constructor changed to silver furnace recipes don’t compare me I missed this you change just yourself a furnace recipes change this to stoke the furnace recipes and that is it so that’s it for this class now let’s Import this in here and go to our what’s what’s the issue now have the importance is it every time some class let’s make sure we import it here that’s it so anyway guys if you enjoy this video please do be sure to smash your face into that like button and subscribe and We are going to do parts for next time where we create the GUI and do some rendering of the handlers and stuff and then we’ll create the model and that sort of stuff next time so yeah I’ll see you guys then good bye Video Information
This video, titled ‘Minecraft Modding Tutorial 1.12.2 – Episode 23 – Custom Furnace – Pt.3’, was uploaded by TurtyWurty on 2019-04-30 19:57:41. It has garnered 530 views and 18 likes. The duration of the video is 00:37:25 or 2245 seconds.
Hey guys, welcome back to our mini-series on a custom furnace! In this one, we work on the container. Discord Server is linked below if you need help! I messed up a bit with the container code so all code I have used so far is below! Hope you guys enjoy!
GitHub: https://github.com/DaRealTurtyWurty/Tutorial-Mod My Discord Server: https://discord.gg/d5cGhKQ