package net.minecraft.server.level;

import net.minecraft.world.level.TickNextTickData;
import java.util.stream.Stream;
import net.minecraft.world.level.TickPriority;
import net.minecraft.core.BlockPos;
import java.util.function.Function;
import net.minecraft.world.level.TickList;

public class WorldGenTickList<T> implements TickList<T> {
    private final Function<BlockPos, TickList<T>> index;
    
    public WorldGenTickList(final Function<BlockPos, TickList<T>> function) {
        this.index = function;
    }
    
    @Override
    public boolean hasScheduledTick(final BlockPos fk, final T object) {
        return this.index.apply(fk).hasScheduledTick(fk, object);
    }
    
    @Override
    public void scheduleTick(final BlockPos fk, final T object, final int integer, final TickPriority bkn) {
        this.index.apply(fk).scheduleTick(fk, object, integer, bkn);
    }
    
    @Override
    public boolean willTickThisTick(final BlockPos fk, final T object) {
        return false;
    }
    
    @Override
    public void addAll(final Stream<TickNextTickData<T>> stream) {
        stream.forEach(bkm -> this.index.apply(bkm.pos).addAll(Stream.<TickNextTickData<T>>of(bkm)));
    }
}
