benevolent27

True Leaf Blocks

Jul 3rd, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. I think the author of the video underestimated the leaf block a bit here. They're actually pretty complicated blocks to make. lol. They break when no wood is around, drop apples and saplings, they change texture depending on if fancy or fast graphics are on, and are rendered in such a way that inadvertant x-ray vision can be given when transparency is in the png file! Eep!
  2.  
  3. But, fear not, I found some code here on the interwebs (and fixed it since it was buggy). The following instructions are how to implement true custom leaf blocks. :)
  4.  
  5. These instructions assume you have done everything the video has said to do, so follow along with what kennethbgoodin says to do first! Note that these leaf blocks will drop oak saplings. You can modify the code later if you decide to make your own sapling!
  6.  
  7. True Leaf Block Instructions:
  8. 1. Remove the line with "public final static Block genericLeaf" in it. We'll be replacing that.
  9. 2. Insert the following code into your Basic.java file (or whatever you called it) where you just deleted stuff:
  10. http://pastebin.com/743KW4ct
  11. 3. Create a new class in your package called "GenericLeavesBlock.java"
  12. 4. Delete any code in the new class and insert the following code: http://pastebin.com/QV95nULQ
  13. 5. Edit the code you just pasted, renaming the package "<your_package>" to whatever your package is.
  14. 6. Create a new class in your package called "ColorizeLeaves.java"
  15. 7. Insert this code into it: http://pastebin.com/eRLYhLVV
  16. 8. Edit the code you just pasted, renaming the package "<your_package>" to whatever your package is.
  17. 9. Put two graphics files to use as your leaf blocks into the blocks folder (in your textures folder). Name them "GenericLeaves.png" and "GenericLeaves_opaque.png." The opaque one is for when a person set's their graphics to "fast." (Make sure there is NO transparency in the opaque graphic!)
  18. 10. You're done! Save everything and run Minecraft to test.
  19.  
  20. Note: To change the color of leaves, you do so in the "ColorizeLeaves.java" file. The PNG file you use should be black and white!
  21.  
  22. Sources:
  23. Modifying the leafblock type and creating the classes: https://www.youtube.com/watch?v=duFkfDBbLvw&list=PLrnh7I7rzm5zvPDCW6eGWhTVQh3BPh2bu&index=14
  24. Fixing the fast/fancy graphics issue: http://www.minecraftforge.net/forum/index.php?topic=19088.0
  25. Colors: Myself, I traced back to where some color codes were in the minecraft codebase after finding nothing on google about it.
Advertisement
Add Comment
Please, Sign In to add comment