Java Code Examples for net.minecraft.util.org.apache.commons.lang3.StringUtils
The following examples show how to use
net.minecraft.util.org.apache.commons.lang3.StringUtils. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: EntityAPI Source File: BehaviourGoalTarget.java License: GNU Lesser General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.getHandle()) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) { return false; } if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET; if (this instanceof BehaviourGoalDefendVillage) { reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE; } else if (this instanceof BehaviourGoalHurtByTarget) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY; } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) { if (entityliving instanceof EntityHuman) { reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER; } } else if (this instanceof BehaviourGoalDefendTamer) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER; } else if (this instanceof BehaviourGoalHelpTamerTarget) { reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET; } org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason); if (event.isCancelled() || event.getTarget() == null) { this.getControllableEntity().setTarget(null); return false; } else if (entityliving.getBukkitEntity() != event.getTarget()) { this.getControllableEntity().setTarget(event.getTarget()); } if (this.getHandle() instanceof EntityCreature) { ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle(); } // CraftBukkit end return true; } } }
Example 2
Source Project: EntityAPI Source File: BehaviourGoalTarget.java License: GNU Lesser General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.getHandle()) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) { return false; } if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET; if (this instanceof BehaviourGoalDefendVillage) { reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE; } else if (this instanceof BehaviourGoalHurtByTarget) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY; } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) { if (entityliving instanceof EntityHuman) { reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER; } } else if (this instanceof BehaviourGoalDefendTamer) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER; } else if (this instanceof BehaviourGoalHelpTamerTarget) { reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET; } org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason); if (event.isCancelled() || event.getTarget() == null) { this.getControllableEntity().setTarget(null); return false; } else if (entityliving.getBukkitEntity() != event.getTarget()) { this.getControllableEntity().setTarget(event.getTarget()); } if (this.getHandle() instanceof EntityCreature) { ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle(); } // CraftBukkit end return true; } } }
Example 3
Source Project: EntityAPI Source File: BehaviourGoalTarget.java License: GNU Lesser General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.getHandle()) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) { return false; } if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET; if (this instanceof BehaviourGoalDefendVillage) { reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE; } else if (this instanceof BehaviourGoalHurtByTarget) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY; } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) { if (entityliving instanceof EntityHuman) { reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER; } } else if (this instanceof BehaviourGoalDefendTamer) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER; } else if (this instanceof BehaviourGoalHelpTamerTarget) { reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET; } org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason); if (event.isCancelled() || event.getTarget() == null) { this.getControllableEntity().setTarget(null); return false; } else if (entityliving.getBukkitEntity() != event.getTarget()) { this.getControllableEntity().setTarget(event.getTarget()); } if (this.getHandle() instanceof EntityCreature) { ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle(); } // CraftBukkit end return true; } } }
Example 4
Source Project: EntityAPI Source File: BehaviourGoalTarget.java License: GNU Lesser General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.getHandle()) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) { return false; } if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET; if (this instanceof BehaviourGoalDefendVillage) { reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE; } else if (this instanceof BehaviourGoalHurtByTarget) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY; } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) { if (entityliving instanceof EntityHuman) { reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER; } } else if (this instanceof BehaviourGoalDefendTamer) { reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER; } else if (this instanceof BehaviourGoalHelpTamerTarget) { reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET; } org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason); if (event.isCancelled() || event.getTarget() == null) { this.getControllableEntity().setTarget(null); return false; } else if (entityliving.getBukkitEntity() != event.getTarget()) { this.getControllableEntity().setTarget(event.getTarget()); } if (this.getHandle() instanceof EntityCreature) { ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle(); } // CraftBukkit end return true; } } }
Example 5
Source Project: EchoPet Source File: PetGoalTarget.java License: GNU General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.handle) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerUUID())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerUUID().equals(((EntityOwnable) entityliving).getOwnerUUID())) { return false; } if (entityliving == ((EntityOwnable) this.handle).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } return true; } } }
Example 6
Source Project: EchoPet Source File: PetGoalTarget.java License: GNU General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.handle) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerUUID())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerUUID().equals(((EntityOwnable) entityliving).getOwnerUUID())) { return false; } if (entityliving == ((EntityOwnable) this.handle).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } return true; } } }
Example 7
Source Project: EchoPet Source File: PetGoalTarget.java License: GNU General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.handle) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerName())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) { return false; } if (entityliving == ((EntityOwnable) this.handle).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } return true; } } }
Example 8
Source Project: EchoPet Source File: PetGoalTarget.java License: GNU General Public License v3.0 | 4 votes |
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) { if (entityliving == null) { return false; } else if (entityliving == this.handle) { return false; } else if (!entityliving.isAlive()) { return false; } else if (!this.canAttackClass(entityliving.getClass())) { return false; } else { if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerName())) { if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) { return false; } if (entityliving == ((EntityOwnable) this.handle).getOwner()) { return false; } } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) { return false; } if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) { return false; } else { if (this.useMelee) { if (--this.ticksAfterLastAttack <= 0) { this.shouldAttack = 0; } if (this.shouldAttack == 0) { this.shouldAttack = this.attack(entityliving) ? 1 : 2; } if (this.shouldAttack == 2) { return false; } } return true; } } }