package domain.fluents;

import domain.AtomicFluent;
import domain.BlockType;
import main.Observations;
import static main.JavaAgent.*;

public class BlockAt implements AtomicFluent {
    private final float mX;
    private final float mZ;
    private final float mY;
    private final BlockType mTypeOfBlock;


    public BlockAt(float x, float y, float z, BlockType type){
        this.mX = x;
        this.mY = y;
        this.mZ = z;

        mTypeOfBlock = type;
    }

    public String getTypeOfBlockString(){
        return mTypeOfBlock.name();
    }

    @Override
    public boolean test(Observations observations) {
        // to test for any block just see that there is no air
        return mTypeOfBlock.compareTo(observations.blockAt(mX, mY, mZ).getTypeOfBlock()) == 0;
    }

    public float getX() {
        return mX;
    }

    public float getY() {
        return mY;
    }

    public float getZ() {
        return mZ;
    }

    public BlockType getTypeOfBlock(){
        return mTypeOfBlock;
    }

    @Override
    public String toString() {
        return "Block Type: " + mTypeOfBlock.toString() + "\tx: " + mX + "\ty: " + mY + "\tz: " + mZ;
    }
}

@@ -632,62 +632,170 @@
     
-// to test for any block just see that there is no air
+if (mTypeOfBlock.compareTo(BlockType.Any) == 0) %7B%0A            return !(observations.blockAt(mX, mY, mZ).getTypeOfBlock().compareTo(BlockType.air) == 0);%0A        %7D
 %0A   

Add special case Any to BlockAt