// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.worldgen.cave.shape;

import com.hypixel.hytale.math.util.TrigMathUtil;
import com.hypixel.hytale.server.worldgen.cave.CaveNodeType;
import com.hypixel.hytale.server.worldgen.cave.element.CaveNode;
import com.hypixel.hytale.server.worldgen.cave.CaveType;
import java.util.Random;
import com.hypixel.hytale.procedurallib.supplier.IDoubleRange;
import javax.annotation.Nonnull;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.server.worldgen.util.bounds.IWorldBounds;

public class EmptyLineCaveNodeShape extends AbstractCaveNodeShape implements IWorldBounds
{
    private final Vector3d o;
    private final Vector3d v;
    
    public EmptyLineCaveNodeShape(final Vector3d o, final Vector3d v) {
        this.o = o;
        this.v = v;
    }
    
    @Nonnull
    @Override
    public Vector3d getStart() {
        return this.o.clone();
    }
    
    @Nonnull
    @Override
    public Vector3d getEnd() {
        final double x = this.o.x + this.v.x;
        final double y = this.o.y + this.v.y;
        final double z = this.o.z + this.v.z;
        return new Vector3d(x, y, z);
    }
    
    @Nonnull
    @Override
    public Vector3d getAnchor(@Nonnull final Vector3d vector, final double t, final double tv, final double th) {
        return CaveNodeShapeUtils.getLineAnchor(vector, this.o, this.v, t);
    }
    
    @Nonnull
    @Override
    public IWorldBounds getBounds() {
        return this;
    }
    
    @Override
    public int getLowBoundX() {
        return 0;
    }
    
    @Override
    public int getLowBoundZ() {
        return 0;
    }
    
    @Override
    public int getHighBoundX() {
        return 0;
    }
    
    @Override
    public int getHighBoundZ() {
        return 0;
    }
    
    @Override
    public int getLowBoundY() {
        return 0;
    }
    
    @Override
    public int getHighBoundY() {
        return 0;
    }
    
    @Override
    public boolean shouldReplace(final int seed, final double x, final double z, final int y) {
        return false;
    }
    
    @Override
    public double getFloorPosition(final int seed, final double x, final double z) {
        return -1.0;
    }
    
    @Override
    public double getCeilingPosition(final int seed, final double x, final double z) {
        return -1.0;
    }
    
    @Override
    public boolean hasGeometry() {
        return false;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "EmptyLineCaveNodeShape{o=" + String.valueOf(this.o) + ", v=" + String.valueOf(this.v);
    }
    
    public static class EmptyLineCaveNodeShapeGenerator implements CaveNodeShapeEnum.CaveNodeShapeGenerator
    {
        private final IDoubleRange length;
        
        public EmptyLineCaveNodeShapeGenerator(final IDoubleRange length) {
            this.length = length;
        }
        
        @Nonnull
        @Override
        public CaveNodeShape generateCaveNodeShape(@Nonnull final Random random, final CaveType caveType, final CaveNode parentNode, final CaveNodeType.CaveNodeChildEntry childEntry, final Vector3d origin, final float yaw, final float pitch) {
            final double l = this.length.getValue(random.nextDouble());
            final Vector3d direction = new Vector3d(TrigMathUtil.sin(pitch) * TrigMathUtil.cos(yaw), TrigMathUtil.cos(pitch), TrigMathUtil.sin(pitch) * TrigMathUtil.sin(yaw)).scale(l);
            return new EmptyLineCaveNodeShape(origin, direction);
        }
    }
}
