package net.glowstone.generator.objects;

import org.bukkit.Material;
import org.bukkit.material.MaterialData;

public class OreType {

    private final Material type;
    private final MaterialData data;
    private final int minY;
    private final int maxY;
    private final int amount;
    private final Material targetType;

    public OreType(Material type, int minY, int maxY, int amount) {
        this(type, new MaterialData(type), minY, maxY, amount);
    }

    public OreType(Material type, int minY, int maxY, int amount, Material targetType) {
        this(type, new MaterialData(type), minY, maxY, amount, targetType);
    }

    public OreType(Material type, MaterialData data, int minY, int maxY, int amount) {
        this(type, data, minY, maxY, amount, Material.STONE);
    }

    public OreType(Material type, MaterialData data, int minY, int maxY, int amount,
        Material targetType) {
        this.type = type;
        this.data = data;
        this.minY = minY;
        this.maxY = maxY;
        this.amount = ++amount;
        this.targetType = targetType;
    }

    public Material getType() {
        return type;
    }

    public MaterialData getData() {
        return data;
    }

    public int getMinY() {
        return minY;
    }

    public int getMaxY() {
        return maxY;
    }

    public int getAmount() {
        return amount;
    }

    public Material getTargetType() {
        return targetType;
    }
}

@@ -35,16 +35,63 @@
 jects;%0A%0A
+import java.util.Random;%0Aimport lombok.Getter;%0A
 import o
@@ -176,16 +176,28 @@
 Type %7B%0A%0A
+    @Getter%0A
     priv
@@ -217,24 +217,36 @@
 erial type;%0A
+    @Getter%0A
     private 
@@ -266,24 +266,36 @@
 lData data;%0A
+    @Getter%0A
     private 
@@ -306,24 +306,36 @@
 l int minY;%0A
+    @Getter%0A
     private 
@@ -346,24 +346,36 @@
 l int maxY;%0A
+    @Getter%0A
     private 
@@ -388,24 +388,36 @@
 int amount;%0A
+    @Getter%0A
     private 
@@ -903,32 +903,525 @@
 .STONE);%0A    %7D%0A%0A
+    /**%0A     * Creates an ore type. If %7B@code minY%7D and %7B@code maxY%7D are equal, then the height range is%0A     * 0 to %7B@code minY%7D*2, with greatest density around %7B@code minY%7D. Otherwise, density is uniform%0A     * over the height range.%0A     *%0A     * @param type the block type%0A     * @param data the block data value%0A     * @param minY the minimum height%0A     * @param maxY the maximum height%0A     * @param amount the size of a vein%0A     * @param targetType the block this can replace%0A     */%0A
     public OreTy
@@ -1709,197 +1709,255 @@
     
-public Material getType() %7B%0A        return type;
+/**%0A     * Generates a random height at which a vein of this ore can spawn.
 %0A    
-%7D%0A
+ *
 %0A    
-public MaterialData getData() %7B
+ * @param random the PRNG to use
 %0A     
-   
+* @
 return 
-data;%0A    %7D%0A%0A    public int getMinY() %7B%0A        return minY;%0A    %7D%0A%0A    public int
+a random height for this ore%0A     */%0A    public int getRandomHeight(Random random) %7B%0A        return getMinY() ==
  get
@@ -1962,18 +1962,16 @@
 etMaxY()
- %7B
 %0A       
@@ -1975,150 +1975,139 @@
     
-return maxY;%0A    %7D%0A%0A    public int getAmount() %7B%0A        return amount;%0A    %7D%0A%0A    public Material getTargetType() %7B%0A        return targetType
+        ? random.nextInt(getMinY()) + random.nextInt(getMinY())%0A                : random.nextInt(getMaxY() - getMinY()) + getMinY()
 ;%0A  

Fix CheckStyle issues in generator/objects/OreType.java (#730)