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

package com.hypixel.hytale.builtin.buildertools.snapshot;

import com.hypixel.hytale.component.Store;
import java.util.concurrent.Executor;
import java.util.concurrent.CompletableFuture;
import com.hypixel.hytale.component.Ref;
import javax.annotation.Nullable;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.server.core.universe.world.World;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.entity.entities.Player;

public interface EntitySnapshot<T extends SelectionSnapshot<?>> extends SelectionSnapshot<T>
{
    @Nullable
    T restoreEntity(@Nonnull final Player p0, @Nonnull final World p1, @Nonnull final ComponentAccessor<EntityStore> p2);
    
    default T restore(final Ref<EntityStore> ref, final Player player, @Nonnull final World world, final ComponentAccessor<EntityStore> componentAccessor) {
        final Store<EntityStore> store = world.getEntityStore().getStore();
        if (!world.isInThread()) {
            return CompletableFuture.supplyAsync(() -> this.restoreEntity(player, world, store), world).join();
        }
        return this.restoreEntity(player, world, store);
    }
}
