當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityTargetEvent.TargetReason方法代碼示例

本文整理匯總了Java中org.bukkit.event.entity.EntityTargetEvent.TargetReason方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityTargetEvent.TargetReason方法的具體用法?Java EntityTargetEvent.TargetReason怎麽用?Java EntityTargetEvent.TargetReason使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.entity.EntityTargetEvent的用法示例。


在下文中一共展示了EntityTargetEvent.TargetReason方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: c

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
private void c(Entity entity, EntityTargetEvent.TargetReason reason) { // add TargetReason
    EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), entity.getBukkitEntity(), reason);
    this.world.getServer().getPluginManager().callEvent(event);

    if (event.isCancelled()) {
        return;
    }

    if (event.getTarget() == null) {
        this.target = null;
        return;
    }
    entity = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
    // CraftBukkit end

    this.target = entity;
    this.angerLevel = 400 + this.random.nextInt(400);
    this.soundDelay = this.random.nextInt(40);
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:20,代碼來源:EntityPigZombie.java

示例2: shouldContinue

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Override
public boolean shouldContinue() {
    LivingEntity target = this.getControllableEntity().getTarget();

    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.getControllableEntity().getTarget() == null ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    if (this.getControllableEntity().getTarget() == null || (this.getControllableEntity().getTarget() != null && !((CraftLivingEntity) this.getControllableEntity().getTarget()).getHandle().isAlive())) {
        org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityTargetEvent(this.getHandle(), null, reason);
    }
    // CraftBukkit end

    if (target == null) {
        return false;
    }
    EntityLiving targetHandle = ((CraftLivingEntity) target).getHandle();
    return !targetHandle.isAlive() ? false : (!this.ignoreSight ? !NMSEntityUtil.getNavigation(this.getHandle()).g() : NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(targetHandle.locX), MathHelper.floor(targetHandle.locY), MathHelper.floor(targetHandle.locZ)));
}
 
開發者ID:EntityAPIDev,項目名稱:EntityAPI,代碼行數:18,代碼來源:BehaviourGoalMeleeAttack.java

示例3: shouldContinue

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Override
public boolean shouldContinue() {
    LivingEntity target = this.getControllableEntity().getTarget();

    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.getControllableEntity().getTarget() == null ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    if (this.getControllableEntity().getTarget() == null || (this.getControllableEntity().getTarget() != null && !((CraftLivingEntity) this.getControllableEntity().getTarget()).getHandle().isAlive())) {
        org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callEntityTargetEvent(this.getHandle(), null, reason);
    }
    // CraftBukkit end

    if (target == null) {
        return false;
    }
    EntityLiving targetHandle = ((CraftLivingEntity) target).getHandle();
    return !targetHandle.isAlive() ? false : (!this.ignoreSight ? !NMSEntityUtil.getNavigation(this.getHandle()).g() : NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(targetHandle.locX), MathHelper.floor(targetHandle.locY), MathHelper.floor(targetHandle.locZ)));
}
 
開發者ID:EntityAPIDev,項目名稱:EntityAPI,代碼行數:18,代碼來源:BehaviourGoalMeleeAttack.java

示例4: b

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public boolean b() {
    EntityLiving entityliving = this.b.getGoalTarget();

    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.b.getGoalTarget() == null ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    if (this.b.getGoalTarget() == null || (this.b.getGoalTarget() != null && !this.b.getGoalTarget().isAlive())) {
        org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
    }
    // CraftBukkit end

    return entityliving == null ? false : (!entityliving.isAlive() ? false : (!this.e ? !this.b.getNavigation().g() : this.b.b(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))));
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:13,代碼來源:PathfinderGoalMeleeAttack.java

示例5: d

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public void d() {
    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.c.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this.c, null, reason);
    // CraftBukkit end
    this.c = null;
    this.b.getNavigation().h();
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:9,代碼來源:PathfinderGoalOcelotAttack.java

