Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Pine Tree extension for Minecraft

By: a guest on Sep 25th, 2013  |  syntax: Java  |  size: 1.67 KB  |  views: 200  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class PineTree extends BasicTree {
  2.        
  3.         public PineTree() {
  4.                 super();
  5.                 branchSlope = 0.24;
  6.                 trunkHeightScale = 0.95;
  7.         }
  8.        
  9.         float treeShape(int y) {
  10.                 // Take the y position relative to the base of the tree.
  11.                 // Return the distance the foliage should be from the trunk axis.
  12.                 // Return a negative number if foliage should not be created at this height.
  13.                 // This method is intended for overriding in child classes, allowing
  14.                 // different shaped trees.
  15.                 // This method should return a consistent value for each y (don't randomize).
  16.                 if (y < (((float) height) * 0.2)) return (float) -1.618;
  17.                 float invertedHeight = height - y;
  18.                 double distance = (0.36 * invertedHeight);
  19.                 // Alter this factor to change the overall width of the tree.
  20.                 return (float) distance;
  21.         }
  22.        
  23.         float foliageShape(int y) {
  24.                 // Take the y position relative to the base of the foliage cluster.
  25.                 // Return the radius of the cluster at this y
  26.                 // Return a negative number if no foliage should be created at this level
  27.                 // this method is intended for overriding in child classes, allowing
  28.                 // foliage of different sizes and shapes.
  29.                 if ((y < 0) || (y >= foliageHeight)) return (float) -1;
  30.                 else if (y == 0) return (float) 3;
  31.                 else if (y == foliageHeight - 1) return (float) 1;
  32.                 else return (float) 2;
  33.         }
  34. }