Hey guys hello and welcome back to another minecraft forge modding tutorial and yeah this is the second episode for the custom rendered blog and after we have created all the rendering stuff we need for our nice little table we will now create all the blocks stuff and all the things so we can Place our table in the world so now let’s get started now what we’re gonna have to do now is register this renderer or first of all we’ll have to create a new block that takes in this tile entity information so in your blogs package um simply create a new class called block table And this log table and this will not extend block blood blood block but it will extend block container which basically just says this plus should have a tile entity bound to it now it wants a constructor from us first of all the block material of course So because it’s a table we can remove the material from the constructor and simply put in super in brackets material dot wood i said not on german i’m so stupid um and now it wants some other method which is the create new type entity method and now rename this world fields to world And this end field to id and now the return just delete this return null and put in return a new file entity table and as you can remember we have just created this tile entity table class now um there are some other methods we need for the block First of all we’ll have to say that the render id of this block is not set so we’ll put in add override because it overrides the super class public int get render type and those nice brackets and put in return minus one so it is not set and if we Put this on zero and it will be rendered as a normal block and on five i think it will be rendered like a grass block so if you want to create a grass block simply put in five and there are loads of rendering ids for minecraft’s render engine so now What we’ll have to do now is say that this block is not opaque because otherwise we would be able to see all the dungeons and lava and end stone from the blocks underneath this block so put in public boolean is opaque cube and this should return false And now we’ll have to do one other thing which is public boolean is normal cube and this also returns false because it is a custom rendered cube oh i wrote returns so that’s everything we have to do for this class but we will set a name for this so set block Name and put in table there we go and we don’t have to set a texture name because this block will be rendered in 3d in the inventory now in our language files oh in our language files in the and us.lang put in tile dot table dot name equals Table and now we have a nice name for the block so now what we’ll have to do is simply binding the tile entity renderer to our tile entity table dot class and for this we are gonna go in the client proxy and put in client registry in the register renderer method because we Don’t have to write a new method for this put in client registry dot bind tile entity special renderer which is pretty self-explanatory to renderer and now in brackets it will take in the tile entity class import everything of course so add arguments which will both be now so First of all the tile entity class which is tile entity table dot class plus and now the renderer which is a new instance of our table renderer so put a new render table there we go import this and now it should work so now we’ll have to create a class That can render any type entity as a 3d item in the player’s hand so um just that it looks nicer so create a new package in our rendering package and name this item and in there create a new class called generic block item renderer and There we go and this will take in two arguments in the constructor but first of all we’ll have to create a field and let it implement implement i item renderer because it should be an item renderer import this and now it wants some methods from us so the handle render type Will just return true and also they should use render helper will return true and the render item method and there we will gonna put our rendering part but first we’ll have to create a new field which is first of all a tile entity so this field it’s the field which tile Entity should be rendered in the hand and the other field is just the related time renderer so um private tile entity tile and private file entity special renderer vendor semicolon and now we’ll have to import these classes and now simply select those and click right click on them and go on to Source and generate constructor using fields so it will automatically create such a nice looking constructor for us without we have to write it so what we’ll do now is go into the render item method and in there we’ll have to push the matrix so it knows Oh there’s a new rendering part in here or basically just so we can move the rendering in the world so do gl11.gl push matrix and gl11.gl pop matrix of course at the end and don’t forget this gl pop matrix because otherwise minecraft or opengl will say overload and it will crash probably So and now we’ll simply have to access the rendering of minecraft which is possible by doing tile entity render dispatcher dot instance because we want the currently running instance dot render tile entity at and now we’ll put in our tile and 0 0 0 and 0 because we want it to be rendered At the zero position so it is not translated away from the hand so now let me let me explain the constructor what this does it simply takes in the file entity and a renderer so we can set our tile to the tile we put in the constructor and our renderer To the child entity special renderer so now we can close this class and in our client proxy we will have to create an other method in which we will register all our item renderers so create a new method called public voyage register item renderers and in there simply put in minecraft Client dot register item renderer and now since we have a block and now item we will have to get the item from the blog which can be done by doing item dot get item from a blog as simple as it could be and now we’ll have to put in our blog which we Don’t have at the moment so go in your blogs class tutorial mod.blocks create a new field called table and this add this to the block list so do block list dot add table equals new block table and this won’t need any arguments in the constructor because it is always The wooden material import this class so just the basic um rendering method uh just the basic registering method and now we’ll have to change the village visibility of our constructor to public this is everything now save this and now we can access this table variable in our item dot get item from block Now simply put in tutorial mod blocks point table now import this class of course and now it will want to have the item renderer behind the comma so now write new generic block item renderer and now in brackets we will need our tile entity which is just a new uh which is tile Oh which is a new tile entity table i was confused forbid file entity table so you’ll have to write this properly not with an o not with a large i file entity table and now the renderer which is a new render table and then the brackets ctrl shift o to import everything Don’t forget the semicolon at the end and now the only thing we have to do now is calling our register item renderers method in our register renderers method so leave a space there and now put in register item renderers open bracket and then close the bracket again and this Is everything we’ll have to do for the tile entity so now let’s start up minecraft and see if it has worked but it definitely should be so um while this is loading i can clean up my code a little bit so i will rename this it’s a mysterious Dot mod starter tournament dot important classes to another package name but minecraft is finished loading in a bit so i won’t do this right now and there we go it has finished loading now go into our single player world yes this won’t appear because i had some testings before and yeah There was another block name so now go into your creative tab and there we go we have our perfectly rendered table in our hand with the texture on it and if we set it in the world it will be rednecked on the blocks position and look directly Like our table we have just created so if we now go into third person this will look like this and by ever run in debug mode yeah by doing um in our generic block item render we can insert an if statement so if tile equals equals tile entity table so if we rendering A tile entity table then it can translate or and do what if tile equals style enter oh not equals but instance of i’ll entity table dot class oh oh there we go if entire instance of tile entity table we can now do gl one one dot gl translate D and put in zero x one y and zero z which will now check if this is a tile entity table and then translate it up so as you can see it is translated a little bit up in our hand so if i now put this on then it is floating Above the inventory and above the player so now as you can see we have this nice tile entity in the middle of our screen but we actually won’t do this but what you can also do is to scale this down a little bit so do gl11.gl scale D and now x y and z so x i would say 0.5 why i will leave y so simply put in one and then put in 0.5 in z direction semicolon at the end control uh control s and now as you can see we have this horrific looking Um yeah tiny table in our hand that is just as high as normal but it is less wide so now delete those two lines because we don’t need them yet and now what we will do is simply texturize this table.png so let’s build up a little house here so We can set a nice table and there there we go and there we are putting some wood here now what you can do is also you can bind a minecraft wood texture to it but it will look just horrifically um because the texture is just 16 by 16 pixels large And our texture of the table is 128 by 64 pixels large so this would create some um transparent bits in the world but what you can do now is um you actually didn’t see those things that i showed you yeah um yeah just we will now just um textualize our table so And there we go there we have jim and now simply select this tool control control i to swap the selection and now select the this tool and there we go and we have a nice wooden texture on it now if we export this and put this here we can now Just select the resource pack once again so minecraft reloads the resources and there we go we have a wonderfully textured table in minecraft and in our hand so that’s everything for this tutorial guys i hope you enjoyed it and if you did so then definitely leave A like on it and in the next week we will be going to create a custom rendered entity using the knowledge from this tutorial and the last tutorial with also we will animate this entity so we will animate a walking animation and a fighting animation maybe also so we will Just have a look at this next week or in two weeks so that’s it for now i hope you enjoyed it see you next time guys good bye Video Information
This video, titled ‘Minecraft Forge Modding Tutorial|Custom Rendered Block Part 2+Custom Rendered Item[Minecraft 1.7.10]’, was uploaded by JonesTown on 2015-06-22 19:05:26. It has garnered 3806 views and 43 likes. The duration of the video is 00:18:14 or 1094 seconds.
Part 2 of the Custom Rendered Block Tutorial in which we finish all the rendering stuff and add a 3D rendered item for the table. Subscribe for more: https://www.youtube.com/channel/UCX2F-cnK0tetqRx0ZzrKcvA?subconfirmation=1