本文整理匯總了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);
}
示例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)));
}
示例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)));
}
示例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))));
}
示例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();
}
示例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;
}
示例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;
}
示例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))));
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例14: getReturnType
import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
public Class<? extends EntityTargetEvent.TargetReason> getReturnType() {
return EntityTargetEvent.TargetReason.class;
}
示例15: get
import org.bukkit.event.entity.EntityTargetEvent; //導入方法依賴的package包/類
@Nullable
protected EntityTargetEvent.TargetReason[] get(Event e) {
return new EntityTargetEvent.TargetReason[]{((EntityTargetEvent)e).getReason()};
}