-
Notifications
You must be signed in to change notification settings - Fork 55
Modding
Harsha Addanki edited this page Apr 17, 2023
·
4 revisions
Here you can post step-by-step instructions on how to add new blocks to MineKhan or new items to MineKhan, how to work around the thousands of lines of code that MineKhan runs on.
The issue is here
How to Make new blocks, although it can take a bit of time. Here are instructions:
Get the image for the block. For the blocks, googled the block name "steve minecraft face" and "pig minecraft face" or whatever you are looking for. If you have Minecraft, for blocks that are in the game you can go to the .jar folder and open the textures/blocks for the images. (DISCLAIMER: I don't actually know if that works, not having Minecraft myself, but Willard said that is where he got the textures so I'm trusting him :D )
Size the image. Because the blocks are 16 by 16 px, the image that we use also needs to be 16x16px. Use a photo editor or something to rescale the image to 16x16px, and export it as a png.
Convert the png to base64. I just googled "png to base64" and it provided a ton of great sites that you can upload your pictures to and get them converted to base64. The converted image will be a string of numbers and characters that you should copy.
Convert the base64 to base36. For this, I used Willard's program that he actually created for making the MineKhan blocks: https://www.khanacademy.org/computer-programming/base64-png-to-base36-pixel-converter/6732846272692224 . Plug the base64 data string into the program code where it says, and it will provide a string of letters and numbers in the println. Copy this.
Putting the new texture in. On MineKhan (v 0.6.1), the textures start on line 132. Scroll down through all the textures listed, until you get to the last one (currently polished granite.) Following the same format as the other textures, put your texture string in the end right after the polishedGranite. Give it a nice descriptive name (like smileyFace or lava).
Listing the block. Now go down. Below where the textures are listed, starting on line 299, is the block data. Go down to the end (again, the last block should be polishedGranite) and follow the same format for listing as the other blocks. Make sure the name you put in the block data is the same thing you called your texture!
Enjoy your block! At this point, the block should show up in your inventory. Create a new world or something and check it out!
Not all blocks work. If you look at my code (which I recommend doing to see examples of what I did), you will see a couple of block textures commented out, like creeperHead. Those textures don't work and break the program because they have too many unique colors and the encoder I use has a limit of 36 colors. Usually if the program isn't working, it's because you made a mistake in spelling or formatting.
made by 🍉 Sally the Great 🍉 To add things here, edit this page.