Java Code Examples for net.minecraft.entity.player.EntityPlayer#isEntityAlive()

The following examples show how to use net.minecraft.entity.player.EntityPlayer#isEntityAlive() . 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 File: AimBot.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onTicks() {
    block3:
    {
        try {
            if (KillAura.isActive || MobAura.isActive || ProphuntAura.isActive) {
                break block3;
            }
            for (Object o : Wrapper.INSTANCE.world().loadedEntityList) {
                EntityPlayer e;
                if (!(o instanceof EntityPlayer) || (e = (EntityPlayer) o) instanceof EntityPlayerSP || Wrapper.INSTANCE.player().getDistanceToEntity(e) > CheatConfiguration.config.aimbotdistance || e.isDead || !Wrapper.INSTANCE.player().canEntityBeSeen(e) || !e.isEntityAlive() || e.isDead || AuraConfiguration.config.friends.contains(e.getCommandSenderName())) {
                    continue;
                }
                AimBot.faceEntity(e);
                break;
            }
        } catch (Exception ex) {
        }
    }
}
 
Example 2
Source File: EntityEndermanFighter.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void updateIsBeingControlled()
{
    for (int i = 0; i < this.getEntityWorld().playerEntities.size(); ++i)
    {
        EntityPlayer playerTmp = (EntityPlayer)this.getEntityWorld().playerEntities.get(i);

        // If there is a player holding an Ender Sword in Summon mode within 32 blocks, then this fighter won't attack players
        if (playerTmp.isEntityAlive() &&
            playerTmp.getDistanceSq(this.posX, this.posY, this.posZ) < 1024.0d &&
            this.isPlayerHoldingSummonItem(playerTmp))
        {
            this.isBeingControlled = true;
            return;
        }
    }

    this.isBeingControlled = false;
}
 
Example 3
Source File: EntityEndermanFighter.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Nullable
protected EntityPlayer getClosestVulnerablePlayer(double x, double y, double z, double distance)
{
    double closest = -1.0d;
    EntityPlayer player = null;
    List<EntityPlayer> players = this.getEntityWorld().getPlayers(EntityPlayer.class, EntitySelectors.NOT_SPECTATING);

    for (EntityPlayer playerTmp : players)
    {
        if (playerTmp.capabilities.disableDamage == false && playerTmp.isEntityAlive() && this.isPlayerHoldingSummonItem(playerTmp) == false)
        {
            double distTmp = playerTmp.getDistanceSq(x, y, z);
            double distSight =playerTmp.isSneaking() ? distance * 0.8d : distance;

            if (playerTmp.isInvisible())
            {
                float f = playerTmp.getArmorVisibility();

                if (f < 0.1f)
                {
                    f = 0.1f;
                }

                distSight *= (0.7d * f);
            }

            if ((distance < 0.0d || distTmp < (distSight * distSight)) && (closest == -1.0d || distTmp < closest))
            {
                closest = distTmp;
                player = playerTmp;
            }
        }
    }

    return player;
}
 
Example 4
Source File: EntityEndermanFighter.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean shouldAttackPlayer(@Nonnull EntityPlayer player)
{
    // The fighters attack players that are not holding an Ender Sword in the Summon mode, unless they have been renamed
    // (this allows having them around without them teleporting out and attacking unless you are always holding and Ender Sword...)
    if (this.isBeingControlled || this.hasCustomName() || player.isEntityAlive() == false ||
        player.capabilities.disableDamage || this.isPlayerHoldingSummonItem(player))
    {
        return false;
    }

    return true;
}
 
Example 5
Source File: MessageOpenBackpack.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@Override
public void handle(MessageOpenBackpack message, MessageContext ctx) {
	EntityPlayer player = getPlayer(ctx);
	IBackpack backpack = BackpackHelper.getBackpack(player);
	if ((backpack != null) && player.isEntityAlive() &&
	    WearableBackpacks.CONFIG.enableSelfInteraction.get())
		backpack.getType().onEquippedInteract(player, player, backpack);
}
 
Example 6
Source File: BackpackHelper.java    From WearableBackpacks with MIT License 5 votes vote down vote up
/** Checks if a player can open an entity's equipped backpack.
 *  Returns if the player stands close enough to and behind the carrier.
 *  Always returns true if player and carrier are the same entity. */
public static boolean canInteractWithEquippedBackpack(EntityPlayer player, EntityLivingBase carrier) {
	IBackpack backpack = getBackpack(carrier);
	if ((backpack == null) || !player.isEntityAlive() || !carrier.isEntityAlive()) return false;
	if (player == carrier) return true;
	
	double distance = player.getDistance(carrier);
	// Calculate angle between player and carrier.
	double angle = Math.toDegrees(Math.atan2(carrier.posZ - player.posZ, carrier.posX - player.posX));
	// Calculate difference between angle and the direction the carrier entity is looking.
	angle = ((angle - carrier.renderYawOffset - 90) % 360 + 540) % 360 - 180;
	return ((distance <= INTERACT_MAX_DISTANCE) && (Math.abs(angle) < INTERACT_MAX_ANGLE / 2));
}
 
Example 7
Source File: EntityFugitive.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public boolean apply(@Nullable EntityPlayer player) {
	return player.isEntityAlive() && holdingLead(player);
}