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

package com.hypixel.hytale.builtin.hytalegenerator.props;

import com.hypixel.hytale.builtin.hytalegenerator.threadindexer.WorkerIndexer;
import com.hypixel.hytale.builtin.hytalegenerator.material.Material;
import com.hypixel.hytale.builtin.hytalegenerator.datastructures.voxelspace.VoxelSpace;
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
import javax.annotation.Nonnull;
import com.hypixel.hytale.builtin.hytalegenerator.conveyor.stagedconveyor.ContextDependency;
import com.hypixel.hytale.builtin.hytalegenerator.bounds.Bounds3i;
import com.hypixel.hytale.math.vector.Vector3i;

public class OffsetProp extends Prop
{
    private final Vector3i offset_voxelGrid;
    private final Prop childProp;
    private final Bounds3i readBounds_voxelGrid;
    private final Bounds3i writeBounds_voxelGrid;
    private final ContextDependency contextDependency;
    
    public OffsetProp(@Nonnull final Vector3i offset_voxelGrid, @Nonnull final Prop childProp) {
        this.offset_voxelGrid = offset_voxelGrid.clone();
        this.childProp = childProp;
        this.readBounds_voxelGrid = childProp.getReadBounds_voxelGrid().clone().offset(offset_voxelGrid);
        this.writeBounds_voxelGrid = childProp.getWriteBounds_voxelGrid().clone().offset(offset_voxelGrid);
        this.contextDependency = ContextDependency.from(this.readBounds_voxelGrid, this.writeBounds_voxelGrid);
    }
    
    @Override
    public ScanResult scan(@NonNullDecl final Vector3i position_voxelGrid, @NonNullDecl final VoxelSpace<Material> materialSpace, @NonNullDecl final WorkerIndexer.Id id) {
        final Vector3i childPosition_voxelGrid = position_voxelGrid.clone().add(this.offset_voxelGrid);
        return this.childProp.scan(childPosition_voxelGrid, materialSpace, id);
    }
    
    @Override
    public void place(@NonNullDecl final Context context) {
        this.childProp.place(context);
    }
    
    @Override
    public ContextDependency getContextDependency() {
        return this.contextDependency;
    }
    
    @NonNullDecl
    @Override
    public Bounds3i getReadBounds_voxelGrid() {
        return this.readBounds_voxelGrid;
    }
    
    @NonNullDecl
    @Override
    public Bounds3i getWriteBounds_voxelGrid() {
        return this.writeBounds_voxelGrid;
    }
}
