/*
 * Trident - A Multithreaded Server Alternative
 * Copyright 2014 The TridentSDK Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.tridentsdk.world.gen;

import net.tridentsdk.base.Block;
import net.tridentsdk.base.Substance;
import net.tridentsdk.world.ChunkLocation;

/**
 * An overlay brush is a block populator that is used to lay blocks or structures once the chunk has been generated
 *
 * @author The TridentSDK Team
 */
public abstract class AbstractOverlayBrush {
    protected final long seed;

    public AbstractOverlayBrush(long seed) {
        this.seed = seed;
    }

    /**
     * Obtains the chunk generation seed
     *
     * @return the seed
     */
    public long seed() {
        return this.seed;
    }

    /**
     * Brushes the terrain
     *
     * @param location the location of the chunk to brush
     * @param relX the relative chunk X of the chunk
     * @param top the top of the chunk at the relative x/z
     * @param relZ the relative Z
     * @param random the generator random
     * @param manipulator the tool used to set block types in the chunk and to cross
     *                    chunk boundaries if needed
     */
    public abstract void brush(ChunkLocation location,
                               int relX,
                               int top,
                               int relZ,
                               GeneratorRandom random,
                               ChunkManipulator manipulator);

    /**
     * Provides special functionality for chunk manipulation
     *
     * @author The TridentSDK Team
     */
    public interface ChunkManipulator {
        /**
         * Manipulates the chunk
         *
         * @param relX the relative x, can be out of 0-15 range
         * @param y the y coordinate
         * @param relZ the relative z, can be out of 0-15 range
         * @param substance the substance to set
         * @param data the data to set
         */
        void manipulate(int relX, int y, int relZ, Substance substance, byte data);

        /**
         * Obtains the block at the relative location
         *
         * @param relX the relative x
         * @param y the y
         * @param relZ the relative z
         * @return the block
         */
        Block blockAt(int relX, int y, int relZ);
    }
}
@@ -794,16 +794,74 @@
 ation;%0A%0A
+import java.util.concurrent.atomic.AtomicReferenceArray;%0A%0A
 /**%0A * A
@@ -1468,67 +1468,8 @@
 unk%0A
-     * @param top the top of the chunk at the relative x/z%0A
     
@@ -1540,16 +1540,63 @@
  random%0A
+     * @param heights the height array to edit%0A
      * @
@@ -1868,11 +1868,12 @@
 int 
-top
+relZ
 ,%0A  
@@ -1897,32 +1897,46 @@
             
-int relZ
+GeneratorRandom random
 ,%0A          
@@ -1956,38 +1956,53 @@
         
-GeneratorRandom random
+AtomicReferenceArray%3CInteger%3E heights
 ,%0A      

Fix TRD-65