package com.hypixel.hytale.server.npc.corecomponents.movement;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.server.npc.corecomponents.ActionBase;
import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;
import com.hypixel.hytale.server.npc.role.Role;
import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
import javax.annotation.Nonnull;
public class ActionCrouch extends ActionBase {
private final boolean crouching;
public ActionCrouch(@Nonnull BuilderActionBase builderActionBase, boolean crouching) {
super(builderActionBase);
this.crouching = crouching;
}
public boolean execute(@Nonnull Ref<EntityStore> ref, @Nonnull Role role, InfoProvider sensorInfo, double dt, @Nonnull Store<EntityStore> store) {
super.execute(ref, role, sensorInfo, dt, store);
MovementStatesComponent movementStatesComponent = (MovementStatesComponent)store.getComponent(ref, MovementStatesComponent.getComponentType());
if (movementStatesComponent != null) {
movementStatesComponent.getMovementStates().crouching = this.crouching;
}
return true;
}
}