示例6: d

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public void d() {
    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.c.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent((Entity) b, null, reason);
    // CraftBukkit end
    this.c = null;
    this.f = 0;
    this.d = -1;
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:10,代碼來源:PathfinderGoalArrowAttack.java

示例7: resetTask

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public void resetTask()
{
    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.attackTarget.isEntityAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent((Entity) rangedAttackEntityHost, null, reason);
    // CraftBukkit end
    this.attackTarget = null;
    this.field_75318_f = 0;
    this.rangedAttackTime = -1;
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:11,代碼來源:EntityAIArrowAttack.java

示例8: continueExecuting

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public boolean continueExecuting()
{
    EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();
    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.attacker.getAttackTarget() == null ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;

    if (this.attacker.getAttackTarget() == null || (this.attacker.getAttackTarget() != null && !this.attacker.getAttackTarget().isEntityAlive()))
    {
        org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(attacker, null, reason);
    }

    // CraftBukkit end
    return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistance(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ))));
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:15,代碼來源:EntityAIAttackOnCollide.java

示例9: stopExecuting

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Override
public void stopExecuting()
{
	EntityTargetEvent.TargetReason reason = this.m_target.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
	CraftEventFactory.callEntityTargetEvent(this.getEntityHandle(), null, reason);
	this.m_target = null;
	this.m_inRangeTick = 0;
	this.m_shootTicks = -1;
}
 
開發者ID:kumpelblase2,項目名稱:remote-entities-nxt,代碼行數:10,代碼來源:DesireRangedAttack.java

示例10: stopExecuting

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Override
public void stopExecuting()
{
	EntityTargetEvent.TargetReason reason = (this.m_target == null || this.m_target.isAlive()) ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
       CraftEventFactory.callEntityTargetEvent(this.getEntityHandle(), null, reason);

	this.m_target = null;
	this.getNavigation().h();
}
 
開發者ID:kumpelblase2,項目名稱:remote-entities-nxt,代碼行數:10,代碼來源:DesireMoveAndMeleeAttack.java

示例11: stopExecuting

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Override
public void stopExecuting()
{
	EntityTargetEvent.TargetReason reason = (this.m_target == null || this.m_target.isAlive()) ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
	CraftEventFactory.callEntityTargetEvent(this.getEntityHandle(), null, reason);

	this.m_target = null;
	this.getNavigation().h();
}
 
開發者ID:MeRPG2,項目名稱:EndHQ-Libraries,代碼行數:10,代碼來源:DesireMoveAndMeleeAttack.java

示例12: d

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public void d() {
    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.c.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
    // CraftBukkit end

    this.c = null;
    this.b.getNavigation().g();
}
 
開發者ID:didoupimpon,項目名稱:Craft-city,代碼行數:10,代碼來源:PathfinderGoalMeleeAttack.java

示例13: finish

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Override
public void finish() {
    // CraftBukkit start
    EntityTargetEvent.TargetReason reason = this.target.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
    CraftEventFactory.callEntityTargetEvent(this.getHandle(), null, reason);
    // CraftBukkit end
    this.target = null;
    this.inRangeTicks = 0;
    this.shootCooldown = -1;
}
 
開發者ID:EntityAPIDev,項目名稱:EntityAPI,代碼行數:11,代碼來源:BehaviourGoalRangedAttack.java

示例14: getReturnType

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public Class<? extends EntityTargetEvent.TargetReason> getReturnType() {
	return EntityTargetEvent.TargetReason.class;
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:4,代碼來源:ExprTargetReason.java

示例15: get

import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Nullable
protected EntityTargetEvent.TargetReason[] get(Event e) {
	return new EntityTargetEvent.TargetReason[]{((EntityTargetEvent)e).getReason()};
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:5,代碼來源:ExprTargetReason.java


注:本文中的org.bukkit.event.entity.EntityTargetEvent.TargetReason方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。