/*
 * Trident - A Multithreaded Server Alternative
 * Copyright 2014 The TridentSDK Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.tridentsdk.entity.decorate;

import net.tridentsdk.Coordinates;
import net.tridentsdk.entity.Entity;
import net.tridentsdk.entity.EntityProperties;
import net.tridentsdk.entity.LivingEntity;
import net.tridentsdk.entity.living.Player;
import net.tridentsdk.entity.Projectile;
import net.tridentsdk.event.entity.EntityDamageEvent;

public class LivingDecorationAdapter extends DecorationAdapter<LivingEntity> implements LivingEntity {
    private final LivingEntity entity;

    protected LivingDecorationAdapter(LivingEntity entity) {
        super(entity);
        this.entity = entity;
    }

    @Override
    public void hide(Entity entity) {
        this.entity.hide(entity);
    }

    @Override
    public void show(Entity entity) {
        this.entity.show(entity);
    }

    @Override
    public double health() {
        return entity.health();
    }

    @Override
    public void setHealth(double health) {
        entity.setHealth(health);
    }

    @Override
    public double maxHealth() {
        return entity.maxHealth();
    }

    @Override
    public void setMaxHealth(double maxHealth) {
        entity.setMaxHealth(maxHealth);
    }

    @Override
    public long remainingAir() {
        return entity.remainingAir();
    }

    @Override
    public void setRemainingAir(long ticks) {
        entity.setRemainingAir(ticks);
    }

    @Override
    public Coordinates headLocation() {
        return entity.headLocation();
    }

    @Override
    public boolean canCollectItems() {
        return entity.canCollectItems();
    }

    @Override
    public EntityDamageEvent lastDamageEvent() {
        return entity.lastDamageEvent();
    }

    @Override
    public Player lastPlayerDamager() {
        return entity.lastPlayerDamager();
    }

    @Override
    public boolean isDead() {
        return entity.isDead();
    }

    @Override
    public <T extends Projectile> T launchProjectile(EntityProperties properties) {
        return entity.launchProjectile(properties);
    }

    @Override
    protected LivingEntity original() {
        return entity;
    }
}

@@ -716,24 +716,55 @@
 oordinates;%0A
+import net.tridentsdk.Trident;%0A
 import net.t
@@ -780,32 +780,32 @@
 .entity.Entity;%0A
-
 import net.tride
@@ -963,16 +963,110 @@
 ectile;%0A
+import net.tridentsdk.entity.living.ai.AiModule;%0Aimport net.tridentsdk.entity.living.ai.Path;%0A
 import n
@@ -1112,16 +1112,67 @@
 Event;%0A%0A
+import java.util.concurrent.atomic.AtomicInteger;%0A%0A
 public c
@@ -1266,16 +1266,16 @@
 ntity %7B%0A
-
     priv
@@ -1304,16 +1304,148 @@
  entity;
+%0A    private final AtomicInteger restTicks = new AtomicInteger(0);%0A    private volatile AiModule ai;%0A    private volatile Path path;
 %0A%0A    pr
@@ -3059,10 +3059,712 @@
 ;%0A    %7D%0A
+%0A%0A    @Override%0A    public void setAiModule(AiModule module) %7B%0A        this.ai = module;%0A    %7D%0A%0A    @Override%0A    public AiModule aiModule() %7B%0A        if (ai == null) %7B%0A            return Trident.instance().aiHandler().getDefaultAiFor(type());%0A        %7D else %7B%0A            return ai;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void performAiUpdate() %7B%0A        if (this.restTicks.get() == 0) %7B%0A            this.restTicks.set(this.aiModule().think(this));%0A        %7D else %7B%0A            this.restTicks.getAndDecrement();%0A            // TODO: follow path%0A        %7D%0A    %7D%0A%0A    @Override%0A    public Path path() %7B%0A        return path;%0A    %7D%0A%0A    public void setPath(Path path) %7B%0A        this.path = path;%0A    %7D%0A
 %7D%0A

Fix compliation errors