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

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

import com.hypixel.hytale.server.core.prefab.selection.buffer.impl.IPrefabBuffer;
import com.hypixel.hytale.server.worldgen.util.bounds.WorldBounds;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.server.worldgen.util.bounds.IWorldBounds;
import com.hypixel.hytale.server.worldgen.util.condition.BlockMaskCondition;
import com.hypixel.hytale.procedurallib.condition.IIntCondition;
import com.hypixel.hytale.server.core.prefab.PrefabRotation;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.worldgen.loader.WorldGenPrefabSupplier;

public class CavePrefab implements CaveElement
{
    @Nonnull
    private final WorldGenPrefabSupplier prefabSupplier;
    @Nonnull
    private final PrefabRotation rotation;
    private final IIntCondition biomeMask;
    private final BlockMaskCondition blockMask;
    @Nonnull
    private final IWorldBounds bounds;
    private final int x;
    private final int y;
    private final int z;
    
    public CavePrefab(@Nonnull final WorldGenPrefabSupplier prefabSupplier, @Nonnull final PrefabRotation rotation, final IIntCondition biomeMask, final BlockMaskCondition blockMask, final int x, final int y, final int z) {
        this.prefabSupplier = prefabSupplier;
        this.rotation = rotation;
        this.biomeMask = biomeMask;
        this.blockMask = blockMask;
        this.x = x;
        this.y = y;
        this.z = z;
        final IPrefabBuffer prefab = prefabSupplier.get();
        this.bounds = new WorldBounds(MathUtil.floor(x + prefab.getMinX(rotation)), MathUtil.floor(y + prefab.getMinY()), MathUtil.floor(z + prefab.getMinZ(rotation)), MathUtil.ceil(x + prefab.getMaxX(rotation)), MathUtil.ceil(y + prefab.getMaxY()), MathUtil.ceil(z + prefab.getMaxZ(rotation)));
    }
    
    @Nonnull
    public WorldGenPrefabSupplier getPrefab() {
        return this.prefabSupplier;
    }
    
    @Nonnull
    public PrefabRotation getRotation() {
        return this.rotation;
    }
    
    public IIntCondition getBiomeMask() {
        return this.biomeMask;
    }
    
    public BlockMaskCondition getConfiguration() {
        return this.blockMask;
    }
    
    public int getX() {
        return this.x;
    }
    
    public int getY() {
        return this.y;
    }
    
    public int getZ() {
        return this.z;
    }
    
    @Nonnull
    @Override
    public IWorldBounds getBounds() {
        return this.bounds;
    }
}
