package net.minecraft.world.level;

import java.util.Comparator;
import net.minecraft.core.BlockPos;

public class TickNextTickData<T> {
    private static long counter;
    private final T type;
    public final BlockPos pos;
    public final long delay;
    public final TickPriority priority;
    private final long c;
    
    public TickNextTickData(final BlockPos fk, final T object) {
        this(fk, object, 0L, TickPriority.NORMAL);
    }
    
    public TickNextTickData(final BlockPos fk, final T object, final long long3, final TickPriority bkn) {
        this.c = TickNextTickData.counter++;
        this.pos = fk.immutable();
        this.type = object;
        this.delay = long3;
        this.priority = bkn;
    }
    
    @Override
    public boolean equals(final Object object) {
        if (object instanceof TickNextTickData) {
            final TickNextTickData<?> bkm3 = object;
            return this.pos.equals(bkm3.pos) && this.type == bkm3.type;
        }
        return false;
    }
    
    @Override
    public int hashCode() {
        return this.pos.hashCode();
    }
    
    public static <T> Comparator<TickNextTickData<T>> createTimeComparator() {
        return Comparator.<TickNextTickData<T>>comparingLong(bkm -> bkm.delay).<Comparable>thenComparing(bkm -> bkm.priority).thenComparingLong(bkm -> bkm.c);
    }
    
    @Override
    public String toString() {
        return this.type + ": " + this.pos + ", " + this.delay + ", " + this.priority + ", " + this.c;
    }
    
    public T getType() {
        return this.type;
    }
}
