Search in sources :

Example 11 with PathfinderGoalSelector

use of net.minecraft.server.v1_10_R1.PathfinderGoalSelector in project Citizens2 by CitizensDev.

the class NMSImpl method clearGoals.

public static void clearGoals(PathfinderGoalSelector... goalSelectors) {
    if (GOAL_FIELD == null || goalSelectors == null)
        return;
    for (PathfinderGoalSelector selector : goalSelectors) {
        try {
            Collection<?> list = (Collection<?>) GOAL_FIELD.invoke(selector);
            list.clear();
        } catch (Exception e) {
            Messaging.logTr(Messages.ERROR_CLEARING_GOALS, e.getLocalizedMessage());
        } catch (Throwable e) {
            Messaging.logTr(Messages.ERROR_CLEARING_GOALS, e.getLocalizedMessage());
        }
    }
}
Also used : Collection(java.util.Collection) PathfinderGoalSelector(net.minecraft.server.v1_14_R1.PathfinderGoalSelector) CommandException(net.citizensnpcs.api.command.exception.CommandException) ReportedException(net.minecraft.server.v1_14_R1.ReportedException)

Example 12 with PathfinderGoalSelector

use of net.minecraft.server.v1_10_R1.PathfinderGoalSelector in project Citizens2 by CitizensDev.

the class NMSImpl method clearGoals.

public static void clearGoals(PathfinderGoalSelector... goalSelectors) {
    if (GOAL_FIELD == null || goalSelectors == null)
        return;
    for (PathfinderGoalSelector selector : goalSelectors) {
        try {
            Collection<?> list = (Collection<?>) GOAL_FIELD.get(selector);
            list.clear();
        } catch (Exception e) {
            Messaging.logTr(Messages.ERROR_CLEARING_GOALS, e.getLocalizedMessage());
        }
    }
}
Also used : Collection(java.util.Collection) PathfinderGoalSelector(net.minecraft.server.v1_12_R1.PathfinderGoalSelector) ReportedException(net.minecraft.server.v1_12_R1.ReportedException) CommandException(net.citizensnpcs.api.command.exception.CommandException)

Example 13 with PathfinderGoalSelector

use of net.minecraft.server.v1_10_R1.PathfinderGoalSelector in project Citizens2 by CitizensDev.

the class NMSImpl method clearGoals.

public static void clearGoals(PathfinderGoalSelector... goalSelectors) {
    if (GOAL_FIELD == null || goalSelectors == null)
        return;
    for (PathfinderGoalSelector selector : goalSelectors) {
        try {
            Collection<?> list = (Collection<?>) GOAL_FIELD.get(selector);
            list.clear();
        } catch (Exception e) {
            Messaging.logTr(Messages.ERROR_CLEARING_GOALS, e.getLocalizedMessage());
        }
    }
}
Also used : Collection(java.util.Collection) PathfinderGoalSelector(net.minecraft.server.v1_13_R2.PathfinderGoalSelector) ReportedException(net.minecraft.server.v1_13_R2.ReportedException) CommandException(net.citizensnpcs.api.command.exception.CommandException)

Aggregations

Collection (java.util.Collection)10 CommandException (net.citizensnpcs.api.command.exception.CommandException)10 PathfinderGoalSelector (net.minecraft.server.v1_8_R3.PathfinderGoalSelector)3 Field (java.lang.reflect.Field)2 PathfinderGoalSelector (net.minecraft.server.v1_12_R1.PathfinderGoalSelector)2 PathPoint (net.minecraft.server.v1_15_R1.PathPoint)2 PathfinderGoalSelector (net.minecraft.server.v1_15_R1.PathfinderGoalSelector)2 ReportedException (net.minecraft.server.v1_15_R1.ReportedException)2 PathPoint (net.minecraft.server.v1_16_R3.PathPoint)2 PathfinderGoalSelector (net.minecraft.server.v1_16_R3.PathfinderGoalSelector)2 ReportedException (net.minecraft.server.v1_16_R3.ReportedException)2 PathfinderGoalSelector (net.minecraft.server.v1_10_R1.PathfinderGoalSelector)1 ReportedException (net.minecraft.server.v1_10_R1.ReportedException)1 PathfinderGoalSelector (net.minecraft.server.v1_11_R1.PathfinderGoalSelector)1 ReportedException (net.minecraft.server.v1_11_R1.ReportedException)1 EntityRabbit (net.minecraft.server.v1_12_R1.EntityRabbit)1 ReportedException (net.minecraft.server.v1_12_R1.ReportedException)1 World (net.minecraft.server.v1_12_R1.World)1 PathfinderGoalSelector (net.minecraft.server.v1_13_R2.PathfinderGoalSelector)1 ReportedException (net.minecraft.server.v1_13_R2.ReportedException)1