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

The following examples show how to use net.minecraft.entity.player.EntityPlayer#isInvisible() . 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: AboveHeadDisplay.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean loadOrRender(EntityPlayer player) {
    for (PotionEffect effect : player.getActivePotionEffects()) {
        if (effect.getPotionID() == 14) return false;
    }

    if (!renderFromTeam(player) || player.riddenByEntity != null) {
        return false;
    }

    int renderDistance = Levelhead.getInstance().getDisplayManager().getMasterConfig().getRenderDistance();
    int min = Math.min(64 * 64, renderDistance * renderDistance);
    return !(player.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) > min) &&
        (!player.hasCustomName() || !player.getCustomNameTag().isEmpty()) &&
        !player.getDisplayName().toString().isEmpty() &&
        existedMoreThan5Seconds.contains(player.getUniqueID()) &&
        !player.getDisplayName().getFormattedText().contains(ChatColor.COLOR_CHAR + "k") &&
        !player.isInvisible() &&
        !player.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) &&
        !player.isSneaking();
}
 
Example 2
Source File: CapeHandler.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Post event) {
	EntityPlayer player = event.getEntityPlayer();
	float delta = event.getPartialRenderTick();
	if (ClientConfigValues.renderCape && !player.isInvisible() && !VanishTracker.isVanished(player) && !player.isElytraFlying() && !player.isPlayerSleeping() && delta != 1) {
		RenderCape cape = getCape(player);
		if (cape.isPresent(player)) {
			cape.render(
					player,
					player.posX - cape.posX - TileEntityRendererDispatcher.staticPlayerX,
					player.posY - cape.posY - TileEntityRendererDispatcher.staticPlayerY,
					player.posZ - cape.posZ - TileEntityRendererDispatcher.staticPlayerZ,
					delta
			);
		}
	}
}
 
Example 3
Source File: WingsRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@InvokeEvent
public void onRenderPlayer(RenderPlayerEvent event) {
    if (CosmeticsUtil.shouldHide(EnumPurchaseType.WING_COSMETIC)) return;
    EntityPlayer player = event.getEntity();
    if (wingsCosmetic.isPurchasedBy(event.getEntity().getUniqueID()) && !player.isInvisible()) {
        HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
        if (packageIfReady == null || packageIfReady.getCachedSettings().isWingsDisabled()) return;
        renderWings(player, event.getPartialTicks(), event.getX(), event.getY(), event.getZ());
    }
}
 
Example 4
Source File: DragonHeadRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@InvokeEvent
public void onRenderPlayer(RenderPlayerEvent event) {
    if (CosmeticsUtil.shouldHide(EnumPurchaseType.DRAGON_HEAD)) return;
    EntityPlayer entity = event.getEntity();
    if (dragonCosmetic.isPurchasedBy(entity.getUniqueID()) && !entity.isInvisible()) {
        HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
        if (packageIfReady == null || packageIfReady.getCachedSettings().isDragonHeadDisabled()) return;

        GlStateManager.pushMatrix();
        GlStateManager.translate(event.getX(), event.getY(), event.getZ());
        renderHead(event.getEntity(), event.getPartialTicks());
        GlStateManager.popMatrix();
    }

}
 
Example 5
Source File: AimAssist.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private boolean isAttackable(Entity e) {
    if (e == null) {
        return false;
    }
    if (e instanceof EntityPlayer) {
        EntityPlayer p2 = (EntityPlayer) e;
        return !p2.isDead && !p2.isInvisible() && Wrapper.INSTANCE.player().getDistanceToEntity(p2) <= this.range && Wrapper.INSTANCE.player().canEntityBeSeen(p2) && p2 != Wrapper.INSTANCE.player();
    }
    return false;
}
 
Example 6
Source File: GuardAIFollow.java    From YouTubeModdingTutorial with MIT License 5 votes vote down vote up
@Override
public boolean shouldExecute() {
    List<EntityPlayer> list = this.entity.world.getEntitiesWithinAABB(EntityPlayer.class, this.entity.getEntityBoundingBox().grow((double) this.areaSize));

    for (EntityPlayer player : list) {
        if (!player.isInvisible()) {
            this.followingPlayer = player;
            return true;
        }
    }

    return false;
}
 
Example 7
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;
}