Search in sources :

Example 1 with AbstractJob

use of com.minecolonies.coremod.colony.jobs.AbstractJob in project minecolonies by Minecolonies.

the class AbstractEntityAIBasic method onException.

@Override
protected void onException(final RuntimeException e) {
    try {
        final int timeout = EXCEPTION_TIMEOUT * exceptionTimer;
        this.setDelay(timeout);
        // wait for longer now
        exceptionTimer *= 2;
        if (worker != null) {
            final String name = this.worker.getName();
            final BlockPos workerPosition = worker.getPosition();
            final AbstractJob colonyJob = worker.getColonyJob();
            final String jobName = colonyJob == null ? "null" : colonyJob.getName();
            Log.getLogger().error("Pausing Entity " + name + " (" + jobName + ") at " + workerPosition + " for " + timeout + " Seconds because of error:");
        } else {
            Log.getLogger().error("Pausing Entity that is null for " + timeout + " Seconds because of error:");
        }
        // fix for printing the actual exception
        e.printStackTrace();
    } catch (final RuntimeException exp) {
        Log.getLogger().error("Welp reporting crashed:");
        exp.printStackTrace();
        Log.getLogger().error("Caused by ai exception:");
        e.printStackTrace();
    }
}
Also used : AbstractJob(com.minecolonies.coremod.colony.jobs.AbstractJob) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

AbstractJob (com.minecolonies.coremod.colony.jobs.AbstractJob)1 BlockPos (net.minecraft.util.math.BlockPos)1