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

The following examples show how to use net.minecraft.entity.Entity#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: NPCUtils.java    From SkyblockAddons with MIT License 6 votes vote down vote up
/**
 * Checks if the given entity is an NPC
 *
 * @param entity the entity to check
 * @return {@code true} if the entity is an NPC, {@code false} otherwise
 */
public static boolean isNPC(Entity entity) {
    if (entity instanceof EntityOtherPlayerMP) {
        EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity;
        ScorePlayerTeam playerTeam = (ScorePlayerTeam) player.getTeam();

        // If it doesn't have a team, it's likely not a player.
        if (player.getTeam() == null) {
            return false;
        }

        // If it doesn't have a color prefix, it's not a player.
        return playerTeam.getColorPrefix().equals("");
    } else if (entity instanceof EntityArmorStand) {
        return entity.isInvisible();
    } else {
        return false;
    }
}
 
Example 2
Source File: EntityUtils.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
public static boolean isSelected(final Entity entity, final boolean canAttackCheck) {
    if(entity instanceof EntityLivingBase && (targetDead || entity.isEntityAlive()) && entity != mc.thePlayer) {
        if(targetInvisible || !entity.isInvisible()) {
            if(targetPlayer && entity instanceof EntityPlayer) {
                final EntityPlayer entityPlayer = (EntityPlayer) entity;

                if(canAttackCheck) {
                    if(AntiBot.isBot(entityPlayer))
                        return false;

                    if (isFriend(entityPlayer) && !LiquidBounce.moduleManager.getModule(NoFriends.class).getState())
                        return false;

                    if(entityPlayer.isSpectator())
                        return false;

                    final Teams teams = (Teams) LiquidBounce.moduleManager.getModule(Teams.class);
                    return !teams.getState() || !teams.isInYourTeam(entityPlayer);
                }

                return true;
            }

            return targetMobs && isMob(entity) || targetAnimals && isAnimal(entity);

        }
    }
    return false;
}
 
Example 3
Source File: ProphuntEspHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// set color
	float alpha = 0.5F + 0.25F * MathHelper
		.sin(System.currentTimeMillis() % 1000 / 500F * (float)Math.PI);
	GL11.glColor4f(1, 0, 0, alpha);
	
	// draw boxes
	for(Entity entity : MC.world.getEntities())
	{
		if(!(entity instanceof MobEntity))
			continue;
		
		if(!entity.isInvisible())
			continue;
		
		if(MC.player.squaredDistanceTo(entity) < 0.25)
			continue;
		
		GL11.glPushMatrix();
		GL11.glTranslated(entity.getX(), entity.getY(), entity.getZ());
		
		RenderUtils.drawOutlinedBox(FAKE_BLOCK_BOX);
		RenderUtils.drawSolidBox(FAKE_BLOCK_BOX);
		
		GL11.glPopMatrix();
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}