Java Code Examples for net.minecraft.entity.EntityLivingBase#equals()

The following examples show how to use net.minecraft.entity.EntityLivingBase#equals() . 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: ChamsMod.java    From ForgeHax with MIT License 5 votes vote down vote up
public boolean shouldDraw(EntityLivingBase entity) {
  return !entity.equals(MC.player)
      && !entity.isDead
      && ((mobs_hostile.get() && EntityUtils.isHostileMob(entity))
      || // check this first
      (players.get() && EntityUtils.isPlayer(entity))
      || (mobs_friendly.get() && EntityUtils.isFriendlyMob(entity)));
}
 
Example 2
Source File: AntiEffectsMod.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
  EntityLivingBase living = event.getEntityLiving();
  if (living.equals(MC.player)) {
    living.setInvisible(false);
    living.removePotionEffect(MobEffects.NAUSEA);
    living.removePotionEffect(MobEffects.INVISIBILITY);
    living.removePotionEffect(MobEffects.BLINDNESS);
    // removes particle effect
    FastReflection.Methods.EntityLivingBase_resetPotionEffectMetadata.invoke(living);
  } else if (no_particles.get()) {
    living.setInvisible(false);
    FastReflection.Methods.EntityLivingBase_resetPotionEffectMetadata.invoke(living);
  }
}
 
Example 3
Source File: ClientProxy.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
@Override
public void showJetpackParticles(World world, EntityLivingBase wearer, ParticleType particle) {
    if (mc.gameSettings.particleSetting == 0 || mc.gameSettings.particleSetting == 1 && mc.theWorld.getTotalWorldTime() % 4L == 0) {
        Vec3 userPos = Vec3.createVectorHelper(wearer.posX, wearer.posY, wearer.posZ);
        
        if (!wearer.equals(mc.thePlayer)) {
            userPos = userPos.addVector(0, 1.6D, 0);
        }
        
        Random rand = MathHelper.RANDOM;
        
        Vec3 vLeft = Vec3.createVectorHelper(-0.28D, -0.95D, -0.38D);
        vLeft.rotateAroundY((float) Math.toRadians(-wearer.renderYawOffset));
        
        Vec3 vRight = Vec3.createVectorHelper(0.28D, -0.95D, -0.38D);
        vRight.rotateAroundY((float) Math.toRadians(-wearer.renderYawOffset));
        
        Vec3 vCenter = Vec3.createVectorHelper((rand.nextFloat() - 0.5F) * 0.25F, -0.95D, -0.38D);
        vCenter.rotateAroundY((float) Math.toRadians(-wearer.renderYawOffset));
        
        vLeft = vLeft.addVector(-wearer.motionX * 0.2D, -wearer.motionY * 0.2D, -wearer.motionZ * 0.2D);
        vRight = vRight.addVector(-wearer.motionX * 0.2D, -wearer.motionY * 0.2D, -wearer.motionZ * 0.2D);
        vCenter = vCenter.addVector(-wearer.motionX * 0.2D, -wearer.motionY * 0.2D, -wearer.motionZ * 0.2D);
        
        Vec3 v = userPos.addVector(vLeft.xCoord, vLeft.yCoord, vLeft.zCoord);
        ParticleUtils.spawnParticle(particle, world, v.xCoord, v.yCoord, v.zCoord, rand.nextDouble() * 0.05D - 0.025D, -0.2D, rand.nextDouble() * 0.05D - 0.025D);
        
        v = userPos.addVector(vRight.xCoord, vRight.yCoord, vRight.zCoord);
        ParticleUtils.spawnParticle(particle, world, v.xCoord, v.yCoord, v.zCoord, rand.nextDouble() * 0.05D - 0.025D, -0.2D, rand.nextDouble() * 0.05D - 0.025D);
        
        v = userPos.addVector(vCenter.xCoord, vCenter.yCoord, vCenter.zCoord);
        ParticleUtils.spawnParticle(particle, world, v.xCoord, v.yCoord, v.zCoord, rand.nextDouble() * 0.05D - 0.025D, -0.2D, rand.nextDouble() * 0.05D - 0.025D);
    }
}
 
Example 4
Source File: WaifuESP.java    From ForgeHax with MIT License 4 votes vote down vote up
private boolean shouldDraw(EntityLivingBase entity) {
  return (!entity.equals(MC.player)
      && EntityUtils.isAlive(entity)
      && EntityUtils.isValidEntity(entity)
      && (EntityUtils.isPlayer(entity)));
}