[Applause] I just you know muck of monsters today entity how to add your very own coloured blocks to the game so today’s tutorial I have already wrote everything because there’s actually quite a lot to write so I wanted to shorten the length of this tutorial and simplify a bit so I have Got a code you can get it on github I’ll put a link in the description if you remember and so yeah everything is available for you to look at and yes so let’s go and explain how this works so well a block is a canvas block so that Basically means that you can paint it that’s the idea of a canvas and the paintbrush don’t be added in last tutorial that’s able to right click our block and change the color which is quite useful to be honest and I find it quite cool so here’s our block class it Extends a Canuck container and a tile entity provider you don’t need both but I have both just to make sure it knows me one at Ireland to see and it’s all so it’s here to say it’s a Tom entity so I just set the default hardness and Resistance and you local has name and what you expect and material is cloth because that’s sort of canvases so what we’re going to be using is we can be using our unblock activated method which will actually make it so when we right-click it with a paintbrush it will Change the color so what we do is we check that the item in the correct hand is the paintbrush especially the eyes and it clicked it then what we do is we get the tile entity of where it is which this is our talented class our go through this later And what it does is it gets the canvas tile entity we set the color of eternity to the color from the stack compound from the item stack which we already set in last time as the color tag and we make sure to make the world send Something up to the client to say hey you need to re-render this block because it’s just been updated and we have a information like last time which just says the color correctly now the get pick block this is a really quite simple method and pick block is when you middle Mouse click a block and what this does is it make sure you get the right block from when you pick block the block I’ll show you later but you are actually able to say you’ve got a red canvas you can middle mouse click it and you can get The red canvas again and just place it normally and you will have to update it does take a while for it to process now here we make sure that it renders as a model we create the tile entity here and when we place it we want to make sure to Re-render the block and we set the color so actually it might be a good idea to rerender it after we set the color that might fit not fix the problem now this get drops this isn’t a fully functioning method and the reason why it isn’t is because we actually need a Packet because what problem is with it is on the client side the get drops is cooled and all get drops does is says what should be dropped but on client side the tile and see doesn’t exist in the world because it’s clients only the Tollan to the Exists on a server side so when you do it client side it’s all it’s going to do is return a white canvas block whereas if you use a setblock command with destroy and will do is will actually drop it correctly with the correct color from natality and using packets we will Be able to fix this and set the right color correctly so next you need to go into mod blocks you want to do everything that you would do normally you want to initialize your block register your block register to render now here is here’s a new thing we to Register the block colors now this is pretty simple to the item one so you will recognize this this is the gutter it sends the item one or than changing it to canvas but here is actually the one that says a block has a specific color so we have to do minecraft get Minecraft Get block colours register block color handler and it is pretty self-explanatory if there is a canvas there we’re gonna return the color of the canvas otherwise return white and quite simple so don’t forget you need to go to your client proxy and register the block colors and yes so the block colors If we look at this is the block block JSON file what you need to do is need to actually say the tint index so as if we go over to here our tint index is here at int index here but we need to actually state it in Block so we put in the tint index and now that’s actually the item because if it’s an element you have to say for every single element our block is quite simple it just has two particle and everything else is just exactly the same as the item one or than the archon one Doesn’t have a particle quite self-explanatory now the tarlyn see the times is really simple to understand because all it does is store the color as eternity when you create a new instance on tile entities sets the color to white and you can read the color from the MBT and you can also Write the color to the MBT which just saves it correctly and we can get the color and set the color and these are just some saving methods which we use when we did our tile into the tutorial so make sure you need you actually register this tile entity because if you Don’t you will have issues because I’ve done this before and it’s pain so make sure you’ve actually registered the talents T now if we go over to our vent handler this is actually a fix because I added a recipe for the paintbrush and there isn’t a recipe for Z canvas ship There will be but the problem is it only will craft it if it’s got the MIT data now our tooltip event here will make sure that it gets the data so if it’s paintbrush and it doesn’t have this tag it will set a tag to white and Ardi thing saying it’s white so that is actually all the code done it’s a lot of code and it took me a long time to actually figure out that code but it’s pretty cool what you can do with it it’s pretty cool so yeah let’s just wait for The game to load up a case of the game showed up so if it go inside of our test world you will actually be able to see our brand new comers in the game which is amazing because I love dis canvas it’s actually really cool so that was Just from me testing earlier and so I’ll just clear that because it doesn’t drop it correctly I will show you this so we’re gonna need a paintbrush and I gotta get to paint brushes and you can need a canvas and I don’t oh that’s a book you don’t want that so the canvas You can see it says the color of the canvas you can place it down nice and beautifully if that’s even a word and we can build it like this now let’s go get some colors so if I just get this another paintbrush I’m gonna get a full Red one and a full light blue one so don’t forget you can craft this like last time so I just crafted like this normally and we’ve painted it it’s actually really cool it does save it correctly I have tested this so if you were you would have seen the intro the Canvas world is actually where I created my CJ minecraft logo so this took me about 10 minutes to write out this using the canvas which is really really cool I really love this it’s amazing so thank you guys for showing me like comment and subscribe I am out Video Information
This video, titled ‘Minecraft Modding Tutorial | Coloured Blocks (1.10.2,1.11.2)’, was uploaded by CJMinecraft on 2017-04-04 17:30:01. It has garnered 1390 views and 28 likes. The duration of the video is 00:08:50 or 530 seconds.
Today we add our very own canvas to the game which can be painted using our paint brush we made in the last tutorial!
Code – https://goo.gl/FPGYF6
Please support me if you can – https://www.patreon.com/cjminecraft Discord – https://discord.gg/ZvhUKkd
Don’t forget to like, comment and subscribe!
Music by Ninety9Lives Elektronomia – Imagination Video Link: http://99l.tv/Imagination Channel: http://99l.tv/Subscribe Album Download Link: http://99l.tv/GoldenGun
Links: ►GitHub – https://goo.gl/c4JlXe ►My Website – http://cjminecraft.theclever.me/ ►Modding Tutorial Playlist – https://goo.gl/bq6sgx ►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