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 triggerTick;
    public final TickPriority priority;
    private final long c;
    
    public TickNextTickData(final BlockPos fu, final T object) {
        this(fu, object, 0L, TickPriority.NORMAL);
    }
    
    public TickNextTickData(final BlockPos fu, final T object, final long long3, final TickPriority bqt) {
        this.c = TickNextTickData.counter++;
        this.pos = fu.immutable();
        this.type = object;
        this.triggerTick = long3;
        this.priority = bqt;
    }
    
    @Override
    public boolean equals(final Object object) {
        if (object instanceof TickNextTickData) {
            final TickNextTickData<?> bqs3 = object;
            return this.pos.equals(bqs3.pos) && this.type == bqs3.type;
        }
        return false;
    }
    
    @Override
    public int hashCode() {
        return this.pos.hashCode();
    }
    
    public static <T> Comparator<TickNextTickData<T>> createTimeComparator() {
        return Comparator.<TickNextTickData<T>>comparingLong(bqs -> bqs.triggerTick).<Comparable>thenComparing(bqs -> bqs.priority).thenComparingLong(bqs -> bqs.c);
    }
    
    @Override
    public String toString() {
        return this.type + ": " + this.pos + ", " + this.triggerTick + ", " + this.priority + ", " + this.c;
    }
    
    public T getType() {
        return this.type;
    }
}
