Package de.kumpelblase2.remoteentities.api.features

Source Code of de.kumpelblase2.remoteentities.api.features.RemoteMateFeature

package de.kumpelblase2.remoteentities.api.features;

import net.minecraft.server.v1_7_R1.EntityAnimal;
import net.minecraft.server.v1_7_R1.EntityLiving;
import org.bukkit.entity.LivingEntity;

public abstract class RemoteMateFeature extends RemoteFeature implements MateFeature
{
  private LivingEntity m_partner;

  public RemoteMateFeature()
  {
    super("MATE");
  }

  @Override
  public boolean isPossiblePartner(LivingEntity inPartner)
  {
    return true;
  }

  @Override
  public boolean mate(LivingEntity inPartner)
  {
    if(this.isPossiblePartner(inPartner))
    {
      this.m_partner = inPartner;
      return true;
    }

    return false;
  }

  @Override
  public boolean isAffected()
  {
    EntityLiving handle = this.m_entity.getHandle();
    return !(handle instanceof EntityAnimal) || ((EntityAnimal)handle).cc();
  }

  @Override
  public void resetAffection()
  {
    if(this.m_entity.getHandle() instanceof EntityAnimal)
      ((EntityAnimal)this.m_entity.getHandle()).cd();
  }
}
TOP

Related Classes of de.kumpelblase2.remoteentities.api.features.RemoteMateFeature

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.