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

package com.hypixel.hytale.server.npc.corecomponents.utility;

import com.hypixel.hytale.server.npc.util.IAnnotatedComponent;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.server.npc.movement.controllers.MotionController;
import com.hypixel.hytale.server.npc.entities.NPCEntity;
import javax.annotation.Nullable;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
import com.hypixel.hytale.server.npc.role.Role;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;
import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
import com.hypixel.hytale.server.npc.corecomponents.utility.builders.BuilderActionSequence;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.npc.instructions.ActionList;
import com.hypixel.hytale.server.npc.util.IAnnotatedComponentCollection;
import com.hypixel.hytale.server.npc.corecomponents.ActionBase;

public class ActionSequence extends ActionBase implements IAnnotatedComponentCollection
{
    @Nonnull
    protected final ActionList actions;
    
    public ActionSequence(@Nonnull final BuilderActionSequence builder, @Nonnull final BuilderSupport support) {
        super(builder);
        this.actions = builder.getActionList(support);
    }
    
    @Override
    public boolean canExecute(@Nonnull final Ref<EntityStore> ref, @Nonnull final Role role, final InfoProvider sensorInfo, final double dt, @Nonnull final Store<EntityStore> store) {
        return super.canExecute(ref, role, sensorInfo, dt, store) && this.actions.canExecute(ref, role, sensorInfo, dt, store);
    }
    
    @Override
    public boolean execute(@Nonnull final Ref<EntityStore> ref, @Nonnull final Role role, final InfoProvider sensorInfo, final double dt, @Nonnull final Store<EntityStore> store) {
        super.execute(ref, role, sensorInfo, dt, store);
        return this.actions.execute(ref, role, sensorInfo, dt, store);
    }
    
    @Override
    public void registerWithSupport(final Role role) {
        this.actions.registerWithSupport(role);
    }
    
    @Override
    public void motionControllerChanged(@Nullable final Ref<EntityStore> ref, @Nonnull final NPCEntity npcComponent, final MotionController motionController, @Nullable final ComponentAccessor<EntityStore> componentAccessor) {
        this.actions.motionControllerChanged(ref, npcComponent, motionController, componentAccessor);
    }
    
    @Override
    public void loaded(final Role role) {
        this.actions.loaded(role);
    }
    
    @Override
    public void spawned(final Role role) {
        this.actions.spawned(role);
    }
    
    @Override
    public void unloaded(final Role role) {
        this.actions.unloaded(role);
    }
    
    @Override
    public void removed(final Role role) {
        this.actions.removed(role);
    }
    
    @Override
    public void teleported(final Role role, final World from, final World to) {
        this.actions.teleported(role, from, to);
    }
    
    @Override
    public void clearOnce() {
        super.clearOnce();
        this.actions.clearOnce();
    }
    
    @Override
    public void setOnce() {
        super.setOnce();
        this.actions.setOnce();
    }
    
    @Override
    public int componentCount() {
        return this.actions.actionCount();
    }
    
    @Override
    public IAnnotatedComponent getComponent(final int index) {
        return this.actions.getComponent(index);
    }
    
    @Override
    public void setContext(final IAnnotatedComponent parent, final int index) {
        super.setContext(parent, index);
        this.actions.setContext(parent);
    }
}
